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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Oct 2021 08:43:32 +0000 (10:43 +0200)
commit5182d6db80bb2f08a7d700c5c4b8c3d0db58411c
tree90b7fc8da0746cecafc8075d7633529bc783e1a4
parentbcb647c1e15d3ddd8ab94d556aa38d77448b40d9
netfilter: nf_nat_masquerade: make async masq_inet6_event handling generic

[ Upstream commit 30db406923b9285a9bac06a6af5e74bd6d0f1d06 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_nat_masquerade.c