Commit 7722e0d1 authored by Gao feng's avatar Gao feng Committed by Pablo Neira Ayuso

netfilter: xt_TCPMSS: lookup route from proper net namespace

Otherwise the pmtu will be incorrect.
Signed-off-by: default avatarGao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent de1389b1
...@@ -43,7 +43,8 @@ optlen(const u_int8_t *opt, unsigned int offset) ...@@ -43,7 +43,8 @@ optlen(const u_int8_t *opt, unsigned int offset)
return opt[offset+1]; return opt[offset+1];
} }
static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb, static u_int32_t tcpmss_reverse_mtu(struct net *net,
const struct sk_buff *skb,
unsigned int family) unsigned int family)
{ {
struct flowi fl; struct flowi fl;
...@@ -64,7 +65,7 @@ static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb, ...@@ -64,7 +65,7 @@ static u_int32_t tcpmss_reverse_mtu(const struct sk_buff *skb,
rcu_read_lock(); rcu_read_lock();
ai = nf_get_afinfo(family); ai = nf_get_afinfo(family);
if (ai != NULL) if (ai != NULL)
ai->route(&init_net, (struct dst_entry **)&rt, &fl, false); ai->route(net, (struct dst_entry **)&rt, &fl, false);
rcu_read_unlock(); rcu_read_unlock();
if (rt != NULL) { if (rt != NULL) {
...@@ -107,7 +108,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, ...@@ -107,7 +108,8 @@ tcpmss_mangle_packet(struct sk_buff *skb,
return -1; return -1;
if (info->mss == XT_TCPMSS_CLAMP_PMTU) { if (info->mss == XT_TCPMSS_CLAMP_PMTU) {
unsigned int in_mtu = tcpmss_reverse_mtu(skb, family); struct net *net = dev_net(par->in ? par->in : par->out);
unsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);
if (dst_mtu(skb_dst(skb)) <= minlen) { if (dst_mtu(skb_dst(skb)) <= minlen) {
net_err_ratelimited("unknown or invalid path-MTU (%u)\n", net_err_ratelimited("unknown or invalid path-MTU (%u)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment