netfilter: nf_nat_masquerade: make async masq_inet6_event handling generic
authorFlorian Westphal <fw@strlen.de>
Wed, 15 Sep 2021 14:46:38 +0000 (16:46 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Sep 2021 01:46:56 +0000 (03:46 +0200)
commit30db406923b9285a9bac06a6af5e74bd6d0f1d06
treec25c0a6a8728733cf1dfcc5a4f4ef0ace056f808
parent45928afe94a094bcda9af858b96673d59bc4a0e9
netfilter: nf_nat_masquerade: make async masq_inet6_event handling generic

masq_inet6_event is called asynchronously from system work queue,
because the inet6 notifier is atomic and nf_iterate_cleanup can sleep.

The ipv4 and device notifiers call nf_iterate_cleanup directly.

This is legal, but these notifiers are called with RTNL mutex held.
A large conntrack table with many devices coming and going will have severe
impact on the system usability, with 'ip a' blocking for several seconds.

This change places the defer code into a helper and makes it more
generic so ipv4 and ifdown notifiers can be converted to defer the
cleanup walk as well in a follow patch.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_masquerade.c