mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
netfilter: nat: use test_and_clear_bit when deleting ct from bysource list
We can use a single statement for this. While at it, fixup the comment -- we don't have pernet table/ops anymore, the function is only called from module exit path. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
63c2af90e5
commit
2420770b3f
1 changed files with 3 additions and 6 deletions
|
@ -542,17 +542,14 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
|
||||||
if (nf_nat_proto_remove(ct, data))
|
if (nf_nat_proto_remove(ct, data))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if ((ct->status & IPS_SRC_NAT_DONE) == 0)
|
/* This module is being removed and conntrack has nat null binding.
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* This netns is being destroyed, and conntrack has nat null binding.
|
|
||||||
* Remove it from bysource hash, as the table will be freed soon.
|
* Remove it from bysource hash, as the table will be freed soon.
|
||||||
*
|
*
|
||||||
* Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
|
* Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
|
||||||
* will delete entry from already-freed table.
|
* will delete entry from already-freed table.
|
||||||
*/
|
*/
|
||||||
clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
|
if (test_and_clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status))
|
||||||
__nf_nat_cleanup_conntrack(ct);
|
__nf_nat_cleanup_conntrack(ct);
|
||||||
|
|
||||||
/* don't delete conntrack. Although that would make things a lot
|
/* don't delete conntrack. Although that would make things a lot
|
||||||
* simpler, we'd end up flushing all conntracks on nat rmmod.
|
* simpler, we'd end up flushing all conntracks on nat rmmod.
|
||||||
|
|
Loading…
Add table
Reference in a new issue