]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
netfilter: nat: add dependencies on conntrack module
authorFlorian Westphal <fw@strlen.de>
Tue, 15 Nov 2016 20:36:41 +0000 (21:36 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 4 Dec 2016 20:16:51 +0000 (21:16 +0100)
commita357b3f80bc8d785ac7bdb99eb10ad0ba51275c9
treef24a617cd8568ad033559c65b3328f832858d82f
parentecb2421b5ddf48e6e116fced7f74c985bb546138
netfilter: nat: add dependencies on conntrack module

MASQUERADE, S/DNAT and REDIRECT already call functions that depend on the
conntrack module.

However, since the conntrack hooks are now registered in a lazy fashion
(i.e., only when needed) a symbol reference is not enough.

Thus, when something is added to a nat table, make sure that it will see
packets by calling nf_ct_netns_get() which will register the conntrack
hooks in the current netns.

An alternative would be to add these dependencies to the NAT table.

However, that has problems when using non-modular builds -- we might
register e.g. ipv6 conntrack before its initcall has run, leading to NULL
deref crashes since its per-netns storage has not yet been allocated.

Adding the dependency in the modules instead has the advantage that nat
table also does not register its hooks until rules are added.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/ipt_MASQUERADE.c
net/netfilter/xt_NETMAP.c
net/netfilter/xt_REDIRECT.c
net/netfilter/xt_nat.c