Skip to content

Commit ff16050

Browse files
matttbegregkh
authored andcommitted
selftests: mptcp: connect: catch IO errors on listen side
[ Upstream commit 14e22b4 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f18be27 commit ff16050

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
@@ -1005,6 +1005,7 @@ int main_loop_s(int listensock)
10051005
struct pollfd polls;
10061006
socklen_t salen;
10071007
int remotesock;
1008+
int err = 0;
10081009
int fd = 0;
10091010

10101011
again:
@@ -1036,7 +1037,7 @@ int main_loop_s(int listensock)
10361037

10371038
SOCK_TEST_TCPULP(remotesock, 0);
10381039

1039-
copyfd_io(fd, remotesock, 1, true);
1040+
err = copyfd_io(fd, remotesock, 1, true, &winfo);
10401041
} else {
10411042
perror("accept");
10421043
return 1;
@@ -1045,10 +1046,10 @@ int main_loop_s(int listensock)
10451046
if (cfg_input)
10461047
close(fd);
10471048

1048-
if (--cfg_repeat > 0)
1049+
if (!err && --cfg_repeat > 0)
10491050
goto again;
10501051

1051-
return 0;
1052+
return err;
10521053
}
10531054

10541055
static void init_rng(void)

0 commit comments

Comments
 (0)