MPTCP Linux Development
 help / color / mirror / Atom feed
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: mptcp@lists.linux.dev
Cc: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Subject: [PATCH mptcp-net v2 2/5] selftests: mptcp: connect: catch IO errors on listen side
Date: Fri, 05 Sep 2025 20:18:51 +0200	[thread overview]
Message-ID: <20250905-sft-mptcp-disc-err-v2-2-dfb3b6b4a877@kernel.org> (raw)
In-Reply-To: <20250905-sft-mptcp-disc-err-v2-0-dfb3b6b4a877@kernel.org>

IO errors were correctly printed to stderr, and propagated up to the
main loop for the server side, but the returned value was ignored. As a
consequence, the program for the listener side was no longer exiting
with an error code in case of IO issues.

Because of that, some issues might not have been seen. But very likely,
most issues either had an effect on the client side, or the file
transfer was not the expected one, e.g. the connection got reset before
the end. Still, it is better to fix this.

The main consequence of this issue is the error that was reported by the
selftests: the received and sent files were different, and the MIB
counters were not printed. Also, when such errors happened during the
'disconnect' tests, the program tried to continue until the timeout.

Now when an IO error is detected, the program exits directly with an
error.

Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index 4f07ac9fa207cb08a934582b98d688d0b9512f97..c1586a7286123a509495ac319fd624b98f0bfd18 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1112,6 +1112,8 @@ int main_loop_s(int listensock)
 	salen = sizeof(ss);
 	remotesock = accept(listensock, (struct sockaddr *)&ss, &salen);
 	if (remotesock >= 0) {
+		int err;
+
 		maybe_close(listensock);
 		check_sockaddr(pf, &ss, salen);
 		check_getpeername(remotesock, &ss, salen);
@@ -1125,7 +1127,9 @@ int main_loop_s(int listensock)
 		SOCK_TEST_TCPULP(remotesock, 0);
 
 		memset(&winfo, 0, sizeof(winfo));
-		copyfd_io(fd, remotesock, 1, true, &winfo);
+		err = copyfd_io(fd, remotesock, 1, true, &winfo);
+		if (err)
+			return err;
 	} else {
 		perror("accept");
 		return 1;

-- 
2.51.0


  parent reply	other threads:[~2025-09-05 18:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 18:18 [PATCH mptcp-net v2 0/5] selftests: mptcp: avoid spurious errors on TCP disconnect Matthieu Baerts (NGI0)
2025-09-05 18:18 ` [PATCH mptcp-net v2 1/5] mptcp: propagate shutdown to subflows when possible Matthieu Baerts (NGI0)
2025-09-06  0:45   ` Geliang Tang
2025-09-06 13:42     ` Matthieu Baerts
2025-09-10  3:24       ` Geliang Tang
2025-09-10  8:56         ` Matthieu Baerts
2025-09-06  0:47   ` Geliang Tang
2025-09-05 18:18 ` Matthieu Baerts (NGI0) [this message]
2025-09-05 23:49   ` [PATCH mptcp-net v2 2/5] selftests: mptcp: connect: catch IO errors on listen side Geliang Tang
2025-09-06 13:54     ` Matthieu Baerts
2025-09-10  2:44       ` Geliang Tang
2025-09-10  8:56         ` Matthieu Baerts
2025-09-05 18:18 ` [PATCH mptcp-net v2 3/5] selftests: mptcp: avoid spurious errors on TCP disconnect Matthieu Baerts (NGI0)
2025-09-05 18:18 ` [PATCH mptcp-net v2 4/5] selftests: mptcp: print trailing bytes with od Matthieu Baerts (NGI0)
2025-09-05 23:42   ` Geliang Tang
2025-09-06 13:56     ` Matthieu Baerts
2025-09-10  3:26       ` Geliang Tang
2025-09-05 18:18 ` [PATCH mptcp-net v2 5/5] selftests: mptcp: connect: print pcap suffix Matthieu Baerts (NGI0)
2025-09-05 23:39   ` Geliang Tang
2025-09-06 13:58     ` Matthieu Baerts
2025-09-10  3:31       ` Geliang Tang
2025-09-05 20:46 ` [PATCH mptcp-net v2 0/5] selftests: mptcp: avoid spurious errors on TCP disconnect MPTCP CI
2025-09-06 14:00   ` Matthieu Baerts

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=20250905-sft-mptcp-disc-err-v2-2-dfb3b6b4a877@kernel.org \
    --to=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /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