Skip to content

Commit 578cb15

Browse files
matttbeintel-lab-lkp
authored andcommitted
selftests: mptcp: avoid spurious errors on TCP disconnect
The disconnect test-case, with 'plain' TCP sockets generates spurious errors, e.g. 07 ns1 TCP -> ns1 (dead:beef:1::1:10006) MPTCP read: Connection reset by peer read: Connection reset by peer (duration 155ms) [FAIL] client exit code 3, server 3 netns ns1-FloSdv (listener) socket stat for 10006: TcpActiveOpens 2 0.0 TcpPassiveOpens 2 0.0 TcpEstabResets 2 0.0 TcpInSegs 274 0.0 TcpOutSegs 276 0.0 TcpOutRsts 3 0.0 TcpExtPruneCalled 2 0.0 TcpExtRcvPruned 1 0.0 TcpExtTCPPureAcks 104 0.0 TcpExtTCPRcvCollapsed 2 0.0 TcpExtTCPBacklogCoalesce 42 0.0 TcpExtTCPRcvCoalesce 43 0.0 TcpExtTCPChallengeACK 1 0.0 TcpExtTCPFromZeroWindowAdv 42 0.0 TcpExtTCPToZeroWindowAdv 41 0.0 TcpExtTCPWantZeroWindowAdv 13 0.0 TcpExtTCPOrigDataSent 164 0.0 TcpExtTCPDelivered 165 0.0 TcpExtTCPRcvQDrop 1 0.0 In the failing scenarios (TCP -> MPTCP), the involved sockets are actually plain TCP ones, as fallbacks for passive sockets at 2WHS time cause the MPTCP listeners to actually create 'plain' TCP sockets. Similar to commit 218cc16 ("selftests: mptcp: avoid spurious errors on disconnect"), the root cause is in the user-space bits: the test program tries to disconnect as soon as all the pending data has been spooled, generating an RST. If such option reaches the peer before the latter has reached the closed status, the TCP socket will report an error to the user-space, as per protocol specification, causing the above failure. Note that it looks like this issue got more visible since the "tcp: receiver changes" series from commit 06baf9b ("Merge branch 'tcp-receiver-changes'"). Address the issue by explicitly waiting for all the relevant TCP sockets to reach a closed status before performing the disconnect. More precisely, the test program now waits if there are still some sockets in ESTABLISHED, FIN_WAIT_1, LAST_ACK, or CLOSING. So there is a reconnect only in case of FIN_WAIT_2, CLOSE_WAIT, TIME_WAIT, and CLOSED sockets. While at it, use 'ss' with '-n' to avoid resolving service names which is not needed here. Fixes: 218cc16 ("selftests: mptcp: avoid spurious errors on disconnect") Suggested-by: Paolo Abeni <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent b15e9c0 commit 578cb15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ void xdisconnect(int fd)
12511251
else
12521252
xerror("bad family");
12531253

1254-
strcpy(cmd, "ss -M | grep -q ");
1254+
strcpy(cmd, "ss -Mnt state established state fin-wait-1 state last-ack state closing | grep -q ");
12551255
cmdlen = strlen(cmd);
12561256
if (!inet_ntop(addr.ss_family, raw_addr, &cmd[cmdlen],
12571257
sizeof(cmd) - cmdlen))
@@ -1261,7 +1261,7 @@ void xdisconnect(int fd)
12611261

12621262
/*
12631263
* wait until the pending data is completely flushed and all
1264-
* the MPTCP sockets reached the closed status.
1264+
* the sockets reached the closed status.
12651265
* disconnect will bypass/ignore/drop any pending data.
12661266
*/
12671267
for (i = 0; ; i += msec_sleep) {

0 commit comments

Comments
 (0)