Article View: linux.kernel.netdev
Article #18755Re: [PATCH v1 net 2/8] tcp: Don't use inner IP TTL for IP_MINTTL in tcp_v4_err().
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 20:36
Date: Wed, 18 Nov 2026 20:36
104 lines
11700 bytes
11700 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In tcp_v4_err() (net/ipv4/tcp_ipv4.c), the IP_MINTTL check now
compares ip_hdr(skb)->ttl, the outer TTL, with min_ttl.
--
tcp: Don't use inner IP TTL for IP_MINTTL in tcp_v4_err().
This commit changes the IP_MINTTL check in tcp_v4_err(). The check now
compares min_ttl against the TTL of the outer IP header that carries the
ICMP error, instead of the TTL in the quoted inner IP header. This makes
IPv4 behave like tcp_v6_err(), which checks ipv6_hdr(skb)->hop_limit.
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 7d58f522068d6..bf8542368032f 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -546,7 +546,7 @@ int tcp_v4_err(struct sk_buff *skb, u32 info)
>
> if (static_branch_unlikely(&ip4_min_ttl)) {
> /* min_ttl can be changed concurrently from do_ip_setsockopt() */
> - if (unlikely(iph->ttl < READ_ONCE(inet_sk(sk)->min_ttl))) {
> + if (unlikely(ip_hdr(skb)->ttl < READ_ONCE(inet_sk(sk)->min_ttl))) {
> __NET_INC_STATS(net, LINUX_MIB_TCPMINTTLDROP);
> goto out;
> }
[Severity: Medium]
Will this drop ICMP errors that the host generates about its own TCP
packets on GTSM sockets?
__icmp_send() never sets a TTL, so __ip_make_skb() falls back to:
net/ipv4/ip_output.c:__ip_make_skb() {
...
else
ttl = ip_select_ttl(inet, &rt->dst);
...
}
The ICMP socket's uc_ttl is -1, so this gives the default hop limit,
normally sysctl_ip_default_ttl = 64. The error is delivered over
loopback without being decremented, so ip_hdr(skb)->ttl is 64 here.
A typical GTSM socket (IP_TTL 255, IP_MINTTL 254 or 255) now takes the
goto out path and counts TCPMINTTLDROP. Before this patch, the quoted
inner header was our own packet. It had not been forwarded, so it still
carried TTL 255 and passed the check.
One local source of these errors is ip_fragment(), for DF packets that
exceed the route MTU:
net/ipv4/ip_output.c:ip_fragment() {
...
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
htonl(mtu));
...
}
tnl_update_pmtu() and vti_xmit() send ICMP_FRAG_NEEDED locally through
icmp_ndo_send(). The link failure path sends ICMP_HOST_UNREACH.
tcp_v4_err() already expects these local errors:
/* If too many ICMPs get dropped on busy
* servers this needs to be solved differently.
* We do take care of PMTU discovery (RFC1191) special case :
* we can receive locally generated ICMP messages while socket is held.
*/
With this change, a GTSM socket no longer reaches the ICMP_FRAG_NEEDED
handling for a local PMTU drop. tcp_v4_mtu_reduced() is skipped, so
recovery waits for an RTO or for tcp_current_mss() to see the new dst
MTU.
Also, a connect() in TCP_SYN_SENT no longer fails fast with EHOSTUNREACH
on a local link failure. It runs the full SYN retry timeout instead.
The commit message says:
Now GTSM is applied to locally generated ICMP errors, but this
behaviour matches tcp_v6_err().
Could the commit message describe these effects on locally generated
PMTU and host unreachable errors? The Fixes: tag will bring this to
stable for all IPv4 GTSM users, such as BGP with ttl-security.
Would it make sense to exempt locally generated or loopback ICMP errors
from the outer TTL check? As far as I can tell, the final state of the
series keeps the outer TTL check without such an exemption.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117053543.84032-1-kuniyu%40google.com
Technical Details
Message-ID:
<179503418534.3136.4229241226669762008@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366442-linux-kernel-netdev=dewy.ruReferences:
<20261117053543.84032-3-kuniyu@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366442-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v1 net 2/8] tcp: Don't use inner IP TTL for IP_MINTTL in tcp_v4_err(). Date: Wed, 18 Nov 2026 20:36:25 +0000 Organization: Usenet Network Message-ID: <179503418534.3136.4229241226669762008@kernel.org> References: <20261117053543.84032-3-kuniyu@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2693045"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cz6+fvaId0FNEr7T+C0Z9d40Vc8= sha256:E8AYmka/02S0hdW9BXx7CxcrI8cEGIhiBEQPYcU3YMM= sha1:UwV2CD/Uxs3izYriIsDZhDXXKgs= sha256:crQhJIeTQdWbc/01bi4H77NCpmcZLJoy0OLb66m9DVs= 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 279B81153D0; Wed, 18 Nov 2026 23:37:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=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 1dsy-KriRclL; Wed, 18 Nov 2026 23:37:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-366442-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 47DBF1153D2; Wed, 18 Nov 2026 23:36:56 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 19D9A162DEE; Wed, 18 Nov 2026 20:36:38 +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=1795034187; b=skCJzRXDTqe21zETg9ie1UKb2Evgc5cnVRdrnenh/AFxDpDjlsBZk184RQBxreYLXPgC JZ0ID2FzR/ftFXlCzD5hn9qswYZ8itmi+0+MywimwHwcUF2hh4jU4HeF98cgl8OEGlcgF JfQdNrLUchIu/x9ZfoLDAxo+SF0ryd+r6mvepbt9YHmVmf56CIwFqPbu6gKnSA20nJA0g /XEoYZHYt/d0DulGzpahb6QnVqjenB/eqqFIi6t2UsTpslUMPISoCLyzyQS8/IUmodE7P IiW1rPQ9wkP8QnwmqHL1MNF4SPMPmG8aoEact+whSMsc4WSnuIgIP46iR73x+/F1t5w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795034187; 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=5ttzqnxg3j9wuCJ7xQ3VLsZ16lJ4ll5MXRevgEjfgig=; b=jHzj2VSgBE/YzXFDQd8dutsFR0oviRN7sg9VBsDdizelgzPMZSUC2aYuskPM9tEjiCqT aQ76MOogEGizWQ36Vhs0WhSPBmCzOx/toTUKIdcKMJCUR85jtT8KuY/uiuRJ2PGZkgKVO ghUTAkQr7sG1wxz1MPbqpRybM7xFg7SIx/VuEl5H+hycVeM7/zTaowtiO2DFuuB/Hl6FB FABjcoLlqVPKV3afX4I41KIOG+INqa4ZQegCu0w7I5YbURvEw82djY8bzPPvhofs9XOF8 I8BTGnPyQlZHat91WIVosYC/IVD1DX2jYNapUJEed045GQ967YJJXE+NtSqDhdPLX1g== 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=h2frRZm7; 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 9645A60A2614; Wed, 18 Nov 2026 20:36:27 +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=h2frRZm7 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=1795034186; b=OIFm6GCe8NCSbEhrfB3928qtXfiM1IiuZO15XMK2ov4adRdgy9Gcc8DMURPdfQlcS2Wg ias8fwLfoHtZp2PwyFfl/gbPYbaaeVwVIqJMGbd+M519UaVUa6OaxC51JruXDL0asVcP7 c1jjUUfdL2kWJmyo7Z1xKzknasnp/FiAcV5V3yCFuP7AktfuPuZ0dze5dyosuquyfp581 45xoyIOoSCcyOJSf21f61CMY16WjQwvvIw0X5Mh6wE5UJFgQldAfv0SZ2dMKEEousUr+e 7dDOi8tZyHdtEIc/JoItJdl9glMMQW1Zsj7LH5t1a/RpnInEOTKIiuMIg6WzgnsjKcw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795034186; 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=5ttzqnxg3j9wuCJ7xQ3VLsZ16lJ4ll5MXRevgEjfgig=; b=sn7QYjoaF18zWkBeKaP8n0+q4vBlISb/m4W87Z5hCL1KMTZmTASJujhCpxvSamnuksSl YpJQ9dgE+DMiKhVcPOELPklflTHwn+UjuxRf0DxJbyDnuwtcy9XqvWCJkVbfetzIo3klh v/B1o+78los7ZX+i0dEtN5UlP7TTIkqN3v4lolZcmns36bkVXKptYF5Rd73ZZ+hcv9xwa 8bc8CZkOLqtJNQnkcjFGZ7OWfZbozlWAZK1yoAaRt3xESUwQhNxv2zvy37djJbSZeXq/h RU5wa0/JTbEl4J9oVUYMJgN5fgl8TaEqG4zh17cYzUtLNRmOc+LbgDv7usw2o3TncIg== 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=h2frRZm7; 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 B4866606A32A for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 20:36:26 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C11A11F000C6; Wed, 18 Nov 2026 20:36:25 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795034186; bh=5ttzqnxg3j9wuCJ7xQ3VLsZ16lJ4ll5MXRevgEjfgig=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=h2frRZm741AzQSMhNUCQqKbXTXRjJPNMemuWVSt/Hcg7clj0S/dkUSRLv8n2dtmVa 4oqU9dRToBbBmSwDJhxqspKGESYAGAKXcZ5M1Y76fHC08EVeQF3NJ3q19JFMi82IDE d6v4fYFAJp5vrpAeDJ0wvhajakpmqOkuYmfrTqni+3492+dcSA1sq3bOly8lL+ttP2 vV1FHkLSNQXs9WI1FeHmZqZXstljtg55LcuoQsb94Kwk+LKGjqtseFg5LEcSEJSpF0 eB1asT4EqVeAAitxxhoUj3nTDg/EQinEy2yF/qkAdIMwQTe6Hs8E2ZWOQFSdh28H7K OQBkerlb3ez2w== 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-3-kuniyu@google.com> X-sashiko-severity: Medium 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