Skip to content

Commit 95caf6f

Browse files
borkmanndavem330
authored andcommitted
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: 3a56f86 ("geneve: handle ipv6 priority like ipv4 tos") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent eaa93bf commit 95caf6f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/geneve.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
843843
if (info) {
844844
fl6->daddr = info->key.u.ipv6.dst;
845845
fl6->saddr = info->key.u.ipv6.src;
846-
fl6->flowi6_tos = RT_TOS(info->key.tos);
847-
fl6->flowlabel = info->key.label;
846+
fl6->flowlabel = ip6_make_flowinfo(RT_TOS(info->key.tos),
847+
info->key.label);
848848
dst_cache = &info->dst_cache;
849849
} else {
850850
prio = geneve->tos;
@@ -855,8 +855,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
855855
use_cache = false;
856856
}
857857

858-
fl6->flowi6_tos = RT_TOS(prio);
859-
fl6->flowlabel = geneve->label;
858+
fl6->flowlabel = ip6_make_flowinfo(RT_TOS(prio),
859+
geneve->label);
860860
fl6->daddr = geneve->remote.sin6.sin6_addr;
861861
dst_cache = &geneve->dst_cache;
862862
}
@@ -1049,7 +1049,8 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
10491049
if (unlikely(err))
10501050
goto err;
10511051

1052-
prio = ip_tunnel_ecn_encap(fl6.flowi6_tos, iip, skb);
1052+
prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel),
1053+
iip, skb);
10531054
ttl = geneve->ttl;
10541055
if (!ttl && ipv6_addr_is_multicast(&fl6.daddr))
10551056
ttl = 1;

0 commit comments

Comments
 (0)