tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Quanye Yang <quanyeyang@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.
Fixes: ce9979129a0b ("selftests: mptcp: add mptcp getsockopt test cases")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/638
Signed-off-by: Quanye Yang <quanyeyang@proton.me>
---
Changes in v2:
- fix commit message to describe the write_seq assert, not the TCP_INFO timeout
- Link to v1: https://patch.msgid.link/20261015-fix-mptcp-issue-638-v1-1-5de999ad601c@proton.me
---
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 */
---
base-commit: a22035be824449c4921ec406f6383089016a628c
change-id: 20261015-fix-mptcp-issue-638-ec1dd30f7295
Best regards,
--
Quanye Yang <quanyeyang@proton.me>
Hi Quanye, On 17/10/2026 07:33, Quanye Yang via B4 Relay wrote: > From: Quanye Yang <quanyeyang@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. Thank you for the patch, it looks good to me. Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> I just applied it in our tree, but for net-next because I don't think I saw the issue in our and the netdev CI. So I added this in the commit message: 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. New patches for t/upstream: - e4ab26e68fc2: selftests: mptcp: sockopt: pass total bytes to do_getsockopts - Results: 7ea69c5a1764..54143bb812b1 (export) Tests are now in progress: - export: https://github.com/multipath-tcp/mptcp_net-next/commit/fae0397e047620f27866048567a39eb2bae6746c/checks Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, Quanye, On Thu, 2026-10-22 at 13:06 +0200, Matthieu Baerts wrote: > Hi Quanye, > > On 17/10/2026 07:33, Quanye Yang via B4 Relay wrote: > > From: Quanye Yang <quanyeyang@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. > > Thank you for the patch, it looks good to me. > > Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > > I just applied it in our tree, but for net-next because I don't think > I > saw the issue in our and the netdev CI. So I added this in the commit > message: > > 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. Sorry for the late reply - I just saw this patch. Glad the issue has been fixed. But actually, I had already fixed this issue earlier: my patch titled "selftests: mptcp: sockopt: use exact length in connect_one_server" [1] is still waiting for review on the MPTCP mailing list. But it's no big deal - I should have replied with an Acked-by for this patch. Anyway, I'm wondering - does it look like my pending series "selftests: consolidate TCP_INQ testing into sockopt" [2] is still useful after all? Should I rebase it and send a v15? Thanks, -Geliang [1] https://patchwork.kernel.org/project/mptcp/patch/6ec4570fb7b73f92905ef38beb414a4a7709e0a4.1785380422.git.tanggeliang@kylinos.cn/ [2] https://patchwork.kernel.org/project/mptcp/cover/cover.1785380422.git.tanggeliang@kylinos.cn/ > > New patches for t/upstream: > - e4ab26e68fc2: selftests: mptcp: sockopt: pass total bytes to > do_getsockopts > - Results: 7ea69c5a1764..54143bb812b1 (export) > > Tests are now in progress: > > - export: > https://github.com/multipath-tcp/mptcp_net-next/commit/fae0397e047620f27866048567a39eb2bae6746c/checks > > Cheers, > Matt
On 23/10/2026 03:05, Geliang Tang wrote: > Hi Matt, Quanye, > > On Thu, 2026-10-22 at 13:06 +0200, Matthieu Baerts wrote: >> Hi Quanye, >> >> On 17/10/2026 07:33, Quanye Yang via B4 Relay wrote: >>> From: Quanye Yang <quanyeyang@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. >> >> Thank you for the patch, it looks good to me. >> >> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> >> >> I just applied it in our tree, but for net-next because I don't think >> I >> saw the issue in our and the netdev CI. So I added this in the commit >> message: >> >> 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. > > Sorry for the late reply - I just saw this patch. Glad the issue has > been fixed. But actually, I had already fixed this issue earlier: my > patch titled "selftests: mptcp: sockopt: use exact length in > connect_one_server" [1] is still waiting for review on the MPTCP > mailing list. But it's no big deal - I should have replied with an > Acked-by for this patch. My bad, I forgot about that patch when I opened a bunch of issues reported by Sashiko. I will add your co-dev-by on that one. Do we need the other modification you did on the 'read' to silence a GCC warning? Because the current "sizeof(buf2) - total" seems correct to me. > Anyway, I'm wondering - does it look like my pending series "selftests: > consolidate TCP_INQ testing into sockopt" [2] is still useful after > all? Should I rebase it and send a v15? It is still useful, but sorry, I need to go through it (and many others :( ). I will try to do that in November/December after some deadlines. No need to rebase before. Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, On Fri, 2026-10-23 at 11:28 +0200, Matthieu Baerts wrote: > On 23/10/2026 03:05, Geliang Tang wrote: > > Hi Matt, Quanye, > > > > On Thu, 2026-10-22 at 13:06 +0200, Matthieu Baerts wrote: > > > Hi Quanye, > > > > > > On 17/10/2026 07:33, Quanye Yang via B4 Relay wrote: > > > > From: Quanye Yang <quanyeyang@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. > > > > > > Thank you for the patch, it looks good to me. > > > > > > Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > > > > > > I just applied it in our tree, but for net-next because I don't > > > think > > > I > > > saw the issue in our and the netdev CI. So I added this in the > > > commit > > > message: > > > > > > 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. > > > > Sorry for the late reply - I just saw this patch. Glad the issue > > has > > been fixed. But actually, I had already fixed this issue earlier: > > my > > patch titled "selftests: mptcp: sockopt: use exact length in > > connect_one_server" [1] is still waiting for review on the MPTCP > > mailing list. But it's no big deal - I should have replied with an > > Acked-by for this patch. > > My bad, I forgot about that patch when I opened a bunch of issues > reported by Sashiko. > > I will add your co-dev-by on that one. No need - let's keep it as it is. > > Do we need the other modification you did on the 'read' to silence a > GCC > warning? Because the current "sizeof(buf2) - total" seems correct to > me. > > > Anyway, I'm wondering - does it look like my pending series > > "selftests: > > consolidate TCP_INQ testing into sockopt" [2] is still useful after > > all? Should I rebase it and send a v15? > > It is still useful, but sorry, I need to go through it (and many > others > :( ). I will try to do that in November/December after some > deadlines. > No need to rebase before. But could we hold off on the other patch, "selftests: mptcp: sockopt: echo until EOF on partial reads"? It conflicts with patches 3 and 4 in my series. As it's for "-next" rather than "-net", I'd suggest not merging it yet - I'll sort out the conflict once I have some time. Thanks, -Geliang > > Cheers, > Matt
Hi Quanye,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Perf: Critical: No conclusion ❓
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/39578668072
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/04d6a9f052ab
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1187817
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
© 2016 - 2026 Red Hat, Inc.