๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18756

Re: [PATCH v1 net 7/8] tcp: Pass inet_sdif() to __inet_lookup_established() in tcp_v4_err().

#18756
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 20:36
70 lines
10288 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message for "tcp: Pass inet_sdif() to
  __inet_lookup_established() in tcp_v4_err()." only describes half ofโ€ฆ

--

tcp: Pass inet_sdif() to __inet_lookup_established() in tcp_v4_err().

This commit changes tcp_v4_err() to pass inet_sdif(skb) instead of 0 as
the sdif argument to __inet_lookup_established(). The goal is to stop
ICMP errors that arrive through a VRF from reaching sockets that are not
bound to the device.

> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index bc909fedda3a8..35a1309f8b21c 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -504,7 +504,8 @@ int tcp_v4_err(struct sk_buff *skb, u32 info)
>  	int err;
>  
>  	sk = __inet_lookup_established(net, iph->daddr, th->dest, iph->saddr,
> -				       ntohs(th->source), inet_iif(skb), 0);
> +				       ntohs(th->source), inet_iif(skb),
> +				       inet_sdif(skb));

[Severity: Low]
The code change looks correct to me. It now uses the same dif/sdif pair
that tcp_v4_rcv() already uses. However, the commit message only covers
half of the behavior change:

  So, ICMP error coming from VRF can be leaked to a socket not
  bound to the device.

Should the commit message also say what changes for sockets bound to the
VRF slave device?

For a packet received through a VRF, inet_iif(skb) returns the VRF master
ifindex. inet_sdif(skb) returns IPCB(skb)->iif, which is the slave
ifindex. The match is done here:

include/net/inet_sock.h:inet_bound_dev_eq() {
	if (!bound_dev_if)
		return !sdif || l3mdev_accept;
	return bound_dev_if == dif || bound_dev_if == sdif;
}

With the old sdif of 0, a socket whose sk_bound_dev_if is the slave
ifindex never matched in tcp_v4_err(). Such sockets got no ICMP errors at
all, which could leave them in a PMTU black hole.

After this patch those sockets do match. They will now see:

  ICMP_DEST_UNREACH / ICMP_FRAG_NEEDED -> tcp_v4_mtu_reduced()
  hard errors in TCP_SYN_SENT / TCP_SYN_RECV -> tcp_done_with_error()

Users can see this change. Would it help stable backporters and
maintainers to mention it in the changelog?

>  	if (!sk) {
>  		__ICMP_INC_STATS(net, ICMP_MIB_INERRORS);
>  		return -ENOENT;

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117053543.84032-1-kuniyu%40google.com
Technical Details
Message-ID: <179503418850.3136.10740335529901076189@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366445-linux-kernel-netdev=dewy.ru
References: <20261117053543.84032-8-kuniyu@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366445-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v1 net 7/8] tcp: Pass inet_sdif() to
 __inet_lookup_established() in tcp_v4_err().
Date: Wed, 18 Nov 2026 20:36:28 +0000
Organization: Usenet Network
Message-ID: <179503418850.3136.10740335529901076189@kernel.org>
References: <20261117053543.84032-8-kuniyu@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2693245"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:odZF/6STb0gMvXSbCbctkm0ZP/0= sha256:rVIktx8mfx2lhZ2SLUaL03/Bw+mhv6AlxmE1PgB6kQk=
	sha1:po/hMacYLBsDTHOt8Oo0N5Xw/lg= sha256:8tv6Iqs9m+GLV8/19VoMH+fPeYh/yaRBDWVeJFb+Ah4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 687AE1153D3; Wed, 18 Nov 2026 23:37:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id KelmY4yg2Ewm;
	Wed, 18 Nov 2026 23:37:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366445-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id AC39A1153D0; Wed, 18 Nov 2026 23:37:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 4E36C6C14D1; Wed, 18 Nov 2026 20:37:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795034190;
	b=rDuN6oGV9gjxTAyK+86IK6GPy9M35p+zoasJ0i3D4OBVPdSqm+8gtkXhflRG6hrUvURm
	 l+NkK8BzCUIiCFVe6FIkeMD6Bda1cZ3Kkulzucg6YSuVHE/A84u+A8ayQNdqWXFVwKJjj
	 SelM6OSfl0Pf27XB6dSW0bMfj0gGvS9T53s9dlp10wE9JaliwY06YdOHuyKHG6oQzv7JQ
	 9Xhz4EpfBGTTdX7gEN60KyqSbqm6igzhcn0owhPIsMIFkaExe7ZGhfjH3FmyZGFqj7S4n
	 iHERTPsxi9EEalQRgCBDM3WEl98YcLrioqHMuE+koNdxDk/93dHmQTkV93XPpiN21iw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795034190;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=UZXKqByYvU6A+FNb9bAsYgap0pYnH7KHiqZ3vXYUXTw=;
	b=a9rjW3ggYc56L32VvcztnqA5pxpdGxv9gqSvI7IB82wAwhV/vOVNq9LJewxL0bIwgAR6
	 ZT3R5eXUc4ox48MpiSnx7jaMmBTegoRUGkdUY/jComiQuKvtNHbpEWSZVDrREu+UO3Te/
	 joYXyUpwfAKXr8hoBwgLzFMsOU8VoTQams4KWGjVHz0acJGe3FKgBMJJDdlour1DvPi2Z
	 9KKloqLi4UPFBjWZWm5o5kFyb3FcCUlVgt7NB2nd289W7i35yLn/XzA+tY2ChVshNYRip
	 5PJI3oaSBkBBJ4t6Ze4Z2h3MzLQ64Qo1AHCLjjF50aYwH3tZpBRXcSLqJUWEANmfuiw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Omnt+d6r;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 73C6560A382C;
	Wed, 18 Nov 2026 20:36:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Omnt+d6r
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795034189;
	b=J+ZS3tHuOk67XM7so35RvyTFk40nY1RyL0h8rde//66mD21SEi2iUgjdVZY34bXy5RDA
	 JN9dXUoXxisWpWrgDo4lThBpPwRyRxgo+hHj92erk/oRJFv0hXgvHpnTsYwCV6AOM0pP6
	 0BYz45xJTplH7jk8VKIhnVIfxI8ZWU/Uv8dHDrYLokWHzZp5Nfm+oDj8+GrJrfrxKC1X6
	 zVN3ZHQKgQMKyuNAUbl7pCEEQcjvuOaGL0ieAuXpaDqD9sguc0yYYyR8hCmFqJaoNNjdv
	 hSzeEzdd2oDmdCAnc90pTYsWul6EMd0kpYly5Yh68aXRfcAd61E7dU58u3z8e58MbEg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795034189;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=UZXKqByYvU6A+FNb9bAsYgap0pYnH7KHiqZ3vXYUXTw=;
	b=VNJtRIOiVsdRUAGDnxT7snN/ZH9mQqIu0oy3r3xsT6VFqFPspdMB8LnCh4v1KXZ7xtw6
	 1v5btzoYOGYsZKTRw+SneESlDpAzA62UllA9BZVr5ybMOkeLhiiGxqfmwq3cmBN8piQo4
	 g+j6RBZCgq4Ms3duUpwvX5hzYj3HOPZaSe+irY59oWzkJLXKVzcpAxP6RsOO4sB6lzvA4
	 ZYJXfCtfyZSK7PUCyent+uqHwGrfy62JztitVYXsdkTZdsIB2H3f7Dg+fslP204Gm50QJ
	 q8xi+55t3R3xnOty/mHRioEH1u30tgBa0Sq/t4/1L+tjdnTmznT+JAOf5uHZydDlJAg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Omnt+d6r;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9585C60A380B
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 20:36:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E20291F000D4;
	Wed, 18 Nov 2026 20:36:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795034189;
	bh=UZXKqByYvU6A+FNb9bAsYgap0pYnH7KHiqZ3vXYUXTw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Omnt+d6r+r4D4V5ovpDMzxyuvOH0oFAoj3YpRzxYRvxo1qVrW9xVyZrZl5Sn/THeN
	 C43bWoV8XJpGBdv3i8/upOl1+bcK9SNNmIbOtR2DM6w8gwbTb9aoNEOdrgUhdBlsqU
	 luAXtjydtUcfPnw2sDtGnIoXw2pvHnYwD4PQsvOoiHG1dLyn36tZ+n2ShHFSwXr8Bj
	 a1y13zgDA5fMaF7+yq/anOPn5jzJ4q1HU6GR6bdc5Z7HJHwQf1jMQPUBkoVHRmaR6N
	 EwVMmkxxNTGRP0gkW31Q+9tPDVnlP9769AegKNt46cpvik1Arx1/KBPRkeKUz3P8FL
	 8m2MOmWCni8aQ==
X-Cc: edumazet@kernel.org, ncardwell@google.com, davem@davemloft.net,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, kuni1840@gmail.com,
 netdev@vger.kernel.org
X-In-Reply-To: <20261117053543.84032-8-kuniyu@google.com>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list