Skip to contentSkip to conversation

ipv6: udp: Use ip6_sk_redirect() for tunnel sockets

PATCH Applied Ido Schimmel 3 participants 3 messages Sep 7 – Sep 8

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

PATCH 1/1 ipv6: udp: Use ip6_sk_redirect() for tunnel sockets

After commit cd51b74bdd0b ("ipv6: Fix redirect exception creation for UDP/RAW sockets") the two redirect calls are now equivalent and there is no need to specifically call ip6_redirect() for tunnel sockets. Simplify and call ip6_sk_redirect() for both tunnel sockets and regular sockets.

Note that for ICMPv6 Redirect Message packets the VRF driver does not reset skb->dev to the VRF device, so skb->dev->ifindex is equivalent to inet6_iif(skb), even when the packet was received from a VRF port.

---
 net/ipv6/udp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
net/ipv6/udp.c +1 -7
index 93478d1ad576..59f9872c3552 100644
@@ -751,13 +751,7 @@ static int udpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 			harderr = 1;
 	}
 	if (type == NDISC_REDIRECT) {
-		if (tunnel) {
-			ip6_redirect(skb, sock_net(sk), inet6_iif(skb),
-				     READ_ONCE(sk->sk_mark),
-				     sk_uid(sk));
-		} else {
-			ip6_sk_redirect(skb, sk);
-		}
+		ip6_sk_redirect(skb, sk);
 		goto out;
 	}
 
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ido Schimmel

After commit cd51b74bdd0b ("ipv6: Fix redirect exception creation for UDP/RAW sockets") the two redirect calls are now equivalent and there is no need to specifically call ip6_redirect() for tunnel sockets. Simplify and call ip6_sk_redirect() for both tunnel sockets and regular sockets.

Quoted 6 lines

Note that for ICMPv6 Redirect Message packets the VRF driver does not reset skb->dev to the VRF device, so skb->dev->ifindex is equivalent to inet6_iif(skb), even when the packet was received from a VRF port.

Great, thanks.

#2 lore raw
In reply to Ido Schimmel
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Mon, 7 Sep 2026 13:13:58 +0300 you wrote:

After commit cd51b74bdd0b ("ipv6: Fix redirect exception creation for UDP/RAW sockets") the two redirect calls are now equivalent and there is no need to specifically call ip6_redirect() for tunnel sockets. Simplify and call ip6_sk_redirect() for both tunnel sockets and regular sockets.

Note that for ICMPv6 Redirect Message packets the VRF driver does not reset skb->dev to the VRF device, so skb->dev->ifindex is equivalent to inet6_iif(skb), even when the packet was received from a VRF port.

[...]

Here is the summary with links:
- [net-next] ipv6: udp: Use ip6_sk_redirect() for tunnel sockets

    https://git.kernel.org/netdev/net-next/c/4596be8a15db

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html