diff options
author | Florian Westphal <fw@strlen.de> | 2017-04-20 10:11:33 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-04-26 09:30:22 +0200 |
commit | ff459018d7cb13e43ee2f857949c26b235ccd9a5 (patch) | |
tree | 0b27e138957dea7f0f0a7c3a1a3b146ce34c5695 /net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | |
parent | 22d4536d2c836f74421d01d534b3117223a822a0 (diff) | |
download | op-kernel-dev-ff459018d7cb13e43ee2f857949c26b235ccd9a5.zip op-kernel-dev-ff459018d7cb13e43ee2f857949c26b235ccd9a5.tar.gz |
netfilter: masquerade: attach nat extension if not present
Currently the nat extension is always attached as soon as nat module is
loaded. However, most NAT uses do not need the nat extension anymore.
Prepare to remove the add-nat-by-default by making those places that need
it attach it if its not present yet.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/nf_nat_masquerade_ipv4.c')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c index ea91058..dc1dea1 100644 --- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c @@ -37,7 +37,6 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING); ct = nf_ct_get(skb, &ctinfo); - nat = nfct_nat(ct); NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || ctinfo == IP_CT_RELATED_REPLY)); @@ -56,7 +55,9 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, return NF_DROP; } - nat->masq_index = out->ifindex; + nat = nf_ct_nat_ext_add(ct); + if (nat) + nat->masq_index = out->ifindex; /* Transfer from original range. */ memset(&newrange.min_addr, 0, sizeof(newrange.min_addr)); |