Skip to content

Commit 17438b4

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: remove nf_ct_unconfirmed_destroy helper
This helper tags connections not yet in the conntrack table as dying. These nf_conn entries will be dropped instead when the core attempts to insert them from the input or postrouting 'confirm' hook. After the previous change, the entries get unlinked from the list earlier, so that by the time the actual exit hook runs, new connections no longer have a timeout policy assigned. Its enough to walk the hashtable instead. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 78222ba commit 17438b4

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

include/net/netfilter/nf_conntrack.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,6 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
237237
return nf_ct_delete(ct, 0, 0);
238238
}
239239

240-
/* Set all unconfirmed conntrack as dying */
241-
void nf_ct_unconfirmed_destroy(struct net *);
242-
243240
/* Iterate over all conntracks: if iter returns true, it's deleted. */
244241
void nf_ct_iterate_cleanup_net(struct net *net,
245242
int (*iter)(struct nf_conn *i, void *data),

net/netfilter/nf_conntrack_core.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,20 +2431,6 @@ __nf_ct_unconfirmed_destroy(struct net *net)
24312431
}
24322432
}
24332433

2434-
void nf_ct_unconfirmed_destroy(struct net *net)
2435-
{
2436-
struct nf_conntrack_net *cnet = nf_ct_pernet(net);
2437-
2438-
might_sleep();
2439-
2440-
if (atomic_read(&cnet->count) > 0) {
2441-
__nf_ct_unconfirmed_destroy(net);
2442-
nf_queue_nf_hook_drop(net);
2443-
synchronize_net();
2444-
}
2445-
}
2446-
EXPORT_SYMBOL_GPL(nf_ct_unconfirmed_destroy);
2447-
24482434
void nf_ct_iterate_cleanup_net(struct net *net,
24492435
int (*iter)(struct nf_conn *i, void *data),
24502436
void *data, u32 portid, int report)

net/netfilter/nfnetlink_cttimeout.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,9 @@ static void __net_exit cttimeout_net_exit(struct net *net)
608608
struct nfct_timeout_pernet *pernet = nfct_timeout_pernet(net);
609609
struct ctnl_timeout *cur, *tmp;
610610

611-
nf_ct_unconfirmed_destroy(net);
611+
if (list_empty(&pernet->nfct_timeout_freelist))
612+
return;
613+
612614
nf_ct_untimeout(net, NULL);
613615

614616
list_for_each_entry_safe(cur, tmp, &pernet->nfct_timeout_freelist, head) {

0 commit comments

Comments
 (0)