From: Kuniyuki Iwashima <kuniyu@google.com>
To: Eric Dumazet <edumazet@kernel.org>
Cc: Neal Cardwell <ncardwell@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v1 net 8/8] tcp: Pass inet6_iif() to __inet6_lookup_established() in tcp_v6_err().
Date: Tue, 17 Nov 2026 23:56:56 +0000 [thread overview]
Message-ID: <avznBvTcz5FwPwca@google.com> (raw)
In-Reply-To: <CAL4WiioNcgo6sS1ULk6TG0dWeM01Xt8yE7vMg-53YT52gXXOfA@mail.gmail.com>
On Tue, 17 Nov 2026 10:03:39 +0100, Eric Dumazet wrote:
> 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 ?
Sure, will add tests in net-next.
The original repro was too hacky to use vrf (with python script
embeded in packetdrill or --ip_any and TCP_REPAIR), and I finally
used netfilter.
I'll see if there is a good test or a better way, or I'll add
CONFIG_NETFILTER_XXX etc to config.
Thanks !
prev parent reply other threads:[~2026-11-17 23:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 5:35 [PATCH v1 net 0/8] tcp: Misc fixes for tcp_v[46]_err() Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 1/8] tcp: Don't accept ICMP for SND.NXT in TCP_SYN_SENT Kuniyuki Iwashima
2026-11-17 8:35 ` Eric Dumazet
2026-11-17 23:30 ` Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 2/8] tcp: Don't use inner IP TTL for IP_MINTTL in tcp_v4_err() Kuniyuki Iwashima
2026-11-17 8:42 ` Eric Dumazet
2026-11-17 23:35 ` Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 3/8] tcp: Don't bypass GTSM check for reqsk Kuniyuki Iwashima
2026-11-17 8:45 ` Eric Dumazet
2026-11-17 23:42 ` Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 4/8] tcp: Fix reqsk abort condition on ICMP errors Kuniyuki Iwashima
2026-11-17 8:49 ` Eric Dumazet
2026-11-17 23:44 ` Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 5/8] tcp: Check ip_sk_accept_pmtu() in tcp_v4_err() Kuniyuki Iwashima
2026-11-17 8:54 ` Eric Dumazet
2026-11-17 5:35 ` [PATCH v1 net 6/8] selftest: net: packetdrill: Add ICMP and ICMPv6 tests Kuniyuki Iwashima
2026-11-17 8:58 ` Eric Dumazet
2026-11-17 23:45 ` Kuniyuki Iwashima
2026-11-17 5:35 ` [PATCH v1 net 7/8] tcp: Pass inet_sdif() to __inet_lookup_established() in tcp_v4_err() Kuniyuki Iwashima
2026-11-17 9:01 ` Eric Dumazet
2026-11-17 5:35 ` [PATCH v1 net 8/8] tcp: Pass inet6_iif() to __inet6_lookup_established() in tcp_v6_err() Kuniyuki Iwashima
2026-11-17 9:03 ` Eric Dumazet
2026-11-17 23:56 ` Kuniyuki Iwashima [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avznBvTcz5FwPwca@google.com \
--to=kuniyu@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox