2017-09-07 06:08:53

by Haishuang Yan

[permalink] [raw]
Subject: [PATCH 1/2] ip_tunnel: fix setting ttl and tos value in collect_md mode

ttl and tos variables are declared and assigned, but are not used in
iptunnel_xmit() function.

Fixes: cfc7381b3002 ("ip_tunnel: add collect_md mode to IPIP tunnel")
Cc: Alexei Starovoitov <[email protected]>
Signed-off-by: Haishuang Yan <[email protected]>
---
net/ipv4/ip_tunnel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 129d1a3..e1856bf 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -618,8 +618,8 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, u8 proto)
ip_rt_put(rt);
goto tx_dropped;
}
- iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, proto, key->tos,
- key->ttl, df, !net_eq(tunnel->net, dev_net(dev)));
+ iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, proto, tos, ttl,
+ df, !net_eq(tunnel->net, dev_net(dev)));
return;
tx_error:
dev->stats.tx_errors++;
--
1.8.3.1




2017-09-07 06:08:59

by Haishuang Yan

[permalink] [raw]
Subject: [PATCH 2/2] ip6_tunnel: fix setting hop_limit value for ipv6 tunnel

Similar to vxlan/geneve tunnel, if hop_limit is zero, it should fall
back to ip6_dst_hoplimt().

Signed-off-by: Haishuang Yan <[email protected]>
---
net/ipv6/ip6_tunnel.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 3a0ba2a..10a693a 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1184,6 +1184,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
init_tel_txopt(&opt, encap_limit);
ipv6_push_frag_opts(skb, &opt.ops, &proto);
}
+ hop_limit = hop_limit ? : ip6_dst_hoplimit(dst);

/* Calculate max headroom for all the headers and adjust
* needed_headroom if necessary.
--
1.8.3.1



2017-09-09 01:55:10

by Alexei Starovoitov

[permalink] [raw]
Subject: Re: [PATCH 1/2] ip_tunnel: fix setting ttl and tos value in collect_md mode

On 9/6/17 11:08 PM, Haishuang Yan wrote:
> ttl and tos variables are declared and assigned, but are not used in
> iptunnel_xmit() function.
>
> Fixes: cfc7381b3002 ("ip_tunnel: add collect_md mode to IPIP tunnel")
> Cc: Alexei Starovoitov <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>
> ---
> net/ipv4/ip_tunnel.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index 129d1a3..e1856bf 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -618,8 +618,8 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, u8 proto)
> ip_rt_put(rt);
> goto tx_dropped;
> }
> - iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, proto, key->tos,
> - key->ttl, df, !net_eq(tunnel->net, dev_net(dev)));
> + iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, proto, tos, ttl,
> + df, !net_eq(tunnel->net, dev_net(dev)));

indeed. good catch. thanks
Acked-by: Alexei Starovoitov <[email protected]>

2017-09-09 03:47:59

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 1/2] ip_tunnel: fix setting ttl and tos value in collect_md mode

From: Haishuang Yan <[email protected]>
Date: Thu, 7 Sep 2017 14:08:34 +0800

> ttl and tos variables are declared and assigned, but are not used in
> iptunnel_xmit() function.
>
> Fixes: cfc7381b3002 ("ip_tunnel: add collect_md mode to IPIP tunnel")
> Cc: Alexei Starovoitov <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>

Applied.

2017-09-09 03:48:09

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2] ip6_tunnel: fix setting hop_limit value for ipv6 tunnel

From: Haishuang Yan <[email protected]>
Date: Thu, 7 Sep 2017 14:08:35 +0800

> Similar to vxlan/geneve tunnel, if hop_limit is zero, it should fall
> back to ip6_dst_hoplimt().
>
> Signed-off-by: Haishuang Yan <[email protected]>

Applied.