mptcp: fastopen: only mark MPTFO subflows with SYN data
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mptcp: fastopen: only mark MPTFO subflows with SYN data
From: Wyatt Feng <[email protected]>
Passive TCP Fast Open accepts a valid-cookie SYN even when it carries no data. In that case the child socket's receive queue is intentionally left empty.
mptcp_fastopen_subflow_synack_set_params() set is_mptfo before checking for queued SYN data. That made data-less TFO SYNs hit a WARN and, if the warning was non-fatal, left stale MPTFO state behind. The stale flag could later trigger a state-confusion bug in check_fully_established().
Only mark the subflow as MPTFO after confirming that a SYN-data skb is present. Return quietly when the receive queue is empty.
--- net/mptcp/fastopen.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/mptcp/fastopen.c +4 -3
@@ -24,12 +24,13 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf sk = subflow->conn; tp =tcp_sk (ssk); - subflow->is_mptfo =1 ; - +/* A valid TFO cookie does not guarantee SYN data. */ skb =skb_peek (&ssk->sk_receive_queue); -if (WARN_ON_ONCE (!skb)) +if (!skb)return ; + subflow->is_mptfo =1 ; +/* dequeue the skb from sk receive queue */ __skb_unlink (skb, &ssk->sk_receive_queue);skb_ext_reset (skb);
Signature · 1 line
2.47.3
Hi Wyatt,
Thank you for your modifications, that's great!
But sadly, our CI spotted some issues with it when trying to build it.
You can find more details there:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/27351217655
Status: failure
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cf5ad7ddd3d5
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1106932
Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Wyatt,
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! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/27351217630
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cf5ad7ddd3d5
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1106932
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-normalFor 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)
Hi Ren, Wyatt, Yuan,
Quoted 4 lines
Passive TCP Fast Open accepts a valid-cookie SYN even when it carries no data. In that case the child socket's receive queue is intentionally left empty.
Quoted 8 lines
mptcp_fastopen_subflow_synack_set_params()setis_mptfobefore checking for queued SYN data. That made data-less TFO SYNs hit a WARN and, if the warning was non-fatal, left stale MPTFO state behind. The stale flag could later trigger a state-confusion bug incheck_fully_established().Only mark the subflow as MPTFO after confirming that a SYN-data skb is present. Return quietly when the receive queue is empty.
Thank you for the fix, it looks good to me:
@Netdev maintainers: this can be applied directly in net.
Sorry for the delay, I initially wanted to understand the reproducer, then wrote a small packetdrill script, then I lost track of this patch.
As I mentioned to Yuan last week at NetdevConf, it would be great if the PoC could first try to use Packetdrill when it is doable. For example, in this case, this packetdrill script appears to be far more readable than the .c files generated by AI:
https://github.com/multipath-tcp/packetdrill/pull/202/changes
=> It is easy to read the syscalls, the injected packets (<) and the expected ones (>) with an output similar to the one from tcpdump.
Note that for MPTCP, this fork should be used:
https://github.com/multipath-tcp/packetdrill
Otherwise, the official repo can be used:
https://github.com/google/packetdrill
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Quoted 38 lines · On Wed, Jul 22, 2026 at 4:07 AM Matthieu Baerts (NGI0) <[email protected]>…
Hi Ren, Wyatt, Yuan,
Quoted 4 lines
Passive TCP Fast Open accepts a valid-cookie SYN even when it carries no data. In that case the child socket's receive queue is intentionally left empty.
Quoted 8 lines
mptcp_fastopen_subflow_synack_set_params()setis_mptfobefore checking for queued SYN data. That made data-less TFO SYNs hit a WARN and, if the warning was non-fatal, left stale MPTFO state behind. The stale flag could later trigger a state-confusion bug incheck_fully_established().Only mark the subflow as MPTFO after confirming that a SYN-data skb is present. Return quietly when the receive queue is empty.
Thank you for the fix, it looks good to me:
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>@Netdev maintainers: this can be applied directly in net.
Sorry for the delay, I initially wanted to understand the reproducer, then wrote a small packetdrill script, then I lost track of this patch.
As I mentioned to Yuan last week at NetdevConf, it would be great if the PoC could first try to use Packetdrill when it is doable. For example, in this case, this packetdrill script appears to be far more readable than the .c files generated by AI:
https://github.com/multipath-tcp/packetdrill/pull/202/changes
=> It is easy to read the syscalls, the injected packets (<) and the expected ones (>) with an output similar to the one from tcpdump.
Note that for MPTCP, this fork should be used:
Quoted 8 lines
https://github.com/multipath-tcp/packetdrill
Otherwise, the official repo can be used:
https://github.com/google/packetdrill
--
Matthieu Baerts (NGI0) <[email protected]>
Thank you very much for your review. After receiving your suggestions, I asked Wyatt to prepare a packetdrill version of the PoC for this bug, but it is not ready yet. I apologize for taking up some of your time on this review.
For future patches, whenever possible, we will include a packetdrill PoC in the cover letter and send it to the public mailing list. We will also use a new Reported-by: Vega tag instead of the tag we are currently using.
Jakub Kicinski
maintainerQuoted 1 line · On Wed, 22 Jul 2026 13:07:42 +0200 Matthieu Baerts (NGI0) wrote:
@Netdev maintainers: this can be applied directly in net.
Too late, please take it.
Matthieu Baerts
maintainerQuoted 4 lines · Jakub Kicinski
Quoted 1 line · On Wed, 22 Jul 2026 13:07:42 +0200 Matthieu Baerts (NGI0) wrote:
@Netdev maintainers: this can be applied directly in net.
Too late, please take it.
No problem, I did take it, and I will send it with the next batch.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.