netfilter: nat: don't register device notifier twice
authorFlorian Westphal <fw@strlen.de>
Wed, 6 Mar 2019 11:44:17 +0000 (12:44 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 8 Mar 2019 15:41:09 +0000 (16:41 +0100)
commit46f7487e161b195a1bd7ddbd9c6aba9c93ec881a
tree542d44f0ab0003a0cc3e785f6c75215d87886cf5
parent1e027960edfaa6a43f9ca31081729b716598112b
netfilter: nat: don't register device notifier twice

Otherwise, we get notifier list corruption.

This is the most simple fix: remove the device notifier call chain
from the ipv6 masquerade register function and handle it only
in the ipv4 version.

The better fix is merge
nf_nat_masquerade_ipv4/6_(un)register_notifier
  into a single
nf_nat_masquerade_(un)register_notifiers

but to do this its needed to first merge the two masquerade modules
into a single xt_MASQUERADE.

Furthermore, we need to use different refcounts for ipv4/ipv6
until we can merge MASQUERADE.

Fixes: d1aca8ab3104a ("netfilter: nat: merge ipv4 and ipv6 masquerade functionality")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_masquerade.c