[PATCH] iptables: ip6t_MASQUERADE: add dependency on conntrack module

Subsystems: networking [general], the rest

STALE3226d

3 messages, 2 authors, 2017-12-15 · open the first message on its own page

[PATCH] iptables: ip6t_MASQUERADE: add dependency on conntrack module

From: Konstantin Khlebnikov <hidden>
Date: 2017-12-11 15:26:42

After commit 4d3a57f23dec ("netfilter: conntrack: do not enable connection
tracking unless needed") conntrack is disabled by default unless some
module explicitly declares dependency in particular network namespace.

Signed-off-by: Konstantin Khlebnikov <redacted>
Fixes: a357b3f80bc8 ("netfilter: nat: add dependencies on conntrack module")
---
 net/ipv6/netfilter/ip6t_MASQUERADE.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/netfilter/ip6t_MASQUERADE.c b/net/ipv6/netfilter/ip6t_MASQUERADE.c
index 2b1a15846f9a..92c0047e7e33 100644
--- a/net/ipv6/netfilter/ip6t_MASQUERADE.c
+++ b/net/ipv6/netfilter/ip6t_MASQUERADE.c
@@ -33,13 +33,19 @@ static int masquerade_tg6_checkentry(const struct xt_tgchk_param *par)
 
 	if (range->flags & NF_NAT_RANGE_MAP_IPS)
 		return -EINVAL;
-	return 0;
+	return nf_ct_netns_get(par->net, par->family);
+}
+
+static void masquerade_tg6_destroy(const struct xt_tgdtor_param *par)
+{
+	nf_ct_netns_put(par->net, par->family);
 }
 
 static struct xt_target masquerade_tg6_reg __read_mostly = {
 	.name		= "MASQUERADE",
 	.family		= NFPROTO_IPV6,
 	.checkentry	= masquerade_tg6_checkentry,
+	.destroy	= masquerade_tg6_destroy,
 	.target		= masquerade_tg6,
 	.targetsize	= sizeof(struct nf_nat_range),
 	.table		= "nat",

Re: [PATCH] iptables: ip6t_MASQUERADE: add dependency on conntrack module

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: 2017-12-11 15:47:36

On Mon, Dec 11, 2017 at 06:19:33PM +0300, Konstantin Khlebnikov wrote:
After commit 4d3a57f23dec ("netfilter: conntrack: do not enable connection
tracking unless needed") conntrack is disabled by default unless some
module explicitly declares dependency in particular network namespace.
Applied, thanks.

Re: [PATCH] iptables: ip6t_MASQUERADE: add dependency on conntrack module

From: Konstantin Khlebnikov <hidden>
Date: 2017-12-15 09:45:22

On 11.12.2017 18:47, Pablo Neira Ayuso wrote:
On Mon, Dec 11, 2017 at 06:19:33PM +0300, Konstantin Khlebnikov wrote:
quoted
After commit 4d3a57f23dec ("netfilter: conntrack: do not enable connection
tracking unless needed") conntrack is disabled by default unless some
module explicitly declares dependency in particular network namespace.
Applied, thanks.
At least stable 4.14 needs this - without it IPv6 NAT simply doesn't work.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help