๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Eric Dumazet Tue, 17 Nov 2026 09:03
Re: [PATCH v1 net 8/8] tcp: Pass inet6_iif() to __inet6_lookup_established() in tcp_v6_err().
#17717
Author: Eric Dumazet
Date: Tue, 17 Nov 2026 09:03
42 lines
10401 bytes
Le mar. 17 nov. 2026 ร  06:35, Kuniyuki Iwashima <kuniyu@google.com> a รฉcrit :
>
> tcp_v6_err() passes skb->dev->ifindex to __inet6_lookup_established().
>
> When ICMP is sent to a local address not on loopback device,
> ip6_rt_get_dev_rcu() sets dst->dev to lo and ip6_rt_copy_init()
> sets rt6i_idev to the actual device.
>
> In ip6_rcv_core(), skb->dev is still lo, but IP6CB(skb)->iif
> is set to ip6_dst_idev(skb_dst(skb))->dev->ifindex.
>
> So skb->dev->ifindex is 1 while inet6_iif(skb) points to the
> actual device.
>
> Since tcp_v6_err() passes the wrong ifindex, such an ICMP error
> is not delivered.
>
> For example, this script creates a socket bound to tun0 and
> generates ICMPv6 Port Unreachable to it, but the socket cannot
> receive it and getsockopt() fails:
>
>   --ip_version=ipv6
>    0 `ip link set lo up`
>   +0 `ip6tables -A OUTPUT -p tcp -j REJECT`
>   +0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3
>   +0 setsockopt(3, SOL_SOCKET, SO_BINDTODEVICE, "tun0", 4) = 0
>   +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
>   +0 getsockopt(3, SOL_SOCKET, SO_ERROR, [ECONNREFUSED], [4]) = 0
>
> Let's pass inet6_iif() to __inet6_lookup_established().
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>

Reviewed-by: Eric Dumazet <edumazet@kernel.org>

I wonder if you could send (maybe later in net-next) packetdrill tests
for 7 and 8 ?

Thanks.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads