From: Maciej Żenczykowski Date: Tue, 23 Nov 2021 22:32:08 +0000 (-0800) Subject: net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=305e95bb893cc50f7c59edf2b47d95effe73498a;p=linux.git net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset() 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 Cc: Neal Cardwell Signed-off-by: Maciej Żenczykowski Link: https://lore.kernel.org/r/20211123223208.1117871-1-zenczykowski@gmail.com Signed-off-by: Jakub Kicinski --- diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 8970b1a452570..a733803a710cf 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -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;