Commit 4e665afbd7bee29b44b5d22821b56207f8459e39
Committed by
Pablo Neira Ayuso
1 parent
35a8a3bd1c
netfilter: cttimeout: move ctnl_untimeout to nf_conntrack
As, ctnl_untimeout is required by nft_ct, so move ctnl_timeout from nfnetlink_cttimeout to nf_conntrack_timeout and rename as nf_ct_timeout. Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Showing 3 changed files with 20 additions and 18 deletions Side-by-side Diff
include/net/netfilter/nf_conntrack_timeout.h
... | ... | @@ -83,6 +83,7 @@ |
83 | 83 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
84 | 84 | int nf_conntrack_timeout_init(void); |
85 | 85 | void nf_conntrack_timeout_fini(void); |
86 | +void nf_ct_untimeout(struct net *net, struct ctnl_timeout *timeout); | |
86 | 87 | #else |
87 | 88 | static inline int nf_conntrack_timeout_init(void) |
88 | 89 | { |
net/netfilter/nf_conntrack_timeout.c
... | ... | @@ -31,6 +31,23 @@ |
31 | 31 | void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout) __read_mostly; |
32 | 32 | EXPORT_SYMBOL_GPL(nf_ct_timeout_put_hook); |
33 | 33 | |
34 | +static int untimeout(struct nf_conn *ct, void *timeout) | |
35 | +{ | |
36 | + struct nf_conn_timeout *timeout_ext = nf_ct_timeout_find(ct); | |
37 | + | |
38 | + if (timeout_ext && (!timeout || timeout_ext->timeout == timeout)) | |
39 | + RCU_INIT_POINTER(timeout_ext->timeout, NULL); | |
40 | + | |
41 | + /* We are not intended to delete this conntrack. */ | |
42 | + return 0; | |
43 | +} | |
44 | + | |
45 | +void nf_ct_untimeout(struct net *net, struct ctnl_timeout *timeout) | |
46 | +{ | |
47 | + nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); | |
48 | +} | |
49 | +EXPORT_SYMBOL_GPL(nf_ct_untimeout); | |
50 | + | |
34 | 51 | static const struct nf_ct_ext_type timeout_extend = { |
35 | 52 | .len = sizeof(struct nf_conn_timeout), |
36 | 53 | .align = __alignof__(struct nf_conn_timeout), |
net/netfilter/nfnetlink_cttimeout.c
... | ... | @@ -297,22 +297,6 @@ |
297 | 297 | return ret; |
298 | 298 | } |
299 | 299 | |
300 | -static int untimeout(struct nf_conn *ct, void *timeout) | |
301 | -{ | |
302 | - struct nf_conn_timeout *timeout_ext = nf_ct_timeout_find(ct); | |
303 | - | |
304 | - if (timeout_ext && (!timeout || timeout_ext->timeout == timeout)) | |
305 | - RCU_INIT_POINTER(timeout_ext->timeout, NULL); | |
306 | - | |
307 | - /* We are not intended to delete this conntrack. */ | |
308 | - return 0; | |
309 | -} | |
310 | - | |
311 | -static void ctnl_untimeout(struct net *net, struct ctnl_timeout *timeout) | |
312 | -{ | |
313 | - nf_ct_iterate_cleanup_net(net, untimeout, timeout, 0, 0); | |
314 | -} | |
315 | - | |
316 | 300 | /* try to delete object, fail if it is still in use. */ |
317 | 301 | static int ctnl_timeout_try_del(struct net *net, struct ctnl_timeout *timeout) |
318 | 302 | { |
... | ... | @@ -325,7 +309,7 @@ |
325 | 309 | /* We are protected by nfnl mutex. */ |
326 | 310 | list_del_rcu(&timeout->head); |
327 | 311 | nf_ct_l4proto_put(timeout->l4proto); |
328 | - ctnl_untimeout(net, timeout); | |
312 | + nf_ct_untimeout(net, timeout); | |
329 | 313 | kfree_rcu(timeout, rcu_head); |
330 | 314 | } else { |
331 | 315 | ret = -EBUSY; |
... | ... | @@ -573,7 +557,7 @@ |
573 | 557 | struct ctnl_timeout *cur, *tmp; |
574 | 558 | |
575 | 559 | nf_ct_unconfirmed_destroy(net); |
576 | - ctnl_untimeout(net, NULL); | |
560 | + nf_ct_untimeout(net, NULL); | |
577 | 561 | |
578 | 562 | list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list, head) { |
579 | 563 | list_del_rcu(&cur->head); |