* [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ
@ 2025-02-18 11:24 Matthieu Baerts (NGI0)
2025-02-18 11:24 ` [PATCH mptcp-net v2 1/2] mptcp: reset when MPTCP opts are dropped after join Matthieu Baerts (NGI0)
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-02-18 11:24 UTC (permalink / raw)
To: mptcp; +Cc: Paolo Abeni, Matthieu Baerts (NGI0), Chester A. Unal
- Patch 1: fix issue #544 where a middlebox drops MPTCP options after a
3WHS on the additional subflow.
- Patch 2: a safety check is added when asking to do a fallback to do so
only when allowed. If not, a new warning will be emitted.
Note that two new packetdrill tests have been added in a PR to cover
this case:
https://github.com/multipath-tcp/packetdrill/pull/160
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Changes in v2:
- Squashed previous patches 1 and 2 (Paolo).
- Patch 1: no more special cases for csum (handled before) and inf map
(Paolo).
- Link to v1: https://lore.kernel.org/r/20250217-mptcp-dss-drop-mpj-v1-0-d671d6b9a153@kernel.org
---
Matthieu Baerts (NGI0) (2):
mptcp: reset when MPTCP opts are dropped after join
mptcp: safety check before fallback
net/mptcp/protocol.h | 2 ++
net/mptcp/subflow.c | 15 +--------------
2 files changed, 3 insertions(+), 14 deletions(-)
---
base-commit: 3a7786db65e8f361a8fc8abcd3cfbe17411b8b7f
change-id: 20250205-mptcp-dss-drop-mpj-ec227f4ed942
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH mptcp-net v2 1/2] mptcp: reset when MPTCP opts are dropped after join 2025-02-18 11:24 [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ Matthieu Baerts (NGI0) @ 2025-02-18 11:24 ` Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 2/2] mptcp: safety check before fallback Matthieu Baerts (NGI0) ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Matthieu Baerts (NGI0) @ 2025-02-18 11:24 UTC (permalink / raw) To: mptcp; +Cc: Paolo Abeni, Matthieu Baerts (NGI0), Chester A. Unal Before this patch, if the checksum was not used, the subflow was only reset if map_data_len was != 0. If there were no MPTCP options or an invalid mapping, map_data_len was not set to the data len, and then the subflow was not reset as it should have been, leaving the MPTCP connection in a wrong fallback mode. This map_data_len condition has been introduced to handle the reception of the infinite mapping. Instead, a new dedicated mapping error could have been returned and treated as a special case. However, the commit 31bf11de146c ("mptcp: introduce MAPPING_BAD_CSUM") has been introduced by Paolo Abeni soon after, and backported later on to stable. It better handle the csum case, and it means the exception for valid_csum_seen in subflow_can_fallback(), plus this one for the infinite mapping in subflow_check_data_avail(), are no longer needed. In other words, the code can be simplified there: a fallback should only be done if msk->allow_infinite_fallback is set. This boolean is set to false once MPTCP-specific operations acting on the whole MPTCP connection vs the initial path have been done, e.g. a second path has been created, or an MPTCP re-injection -- yes, possible even with a single subflow. The subflow_can_fallback() helper can then be dropped, and replaced by this single condition. This also makes the code clearer: a fallback should only be done if it is possible to do so. While at it, no need to set map_data_len to 0 in get_mapping_status() for the infinite mapping case: it will be set to skb->len just after, at the end of subflow_check_data_avail(), and not read in between. Fixes: f8d4bcacff3b ("mptcp: infinite mapping receiving") Reported-by: Chester A. Unal <chester.a.unal@xpedite-tech.com> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/544 Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> --- Notes: - v2: - Squash previous patches 1 and 2, and drop csum case from subflow_can_fallback (Paolo). - v2 is quite different, Chester's Tested-by tag has not been added. --- net/mptcp/subflow.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index d2caffa56bdd98f5fd9ef07fdcb3610ea186b848..5255e0cc409437ab1abb66fc8557d18aa4244af7 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1139,7 +1139,6 @@ static enum mapping_status get_mapping_status(struct sock *ssk, if (data_len == 0) { pr_debug("infinite mapping received\n"); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); - subflow->map_data_len = 0; return MAPPING_INVALID; } @@ -1298,18 +1297,6 @@ static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ss mptcp_schedule_work(sk); } -static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) -{ - struct mptcp_sock *msk = mptcp_sk(subflow->conn); - - if (subflow->mp_join) - return false; - else if (READ_ONCE(msk->csum_enabled)) - return !subflow->valid_csum_seen; - else - return READ_ONCE(msk->allow_infinite_fallback); -} - static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); @@ -1405,7 +1392,7 @@ static bool subflow_check_data_avail(struct sock *ssk) return true; } - if (!subflow_can_fallback(subflow) && subflow->map_data_len) { + if (!READ_ONCE(msk->allow_infinite_fallback)) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ -- 2.47.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH mptcp-net v2 2/2] mptcp: safety check before fallback 2025-02-18 11:24 [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 1/2] mptcp: reset when MPTCP opts are dropped after join Matthieu Baerts (NGI0) @ 2025-02-18 11:24 ` Matthieu Baerts (NGI0) 2025-02-18 12:32 ` [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ MPTCP CI 2025-02-18 16:24 ` Paolo Abeni 3 siblings, 0 replies; 6+ messages in thread From: Matthieu Baerts (NGI0) @ 2025-02-18 11:24 UTC (permalink / raw) To: mptcp; +Cc: Paolo Abeni, Matthieu Baerts (NGI0) Recently, some fallback have been initiated, while the connection was not supposed to fallback. Add a safety check with a warning to detect when an wrong attempt to fallback is being done. This should help detecting any future issues quicker. Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> --- Notes: - I guess this patch could be sent to -net as well. - We could also squash this in one of the previous commit, but because the two are needed to avoid the warning, maybe better with a dedicated commit? --- net/mptcp/protocol.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index bac5c925a72f6637e33ada9869984c5902bd6a43..3d72ca1553227cb41ba8c205f42d1f01cc264a7e 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1198,6 +1198,8 @@ static inline void __mptcp_do_fallback(struct mptcp_sock *msk) pr_debug("TCP fallback already done (msk=%p)\n", msk); return; } + if (WARN_ON_ONCE(!READ_ONCE(msk->allow_infinite_fallback))) + return; set_bit(MPTCP_FALLBACK_DONE, &msk->flags); } -- 2.47.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ 2025-02-18 11:24 [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 1/2] mptcp: reset when MPTCP opts are dropped after join Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 2/2] mptcp: safety check before fallback Matthieu Baerts (NGI0) @ 2025-02-18 12:32 ` MPTCP CI 2025-02-18 16:24 ` Paolo Abeni 3 siblings, 0 replies; 6+ messages in thread From: MPTCP CI @ 2025-02-18 12:32 UTC (permalink / raw) To: Matthieu Baerts; +Cc: mptcp Hi Matthieu, Thank you for your modifications, that's great! Our CI did some validations and here is its report: - KVM Validation: normal: Success! ✅ - KVM Validation: debug: 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/13389741751 Initiator: Patchew Applier Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/031a27795787 Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=935069 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) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ 2025-02-18 11:24 [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ Matthieu Baerts (NGI0) ` (2 preceding siblings ...) 2025-02-18 12:32 ` [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ MPTCP CI @ 2025-02-18 16:24 ` Paolo Abeni 2025-02-19 18:42 ` Matthieu Baerts 3 siblings, 1 reply; 6+ messages in thread From: Paolo Abeni @ 2025-02-18 16:24 UTC (permalink / raw) To: Matthieu Baerts (NGI0), mptcp; +Cc: Chester A. Unal On 2/18/25 12:24 PM, Matthieu Baerts (NGI0) wrote: > - Patch 1: fix issue #544 where a middlebox drops MPTCP options after a > 3WHS on the additional subflow. > > - Patch 2: a safety check is added when asking to do a fallback to do so > only when allowed. If not, a new warning will be emitted. > > Note that two new packetdrill tests have been added in a PR to cover > this case: > > https://github.com/multipath-tcp/packetdrill/pull/160 > > Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Acked-by: Paolo Abeni <pabeni@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ 2025-02-18 16:24 ` Paolo Abeni @ 2025-02-19 18:42 ` Matthieu Baerts 0 siblings, 0 replies; 6+ messages in thread From: Matthieu Baerts @ 2025-02-19 18:42 UTC (permalink / raw) To: Paolo Abeni, mptcp; +Cc: Chester A. Unal Hi Paolo, On 18/02/2025 17:24, Paolo Abeni wrote: > On 2/18/25 12:24 PM, Matthieu Baerts (NGI0) wrote: >> - Patch 1: fix issue #544 where a middlebox drops MPTCP options after a >> 3WHS on the additional subflow. >> >> - Patch 2: a safety check is added when asking to do a fallback to do so >> only when allowed. If not, a new warning will be emitted. >> >> Note that two new packetdrill tests have been added in a PR to cover >> this case: >> >> https://github.com/multipath-tcp/packetdrill/pull/160 >> >> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > > Acked-by: Paolo Abeni <pabeni@redhat.com> Thank you for this review! Now in our tree (fixes for -net): New patches for t/upstream-net and t/upstream: - 1babdda71364: mptcp: reset when MPTCP opts are dropped after join - 1e4711c4b02c: mptcp: safety check before fallback - Results: 54ac5bb2f077..aba580cd4fc8 (export-net) - Results: 4ba9db964049..3ee8e45b1642 (export) Tests are now in progress: - export-net: https://github.com/multipath-tcp/mptcp_net-next/commit/2ea4756918f65f22b82d3134485d4c2842e3400f/checks - export: https://github.com/multipath-tcp/mptcp_net-next/commit/4f345f49f9f36636d9f8408b4a30b70f602b50ae/checks Cheers, Matt -- Sponsored by the NGI0 Core fund. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-19 18:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-18 11:24 [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 1/2] mptcp: reset when MPTCP opts are dropped after join Matthieu Baerts (NGI0) 2025-02-18 11:24 ` [PATCH mptcp-net v2 2/2] mptcp: safety check before fallback Matthieu Baerts (NGI0) 2025-02-18 12:32 ` [PATCH mptcp-net v2 0/2] mptcp: reset when MPTCP opts are dropped after MPJ MPTCP CI 2025-02-18 16:24 ` Paolo Abeni 2025-02-19 18:42 ` Matthieu Baerts
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.