🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14041

[PATCH net-next v4 3/4] selftests/net: packetdrill: add TCP black hole detection tests

#14041
From: Yongjian Wang via B4 Relay
Date: Tue, 10 Nov 2026 16:45
113 lines
14549 bytes
From: Yongjian Wang <echoowall@gmail.com>

Black hole detection (net.ipv4.tcp_mtu_probing=1) has no selftest
coverage.

Add a test that only sets tcp_mtu_probing=1 on top of the default
settings. A full-sized segment keeps timing out without any ICMP
feedback. Check that the MSS drops to tcp_base_mss once tcp_retries1
is exceeded, and that the smaller MSS is also used for new data after
the retransmission is acknowledged.

Add a shorter variant with tcp_retries1=1 and TLP disabled, so that
every retransmission comes from the RTO timer, which is what
tcp_write_timeout() counts.

Signed-off-by: Yongjian Wang <echoowall@gmail.com>
---
 .../net/packetdrill/tcp_mtu_probing_blackhole.pkt  | 38 ++++++++++++++++++++++
 ..._mtu_probing_blackhole_no_tlp_retries1_is_1.pkt | 38 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt
new file mode 100644
index 000000000000..95309cb4d872
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole.pkt
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+// Test black hole detection with default settings and tcp_mtu_probing=1: when
+// full-sized segments keep timing out and no ICMP arrives, TCP falls back to
+// tcp_base_mss.
+
+`./defaults.sh
+sysctl -q net.ipv4.tcp_mtu_probing=1`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK>
+   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
+  +.1 < . 1:1(0) ack 1 win 65535
+   +0 accept(3, ..., ...) = 4
+
+   +0 write(4, ..., 1460) = 1460
+   +0 > P. 1:1461(1460) ack 1
+
+// TLP and the first RTO retransmissions keep the full size.
+  +.3 > P. 1:1461(1460) ack 1
+  +.3 > P. 1:1461(1460) ack 1
+  +.6 > P. 1:1461(1460) ack 1
+ +1.2 > P. 1:1461(1460) ack 1
+
+// Once tcp_retries1 is exceeded the MSS drops to tcp_base_mss.
+ +2.4 > . 1:1025(1024) ack 1
+  +.1 < . 1:1(0) ack 1025 win 65535
+   +0 > P. 1025:1461(436) ack 1
+  +.1 < . 1:1(0) ack 1461 win 65535
+
+// New data keeps using the smaller MSS.
+   +0 write(4, ..., 1460) = 1460
+   +0 > . 1461:2485(1024) ack 1
+   +0 > P. 2485:2921(436) ack 1
+  +.1 < . 1:1(0) ack 2921 win 65535
diff --git a/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole_no_tlp_retries1_is_1.pkt b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole_no_tlp_retries1_is_1.pkt
new file mode 100644
index 000000000000..0421458fba45
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_mtu_probing_blackhole_no_tlp_retries1_is_1.pkt
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+// Test black hole detection with tcp_mtu_probing=1, tcp_retries1=1 and TLP
+// disabled: when full-sized segments keep timing out and no ICMP arrives, TCP
+// falls back to tcp_base_mss.
+
+`./defaults.sh
+sysctl -q net.ipv4.tcp_mtu_probing=1
+sysctl -q net.ipv4.tcp_base_mss=1024
+sysctl -q net.ipv4.tcp_retries1=1
+sysctl -q net.ipv4.tcp_early_retrans=0`
+
+    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+   +0 bind(3, ..., ...) = 0
+   +0 listen(3, 1) = 0
+
+   +0 < S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK>
+   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK>
+  +.1 < . 1:1(0) ack 1 win 65535
+   +0 accept(3, ..., ...) = 4
+
+   +0 write(4, ..., 1460) = 1460
+   +0 > P. 1:1461(1460) ack 1
+
+// The first retransmission keeps the full size.
+  +.3 > P. 1:1461(1460) ack 1
+
+// Once tcp_retries1 is exceeded the MSS drops to tcp_base_mss.
+  +.6 > . 1:1025(1024) ack 1
+  +.1 < . 1:1(0) ack 1025 win 65535
+   +0 > P. 1025:1461(436) ack 1
+  +.1 < . 1:1(0) ack 1461 win 65535
+
+// New data keeps using the smaller MSS.
+   +0 write(4, ..., 1460) = 1460
+   +0 > . 1461:2485(1024) ack 1
+   +0 > P. 2485:2921(436) ack 1
+  +.1 < . 1:1(0) ack 2921 win 65535

-- 
Git-157)
Technical Details
Message-ID: <20261111-mtu-probing-series-v4-3-6f2e484ca8ea@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360440-linux-kernel-netdev=dewy.ru
References: <20261111-mtu-probing-series-v4-0-6f2e484ca8ea@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360440-linux-kernel-netdev=dewy.ru
From: devnull+echoowall.gmail.com@kernel.org (Yongjian Wang via B4 Relay)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v4 3/4] selftests/net: packetdrill: add TCP black
 hole detection tests
Date: Wed, 11 Nov 2026 00:45:57 +0800
Organization: Usenet Network
Message-ID: <20261111-mtu-probing-series-v4-3-6f2e484ca8ea@gmail.com>
References: <20261111-mtu-probing-series-v4-0-6f2e484ca8ea@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="652974"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xahBrbNhuohOPaczm4jewJRY3eg= sha256:pPwKlpOblS2KrjComHbbKpraaKTJ73hhiLCqG9Zb2Go=
	sha1:ezx0RL07rjp/659M9hiRVjPVw2U= sha256:WOriTIEdDZ7dlSyLyGPVwiuomEbRUWsI0xUq8LSt6N4=
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 223D8113C62; Tue, 10 Nov 2026 19:51:51 +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 HVJGDXscec8M;
	Tue, 10 Nov 2026 19:51:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-360440-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 555ED113C48; Tue, 10 Nov 2026 19:51:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 3EED368102; Tue, 10 Nov 2026 16:46:21 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794329161;
	b=raA0sD7HiQfpS1xcEP+qHmaDfPQAnC4aHxg1eRI6ycT0N8Da4TbMGpHcpWlAlrEbZ5yx
	 5ouv15cRssVjNb15tv8brO7SlpLRQEw/XvKJ4gVAtv6doeQJ93e42rlVmuFoC9NEXSoPx
	 g7qk+cr7r0q1j2sx19tv01u2yxOO/YHz3qCiClJQ3PJLlN+AOavS9gTq/uSr15pF+RrlQ
	 0AfWNjeyuaYXdC9EYMGFGcA0qC4VCVGPp+GqC+mDikKDvqXXj1XV62tAuirNChTmNN92D
	 GlX+0leEzmXxlZEPhptDuy5MNDsPHaPyOeJ71Sz1JAw0Htb+8t/l0qGhHgFphx0EQwg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794329161;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=h/NzmMx/WxxoUPK2RZDSGStjl3Bsd9UdAA3RuyW6X5Y=;
	b=cM80lmVFShOe3IbPoMtAr2Ujs6Mi78TF1ps+oLjWwDbDc4cGWXkee025p3O8GKVLF8mH
	 r+hhodG82lieJE3c1Pnkg6/CTrnpny6WjXKhqliVqz8JXA/YRI91sQHPilS8xT6ic3z5S
	 8aZ78V/r/BRszi1pX+groIgeXehP2vDlgq1FaVJIKk4ah7j7yPimrzvySlgw8P4gBAN80
	 SvRppmm7sONmgr6mx3g5Rea7BIKziFqzWAoTdrf9kEySwy5rQh9bWNLCMmzTdiGCxFEuZ
	 TXVeIThB6jHA3prm2d5idAULGD/chn0tCbZNx7xzp9UJ9P4PjezM9kDOvTp5/97MIsQ==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DOLp2suj;
	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 1A99260A2638;
	Tue, 10 Nov 2026 16:46:01 +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=DOLp2suj
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794329160;
	b=jz33k53vls8Xz33pbnj1MlHK9sA5PwcRLaIB9NtwfVcMoKDYdRfWXr0Oo5M90ep7pZjf
	 cIl3FYd30pjafo/phpmoizVC//AAa5d1Vr0P6cGKfhec5JLKPFY7zptv839n5h8zscdcw
	 glUJ3H0fNU65QQiI0ivAjMHyQOBBO0zsniPhMJpIOtpOobEtXrqG1Sd/U7Yq7zoWTJB0S
	 psZBKvcQeulAiFraYD7/vHTD+f+O4D2oeAgM//xLv5pkQZpBE9e0pQF3bcABwlAXFt1t5
	 Ea3AUup1mdwKFX5aVhvTZLjf9gS4SwFeM84VZI4F2KGdFwlwmNL8frXsyO/ZRkx9boQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794329160;
	h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version:
	 Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=h/NzmMx/WxxoUPK2RZDSGStjl3Bsd9UdAA3RuyW6X5Y=;
	b=OfLyMa7d+8RpcLbMcFce4cwDS3u+F/mVpzCBaKvU5V+FoT0smaVMAd/u40O6T6jaPLZ7
	 SB3/uO9Ei+7pukTdzIz+okiTEU3h0NQubSqJjlrMf2F9Ot9FayTukurntsVRMAyhmrCw4
	 9P/e6ctdKIJ0330zBSBYbUi6Z0c6mWNl51iztc/HzXe9wpZgWreC0OJXR+iWHoSkXQaX+
	 Enc4bKpdgrpPs970bCgQ7YLseYG8Ap+MoTswN1kT2DgBmmdg8Zh+frJ0DiB2W8gsJ38cQ
	 q1CVb4+2bdaoqbK0mCyzjBM957XHsYptlJLehurH5LWF2dRcmIXS+dvp3EKxEoU/zsg==
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=DOLp2suj;
	arc=pass header.oldest-pass=0 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 E9988606A336;
	Tue, 10 Nov 2026 16:45:59 +0000 (UTC)
X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77
X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none;
	t=1794329159;
	b=XT63kMH2Il0ES2nXzy+9wVvMjpk9g/8+SnSNulVTkpOy1Appr5pZm6vWyeeu7Q8+iRDt
	 NQb4Zgd0i9Hr7xu1sA3EscOEUs2LRhbZqYUxSPfUFeIQ3pTkxZSXDpgk4LFIGygij/805
	 vTIxg9yP7+cDFirbpXYtRahNrJoFiNhLMvHuqcJV3K1WWiLf2SkpDZGbErnFyQB77czDw
	 /K9lxLgmek4bDR/1ngv4gh+e62bliUeV5ypgGnHN1sZ8uazrpnBcBzdmjaYHaaqs0Sv0l
	 Ka1Qlws8b2s6TYhqPGw3W7pA0jGuqNG1m7+um5lKu/WDXaly9F4IhlIwwU24SIZuPtg==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1794329159;
	h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=h/NzmMx/WxxoUPK2RZDSGStjl3Bsd9UdAA3RuyW6X5Y=;
	b=x1E8SZO2MDtGoze9mXV1zewPSheUsOsO5HOB6aqc1r6zdvlUgm5B7eW5dIgA7o1knJ6o
	 vD/Gg+DipuSc6gkGjKY79Qy72S5ivki8GwbtQYDgJOkMO9ByFhFnGHwoVLQqF59GJyJCo
	 t/HwARV7gdlIZ8VPid26RfB1SUsyYruI19uVA0kc21ax1UvQtEjlJnOiaeCgaNMa8kTcv
	 N6GaTqz1i7H8kg3+GN4kCmOB/YAqMh56qFE+l42k6cgdB3rbD7X/mLGpgt1OcAzDiHN+B
	 +EmwYj7nDYp3MNajSniyFHcBrVq9yYgz0Qb80DjpiaW+BYoiyl5h9E8fv6nIeXIA9nA==
X-ARC-Authentication-Results: i=1; smtp.kernel.org; 
	arc=none smtp.remote-ip=100.80.115.77
X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.kernel.org (Postfix) with ESMTPS id 7B3691F008A3;
	Tue, 10 Nov 2026 16:45:58 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794329159;
	bh=h/NzmMx/WxxoUPK2RZDSGStjl3Bsd9UdAA3RuyW6X5Y=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To;
	b=DOLp2sujdvF6YWy4q50TmuPWGV7oBTJH5+vGqnWe2xUlj7v70oaR6jpVMjszPIowA
	 OEJQE7P5oSlmwM3OVk0yqC8If2P2cdAhW3lxb7LPSLaDmmQybuE2QRg94RmNCaNt/Q
	 VB/KW6lHa+yLdutFYv9WhRa9JO68K6CWPAaJ/Xi+7oMIoISpss32o3EooZA1Ge9Csc
	 0lg/zpKBW/5hBknQbuy+2UhXbTs2ZFv7AVh90qO1O/HoVacF9ZbofnWPvgNzP5ky1i
	 N4WlT4C6ZCWEN7fhQa2iay47wnnADhKTEu1zUty+2Y3/AbZ24cYtYqflObly+mvKjr
	 BTPlDsqpY2Omw==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id 081AE48C00;
	Tue, 10 Nov 2026 16:45:58 +0000 (UTC)
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
X-In-Reply-To: <20261111-mtu-probing-series-v4-0-6f2e484ca8ea@gmail.com>
X-Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, 
 netdev@vger.kernel.org, panweiping3@gmail.com, 
 Yongjian Wang <echoowall@gmail.com>
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=ed25519-sha256; t=1794329156; l=4124;
 i=echoowall@gmail.com; s=20261026; h=from:subject:message-id;
 bh=+yXa+nBg9+47003kOzkfKLT4ELxoq9V9aPGcdqcFMpM=;
 b=IQkfUZhuhzXRnrmF05eHjVxDMIzJsZaDAOHq9rsSFqa4TCE0LrqaQmnruR2Al7Or3YM+Irc/7
 Tk6PnTL2fbFATQ8eAVy41bIpcCtAHGUB7lJ+AEx3+jLGFFTKb2MFswl
X-Developer-Key: i=echoowall@gmail.com; a=ed25519;
 pk=9XP6JhqjjPsHCF6UZZZTeqTRnXIa4+ufggnxXtTJ+no=
X-Endpoint-Received: by B4 Relay for echoowall@gmail.com/20261026 with
 auth_id=1323
X-Original-From: Yongjian Wang <echoowall@gmail.com>
X-Reply-To: echoowall@gmail.com