Commit 95caf6f7 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller

geneve: fix populating tclass in geneve_get_v6_dst

The struct flowi6's flowi6_tos is not used in IPv6 route lookup, the
traffic class information is handled in the flowi6's flowlabel member
instead. For example, for policy routing, fib6_rule_match() uses
ip6_tclass() that is applied on the flowlabel for matching on tclass,
which would currently not work as expected.

Fixes: 3a56f86f ("geneve: handle ipv6 priority like ipv4 tos")
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaa93bf4
...@@ -843,8 +843,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, ...@@ -843,8 +843,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
if (info) { if (info) {
fl6->daddr = info->key.u.ipv6.dst; fl6->daddr = info->key.u.ipv6.dst;
fl6->saddr = info->key.u.ipv6.src; fl6->saddr = info->key.u.ipv6.src;
fl6->flowi6_tos = RT_TOS(info->key.tos); fl6->flowlabel = ip6_make_flowinfo(RT_TOS(info->key.tos),
fl6->flowlabel = info->key.label; info->key.label);
dst_cache = &info->dst_cache; dst_cache = &info->dst_cache;
} else { } else {
prio = geneve->tos; prio = geneve->tos;
...@@ -855,8 +855,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, ...@@ -855,8 +855,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
use_cache = false; use_cache = false;
} }
fl6->flowi6_tos = RT_TOS(prio); fl6->flowlabel = ip6_make_flowinfo(RT_TOS(prio),
fl6->flowlabel = geneve->label; geneve->label);
fl6->daddr = geneve->remote.sin6.sin6_addr; fl6->daddr = geneve->remote.sin6.sin6_addr;
dst_cache = &geneve->dst_cache; dst_cache = &geneve->dst_cache;
} }
...@@ -1049,7 +1049,8 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, ...@@ -1049,7 +1049,8 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
if (unlikely(err)) if (unlikely(err))
goto err; goto err;
prio = ip_tunnel_ecn_encap(fl6.flowi6_tos, iip, skb); prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel),
iip, skb);
ttl = geneve->ttl; ttl = geneve->ttl;
if (!ttl && ipv6_addr_is_multicast(&fl6.daddr)) if (!ttl && ipv6_addr_is_multicast(&fl6.daddr))
ttl = 1; ttl = 1;
......
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