Skip to content

Commit 14e22b4

Browse files
matttbekuba-moo
authored andcommitted
selftests: mptcp: connect: catch IO errors on listen side
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: 05be5e2 ("selftests: mptcp: add disconnect tests") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250912-net-mptcp-fix-sft-connect-v1-2-d40e77cbbf02@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f755be0 commit 14e22b4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/testing/selftests/net/mptcp/mptcp_connect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ int main_loop_s(int listensock)
10931093
struct pollfd polls;
10941094
socklen_t salen;
10951095
int remotesock;
1096+
int err = 0;
10961097
int fd = 0;
10971098

10981099
again:
@@ -1125,7 +1126,7 @@ int main_loop_s(int listensock)
11251126
SOCK_TEST_TCPULP(remotesock, 0);
11261127

11271128
memset(&winfo, 0, sizeof(winfo));
1128-
copyfd_io(fd, remotesock, 1, true, &winfo);
1129+
err = copyfd_io(fd, remotesock, 1, true, &winfo);
11291130
} else {
11301131
perror("accept");
11311132
return 1;
@@ -1134,10 +1135,10 @@ int main_loop_s(int listensock)
11341135
if (cfg_input)
11351136
close(fd);
11361137

1137-
if (--cfg_repeat > 0)
1138+
if (!err && --cfg_repeat > 0)
11381139
goto again;
11391140

1140-
return 0;
1141+
return err;
11411142
}
11421143

11431144
static void init_rng(void)

0 commit comments

Comments
 (0)