Commit 996237d9 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'do-not-use-rt_tos-for-ipv6-flowlabel'

Matthias May says:

====================
Do not use RT_TOS for IPv6 flowlabel

According to Guillaume Nault RT_TOS should never be used for IPv6.

Quote:
RT_TOS() is an old macro used to interprete IPv4 TOS as described in
the obsolete RFC 1349. It's conceptually wrong to use it even in IPv4
code, although, given the current state of the code, most of the
existing calls have no consequence.

But using RT_TOS() in IPv6 code is always a bug: IPv6 never had a "TOS"
field to be interpreted the RFC 1349 way. There's no historical
compatibility to worry about.
====================

Link: https://lore.kernel.org/r/20220805191906.9323-1-matthias.may@westermo.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents b4ab94d6 ab7e2e0d
...@@ -506,7 +506,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, ...@@ -506,7 +506,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
int err; int err;
attr.ttl = tun_key->ttl; attr.ttl = tun_key->ttl;
attr.fl.fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key->label); attr.fl.fl6.flowlabel = ip6_make_flowinfo(tun_key->tos, tun_key->label);
attr.fl.fl6.daddr = tun_key->u.ipv6.dst; attr.fl.fl6.daddr = tun_key->u.ipv6.dst;
attr.fl.fl6.saddr = tun_key->u.ipv6.src; attr.fl.fl6.saddr = tun_key->u.ipv6.src;
...@@ -620,7 +620,7 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv, ...@@ -620,7 +620,7 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
attr.ttl = tun_key->ttl; attr.ttl = tun_key->ttl;
attr.fl.fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tun_key->tos), tun_key->label); attr.fl.fl6.flowlabel = ip6_make_flowinfo(tun_key->tos, tun_key->label);
attr.fl.fl6.daddr = tun_key->u.ipv6.dst; attr.fl.fl6.daddr = tun_key->u.ipv6.dst;
attr.fl.fl6.saddr = tun_key->u.ipv6.src; attr.fl.fl6.saddr = tun_key->u.ipv6.src;
......
...@@ -879,8 +879,7 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, ...@@ -879,8 +879,7 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
use_cache = false; use_cache = false;
} }
fl6->flowlabel = ip6_make_flowinfo(RT_TOS(prio), fl6->flowlabel = ip6_make_flowinfo(prio, info->key.label);
info->key.label);
dst_cache = (struct dst_cache *)&info->dst_cache; dst_cache = (struct dst_cache *)&info->dst_cache;
if (use_cache) { if (use_cache) {
dst = dst_cache_get_ip6(dst_cache, &fl6->saddr); dst = dst_cache_get_ip6(dst_cache, &fl6->saddr);
......
...@@ -2321,7 +2321,7 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, ...@@ -2321,7 +2321,7 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
fl6.flowi6_oif = oif; fl6.flowi6_oif = oif;
fl6.daddr = *daddr; fl6.daddr = *daddr;
fl6.saddr = *saddr; fl6.saddr = *saddr;
fl6.flowlabel = ip6_make_flowinfo(RT_TOS(tos), label); fl6.flowlabel = ip6_make_flowinfo(tos, label);
fl6.flowi6_mark = skb->mark; fl6.flowi6_mark = skb->mark;
fl6.flowi6_proto = IPPROTO_UDP; fl6.flowi6_proto = IPPROTO_UDP;
fl6.fl6_dport = dport; fl6.fl6_dport = dport;
......
...@@ -1311,8 +1311,7 @@ struct dst_entry *ip6_dst_lookup_tunnel(struct sk_buff *skb, ...@@ -1311,8 +1311,7 @@ struct dst_entry *ip6_dst_lookup_tunnel(struct sk_buff *skb,
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;
prio = info->key.tos; prio = info->key.tos;
fl6.flowlabel = ip6_make_flowinfo(RT_TOS(prio), fl6.flowlabel = ip6_make_flowinfo(prio, info->key.label);
info->key.label);
dst = ipv6_stub->ipv6_dst_lookup_flow(net, sock->sk, &fl6, dst = ipv6_stub->ipv6_dst_lookup_flow(net, sock->sk, &fl6,
NULL); NULL);
......
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