From: Quanye Yang <quan…@proton.me>
connect_one_server() reads the echoed payload in a loop because read()
on a stream socket can return a partial chunk. After the loop, it still
passed the last read() return value to do_getsockopts() instead of the
accumulated byte count.
do_getsockopts() checks MPTCP_INFO first. The client samples
mptcpi_write_seq before write(), and write() has already advanced
msk->write_seq by the full length, so a partial last read() makes
the write_seq assert fail. Pass the total instead.
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/638
Co-developed-by: Geliang Tang <tang…@kylinos.cn>
Signed-off-by: Geliang Tang <tang…@kylinos.cn>
Signed-off-by: Quanye Yang <quan…@proton.me>
Reviewed-by: Matthieu Baerts (NGI0) <matt…@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matt…@kernel.org>
---
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index b6e58d936ebe..7b4ccbe10ae1 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -627,7 +627,7 @@ static void connect_one_server(int fd, int pipefd)
if (s.tcpi_rcv_delta)
assert(s.tcpi_rcv_delta <= total);
- do_getsockopts(&s, fd, ret, ret);
+ do_getsockopts(&s, fd, total, total);
if (eof)
total += 1; /* sequence advances due to FIN */
--
2.55.0