Skip to contentSkip to conversation

net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()

PATCH Applied Maciej Żenczykowski 3 participants 4 messages Nov 23, 2021 – Nov 25, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()

From: Maciej Żenczykowski <[email protected]>

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.

---
 net/ipv6/ipv6_sockglue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv6/ipv6_sockglue.c +4 -1
index 204b0b4d10c8..3a66f2394b82 100644
@@ -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;
 
Signature · 1 line
2.34.0.rc2.393.gf8c9666880-goog
maintainer
#1 lore raw
Quoted 15 lines · On Tue, 23 Nov 2021 14:32:08 -0800 Maciej Żenczykowski wrote:

From: Maciej Żenczykowski <[email protected]>

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.

Quoted 8 lines

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.

Please send related patches as a series. There are dependencies here which prevent the build bot from doing its job (plus it's less work for me since I apply by series :)).

#3 lore raw
In reply to Maciej Żenczykowski
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 23 Nov 2021 14:32:08 -0800 you wrote:

From: Maciej Żenczykowski <[email protected]>

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:

[...]

Here is the summary with links:
- net-ipv6: changes to ->tclass (via IPV6_TCLASS) should sk_dst_reset()

    https://git.kernel.org/netdev/net-next/c/305e95bb893c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#2 lore raw
In reply to Jakub Kicinski
Quoted 22 lines · Jakub Kicinski
Quoted 20 lines · On Tue, 23 Nov 2021 14:32:08 -0800 Maciej Żenczykowski wrote:

From: Maciej Żenczykowski <[email protected]>

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.

Quoted 7 lines
Quoted 3 lines

Please send related patches as a series. There are dependencies here which prevent the build bot from doing its job (plus it's less work for me since I apply by series :)).

Ah, sorry, while the patches were stacked on each other, they're kind of orthogonal to each other,
and neither one actually depends on the other (outside of their being a conflict because of touching nearby code).
That's why I sent them out separately.

Additionally, I've also noticed that often the first patch out of two won't be merged if there's disagreement on the second, even though the first might be entirely acceptable.