Skip to content

Commit

Permalink
net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()
Browse files Browse the repository at this point in the history
This is to match ipv4 behaviour, see __ip_sock_set_tos()
implementation.

Technically for ipv6 this might not be required because normally we
do not allow tclass to influence routing, yet the cli tooling does
support it:

lpk11:~# ip -6 rule add pref 5 tos 45 lookup 5
lpk11:~# ip -6 rule
5:      from all tos 0x45 lookup 5

and in general dscp/tclass based routing does make sense.

We already have cases where dscp can affect vlan priority and/or
transmit queue (especially on wifi).

So let's just make things match.  Easier to reason about and no harm.

Cc: Eric Dumazet <[email protected]>
Cc: Neal Cardwell <[email protected]>
Signed-off-by: Maciej Żenczykowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
zenczykowski authored and kuba-moo committed Nov 25, 2021
1 parent 9f7b3a6 commit 305e95b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
val &= ~INET_ECN_MASK;
val |= np->tclass & INET_ECN_MASK;
}
np->tclass = val;
if (np->tclass != val) {
np->tclass = val;
sk_dst_reset(sk);
}
retv = 0;
break;

Expand Down

0 comments on commit 305e95b

Please sign in to comment.