]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vxlan: fix tos value before xmit
authorHangbin Liu <liuhangbin@gmail.com>
Thu, 2 Jan 2020 09:23:45 +0000 (17:23 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jan 2020 00:35:48 +0000 (16:35 -0800)
Before ip_tunnel_ecn_encap() and udp_tunnel_xmit_skb() we should filter
tos value by RT_TOS() instead of using config tos directly.

vxlan_get_route() would filter the tos to fl4.flowi4_tos but we didn't
return it back, as geneve_get_v4_rt() did. So we have to use RT_TOS()
directly in function ip_tunnel_ecn_encap().

Fixes: 522b72544f99 ("VXLAN: Use IP Tunnels tunnel ENC encap API")
Fixes: cbd781486edd ("vxlan: allow setting ipv6 traffic class")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c

index 3ec6b506033d8565812991f796e3ef768a969dd5..1c5159dcc72024864000b8788a012b9907cf4204 100644 (file)
@@ -2541,7 +2541,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
                ndst = &rt->dst;
                skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM);
 
-               tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
+               tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
                ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
                err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr),
                                      vni, md, flags, udp_sum);
@@ -2581,7 +2581,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 
                skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM);
 
-               tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
+               tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb);
                ttl = ttl ? : ip6_dst_hoplimit(ndst);
                skb_scrub_packet(skb, xnet);
                err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),