diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2013-09-26 03:00:31 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-09-27 10:18:23 -0400 |
commit | 7722e0d1c076d9610f00d79bde8af977157aa23b (patch) | |
tree | e87c1844c592a87c410f7a012e8f69b8627878a9 | |
parent | de1389b11686f436c81d696b5a33eec2bc975665 (diff) |
netfilter: xt_TCPMSS: lookup route from proper net namespace
Otherwise the pmtu will be incorrect.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | net/netfilter/xt_TCPMSS.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index 62776de8293c..e762de5ee89b 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c | |||
@@ -43,7 +43,8 @@ optlen(const u_int8_t *opt, unsigned int offset) | |||
43 | return opt[offset+1]; | 43 | return opt[offset+1]; |
44 | } | 44 | } |
45 | 45 | ||
46 | static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb, | 46 | static u_int32_t tcpmss_reverse_mtu(struct net *net, |
47 | const struct sk_buff *skb, | ||
47 | unsigned int family) | 48 | unsigned int family) |
48 | { | 49 | { |
49 | struct flowi fl; | 50 | struct flowi fl; |
@@ -64,7 +65,7 @@ static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb, | |||
64 | rcu_read_lock(); | 65 | rcu_read_lock(); |
65 | ai = nf_get_afinfo(family); | 66 | ai = nf_get_afinfo(family); |
66 | if (ai != NULL) | 67 | if (ai != NULL) |
67 | ai->route(&init_net, (struct dst_entry **)&rt, &fl, false); | 68 | ai->route(net, (struct dst_entry **)&rt, &fl, false); |
68 | rcu_read_unlock(); | 69 | rcu_read_unlock(); |
69 | 70 | ||
70 | if (rt != NULL) { | 71 | if (rt != NULL) { |
@@ -107,7 +108,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
107 | return -1; | 108 | return -1; |
108 | 109 | ||
109 | if (info->mss == XT_TCPMSS_CLAMP_PMTU) { | 110 | if (info->mss == XT_TCPMSS_CLAMP_PMTU) { |
110 | unsigned int in_mtu = tcpmss_reverse_mtu(skb, family); | 111 | struct net *net = dev_net(par->in ? par->in : par->out); |
112 | unsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family); | ||
111 | 113 | ||
112 | if (dst_mtu(skb_dst(skb)) <= minlen) { | 114 | if (dst_mtu(skb_dst(skb)) <= minlen) { |
113 | net_err_ratelimited("unknown or invalid path-MTU (%u)\n", | 115 | net_err_ratelimited("unknown or invalid path-MTU (%u)\n", |