diff options
author | Andrew Collins <bsderandrew@gmail.com> | 2012-12-12 09:23:49 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-12-16 17:28:30 -0500 |
commit | c65ef8dc7b1c16379b9fc29e925716a10804af43 (patch) | |
tree | 52c8c66e995ea0c8e115a137163be2090561dd3c /net/ipv6 | |
parent | c6f408996c625cb950cad024f90e50519f94713c (diff) |
netfilter: nf_nat: Also handle non-ESTABLISHED routing changes in MASQUERADE
Since (a0ecb85 netfilter: nf_nat: Handle routing changes in MASQUERADE
target), the MASQUERADE target handles routing changes which affect
the output interface of a connection, but only for ESTABLISHED
connections. It is also possible for NEW connections which
already have a conntrack entry to be affected by routing changes.
This adds a check to drop entries in the NEW+conntrack state
when the oif has changed.
Signed-off-by: Andrew Collins <bsderandrew@gmail.com>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter/ip6table_nat.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c index 6c8ae24b85eb..e0e788d25b14 100644 --- a/net/ipv6/netfilter/ip6table_nat.c +++ b/net/ipv6/netfilter/ip6table_nat.c | |||
@@ -127,23 +127,28 @@ nf_nat_ipv6_fn(unsigned int hooknum, | |||
127 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); | 127 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); |
128 | if (ret != NF_ACCEPT) | 128 | if (ret != NF_ACCEPT) |
129 | return ret; | 129 | return ret; |
130 | } else | 130 | } else { |
131 | pr_debug("Already setup manip %s for ct %p\n", | 131 | pr_debug("Already setup manip %s for ct %p\n", |
132 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", | 132 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", |
133 | ct); | 133 | ct); |
134 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) | ||
135 | goto oif_changed; | ||
136 | } | ||
134 | break; | 137 | break; |
135 | 138 | ||
136 | default: | 139 | default: |
137 | /* ESTABLISHED */ | 140 | /* ESTABLISHED */ |
138 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || | 141 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || |
139 | ctinfo == IP_CT_ESTABLISHED_REPLY); | 142 | ctinfo == IP_CT_ESTABLISHED_REPLY); |
140 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { | 143 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) |
141 | nf_ct_kill_acct(ct, ctinfo, skb); | 144 | goto oif_changed; |
142 | return NF_DROP; | ||
143 | } | ||
144 | } | 145 | } |
145 | 146 | ||
146 | return nf_nat_packet(ct, ctinfo, hooknum, skb); | 147 | return nf_nat_packet(ct, ctinfo, hooknum, skb); |
148 | |||
149 | oif_changed: | ||
150 | nf_ct_kill_acct(ct, ctinfo, skb); | ||
151 | return NF_DROP; | ||
147 | } | 152 | } |
148 | 153 | ||
149 | static unsigned int | 154 | static unsigned int |