🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27153

[PATCH net-next 08/10] selftests: mptcp: sockopt: drop unreachable FIN accounting

#27153
From: "Matthieu Baerts (NGI0)"
Date: Fri, 04 Dec 2026 21:44
73 lines
10848 bytes
From: Quanye Yang <quanyeyang@proton.me>

connect_one_server() sets eof when read() returns 0, then immediately
checks total != len. The receive loop only observes EOF while total is
still below len, so that check always fires and xerror() terminates the
process. The later if (eof) block that increments total for DATA_FIN is
therefore unreachable.

The client also does not wait for the peer to close: process_one_client()
blocks on hangup first, so a peer DATA_FIN cannot arrive before this
assertion. DATA_FIN sequence advancement is already checked on the server
after EOF. Treat an early EOF as a hard error and drop the dead
adjustment.

This issue has been reported by Sashiko and not seen in CI environments.
Yet, it could be visible, especially when the test is launched manually.

Fixes: ce9979129a0b ("selftests: mptcp: add mptcp getsockopt test cases")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/637
Signed-off-by: Quanye Yang <quanyeyang@proton.me>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index 7b4ccbe10ae1..10bef56acc6c 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -572,7 +572,6 @@ static void connect_one_server(int fd, int pipefd)
 	char buf[4096], buf2[4096];
 	size_t len, i, total;
 	struct so_state s;
-	bool eof = false;
 	ssize_t ret;
 
 	memset(&s, 0, sizeof(s));
@@ -610,16 +609,15 @@ static void connect_one_server(int fd, int pipefd)
 		ret = read(fd, buf2 + total, sizeof(buf2) - total);
 		if (ret < 0)
 			die_perror("read");
-		if (ret == 0) {
-			eof = true;
-			break;
-		}
+		if (ret == 0)
+			xerror("unexpected EOF, total %lu, len %lu\n",
+			       total, len);
 
 		total += ret;
 	} while (total < len);
 
 	if (total != len)
-		xerror("total %lu, len %lu eof %d\n", total, len, eof);
+		xerror("total %lu, len %lu\n", total, len);
 
 	if (memcmp(buf, buf2, len))
 		xerror("data corruption");
@@ -629,9 +627,6 @@ static void connect_one_server(int fd, int pipefd)
 
 	do_getsockopts(&s, fd, total, total);
 
-	if (eof)
-		total += 1; /* sequence advances due to FIN */
-
 	assert(s.mptcpi_rcv_delta == (uint64_t)total);
 	close(fd);
 }

-- 
2.55.0
Technical Details
Message-ID: <20261204-net-next-mptcp-misc-feat-7-5-v1-8-1449de51adae@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377657-linux-kernel-netdev=dewy.ru
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377657-linux-kernel-netdev=dewy.ru
From: matttbe@kernel.org ("Matthieu Baerts (NGI0)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 08/10] selftests: mptcp: sockopt: drop unreachable
 FIN accounting
Date: Fri, 04 Dec 2026 22:44:40 +0100
Organization: Usenet Network
Message-ID: <20261204-net-next-mptcp-misc-feat-7-5-v1-8-1449de51adae@kernel.org>
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2878778"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:miUgtpZzAQoYIpivKffXThXJcPM= sha256:vvcIvPCXBHqu0WFBwbH1iuBfXQM/EHABtd7J8BmEqos=
	sha1:FsTwgHnOyv1uiJqYrh/wHvRjMWE= sha256:RwB5vJGi0w4l9dDKdpb5AIXI+vr2QA++YvaUDecrcOA=
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 BC57B117CFC; Sat,  5 Dec 2026 00:45:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.542
X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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 xyXL_GCnvYsJ;
	Sat,  5 Dec 2026 00:45:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377657-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 A87F8117CF4; Sat,  5 Dec 2026 00:45:30 +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 26DCD3B6BD; Fri,  4 Dec 2026 21:45:24 +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=1796420724;
	b=z6xpMUwwiOfpOQr3fTMfxgaUIUlby1YSnZ+4QxC0qjQrndNtaZy0Y1JKVN8ebCJYrq6Z
	 lmxz7sU7vbjOFyFYK4kV2Wz+GwobEFFvSSrYjcw1+u2fWP0NgKXHwcSsNtQkV5hSQmXxT
	 uBzb01rLVrDuZRSy6piestLrm7MVFctl35XdmhQSFRWmrlCLcpB64I5URUhFtk1DBJmsa
	 8xfH9enMiAn3s44ZXOXWzLGnG/HllrcmR8rJcgHiV+xRzDoCCLgpAsS6/uJIgqEO9tz+a
	 PTddJvUOb2nfcOatn9t3ov8V+lWWYHVK98pQ9O7JOFLKFeFvSMPo9ymW7SXJnCGE1gw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420724;
	h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=DQqODfsTk/shpBjjmrorzvR0jW99XSlJi0hY7csv7fc=;
	b=Iy6KVSoIZd03zZRcWNRiO1kHLDtjxlUIeaROcDe7PS2gjKaCfih54F+oTGYVk7JNslj4
	 BF5JYfUY0JpkyNYDWGUR+fnYiTSXd2vMCY5zD+dzi8mwH/xLotyk2A5VRZSxXHu+/NLA1
	 mSpR5ubbp++lZgwaYJR6BpfvT+px1OWj15gTwPzgubuYh4NEsf1OKZjTNeT5Wc17neKKZ
	 6nb/bArQtp8HAQ0dRBxUfXdIDVMzlz2sCP0/ZD/8D1ler0NahT0Pt0X/1OttM38JQDdTd
	 U6WKTkfwkzh0aF5hGGTqtghvIYHeonOpQtE+bxRxA1dnGtvvDyJg+2LGJw9aBVxxeKA==
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=cTiWC6F9;
	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 EE5FE606A33C;
	Fri,  4 Dec 2026 21:45:23 +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=cTiWC6F9
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=1796420723;
	b=G6EKbSY5AxN1naTE90dAIwS/HhbHyKpQiULZ62GPwiZzJLwq89DkLxwRt1Bn91Bs2kgd
	 D8mWSwBUJXdKPwa8nOqM6woKsnrpt3NLNTzU6rYOhqtrr9bQ6AbkivCuPvHQ/cKeJFIcE
	 tO718gZooCmbUXZW7gNqCMtAcarG3kMRyXkYbJRpJN9QSqazBsuFaF6FuptAX8+YVrf4p
	 hNdooHbOSr209VDAu9LsTwMvsHflMwdYcnno0Ig/iEU74+WvaJ5X7YLMMsi8VpXbtuLCa
	 begf/knbXtsjK0W4cz4ea+ASQ89EQi0TvnUyLkiy7QaOLZGJB34Gj6zNO5yzDDCn7OQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420723;
	h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=DQqODfsTk/shpBjjmrorzvR0jW99XSlJi0hY7csv7fc=;
	b=PaB+Tpeq9lq0Uz0Wm5YclonlQgXyBBZ7O08LlLCZ5bbAW8kn4Sjm6Ze18C1cW6ba7u8X
	 pEdTlKVkiCiiAhckllBQpAGWqcelwJoci9npMHSuL9Tlp0zfv9qkz23/1FSamuV/Ikl7t
	 SpCDezxPZy3JMoTRnw6AOndJGC8tSRXVNKaESG0yJIw5bcNOEF7HXaoSrKZGhZkmGbEPz
	 B5e39nJCB422alNHdZzdJtelJzHukXJD6IG7UK43qv6Qhd3MQXVRRvleYE8HD26xK1ZW8
	 6LzuB4YbN7b8lBDEr4olqSfnFY9c2DYSxLJoLsPZNlGurTbecoy3EW20e5HR4smnsXA==
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=cTiWC6F9;
	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 1A3A2606A32C;
	Fri,  4 Dec 2026 21:45:23 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F171F00A06;
	Fri,  4 Dec 2026 21:45:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796420722;
	bh=DQqODfsTk/shpBjjmrorzvR0jW99XSlJi0hY7csv7fc=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=cTiWC6F9JG9CzZ+EroeeGHbJxfnyRMHYulGcHGcCGcx9UxhzuxDHPdnLDd73AkK8O
	 B8c/Ws0HX1tR4E+wCiTIEUvRbv6+ZxgU9zx9hl0Zt3JVvX4QyJRqUVHXrNzGNBiBNp
	 ihVRMhulWcmQ3H2/rm5u8/+T8xGkV/sWfB3wu/d9u04/6X3BWKhRK8r33dWd7lvmRI
	 6kzszlrhh0z0Z8TcIuLp/YP4xhPxFsutjt2lOJ/cUxig8ewHiRHBauFimGHMRVJLpc
	 lSL50u8iyF+//nL5xaOYOE+siyiak+Wo1kwkhaiIQy/sKCOaaM/l6r+JvkUrx7rLNn
	 54+XndNvYEwPQ==
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: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>
X-Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, 
 linux-kselftest@vger.kernel.org, 
 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, 
 Quanye Yang <quanyeyang@proton.me>
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=openpgp-sha256; l=2529; i=matttbe@kernel.org;
 h=from:subject:message-id; bh=Ibn+QjCgEugdyCH/EIs1IPvM0jTtAXDs1MxbJYtv1zE=;
 b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLKFTUIuhe1rbxU7kPQ1coNp4tW0N5G7Ui4f5tqeWH65n
 ZkpT9Cko5SFQYyLQVZMkUW6LTJ/5vMq3hIvPwuYOaxMIEMYuDgFYCIezxj+KSyM2vjoRM3m1aU5
 913WsckJT9KY7qnfvUnL/mMek6FmMCPDQgsZSyGznTOnrzZIWn39ptKELfsmMZ+5cUGcsa88cuF
 RZgA=
X-Developer-Key: i=matttbe@kernel.org; a=openpgp;
 fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073