mptcp: a couple of fixes
Subsystems (2)
Paolo Abeni
maintainercover mptcp: a couple of fixes
The first patch addresses a recently filed issue, 2nd one is due to code inspection while investigating the mentioned issue.
Paolo Abeni (2):
mptcp: do not fallback when OoO is present
mptcp: do not drop partial packets.
net/mptcp/protocol.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
Signature · 1 line
2.51.1
Paolo Abeni
maintainerPATCH 1/2 mptcp: do not fallback when OoO is present
In case of DSS corruption, the MPTCP protocol tries to avoid the subflow reset if fallback is possible. Such corruptions happen in the receive path; to ensure fallback is possible the stack additionally need to check for OoO data, otherwise the fallback will break the data stream.
---
Note: this does not avoid the WARN(), but fixes the inconsistend read() behavior; the ingress data is OoO, we should not ack it
--- net/mptcp/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +2 -1
@@ -646,7 +646,8 @@ static void mptcp_check_data_fin(struct sock *sk)static void mptcp_dss_corruption (struct mptcp_sock *msk,struct sock *ssk) { -if (!mptcp_try_fallback (ssk,MPTCP_MIB_DSSCORRUPTIONFALLBACK )) { +if (!RB_EMPTY_ROOT (&msk->out_of_order_queue) || + !mptcp_try_fallback (ssk,MPTCP_MIB_DSSCORRUPTIONFALLBACK )) {MPTCP_INC_STATS (sock_net (ssk),MPTCP_MIB_DSSCORRUPTIONRESET );mptcp_subflow_reset (ssk); }
Signature · 1 line
2.51.1
Paolo Abeni
maintainerPATCH 2/2 mptcp: do not drop partial packets.
In reply to Paolo AbeniCurrently MPTCP drops partial packets for no good reason at all. Instead we should just skip the already acked bytes.
Also add a missing check for zero window.
---
Note: this does not avoid the WARN(), but makes the received data avail to user-space.
We should also add a MIB for zerowin drop, but that should be a follow-up patch, I think.
--- net/mptcp/protocol.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +20 -7
@@ -378,6 +378,10 @@ static bool __mptcp_move_skb(struct sock *sk, struct sk_buff *skb)mptcp_borrow_fwdmem (sk, skb); +/* Check for zero window.*/ +if (atomic64_read (&msk->rcv_wnd_sent) == msk->ack_seq) + goto drop; +if (MPTCP_SKB_CB (skb)->map_seq == msk->ack_seq) {/* in sequence */ msk->bytes_received += copy_len;
@@ -386,18 +390,27 @@ static bool __mptcp_move_skb(struct sock *sk, struct sk_buff *skb)if (tail &&mptcp_try_coalesce (sk, tail, skb))return true; -skb_set_owner_r (skb, sk); -__skb_queue_tail (&sk->sk_receive_queue, skb); -return true; + goto enqueue; }else if (after64 (MPTCP_SKB_CB (skb)->map_seq, msk->ack_seq)) {mptcp_data_queue_ofo (msk, skb);return false; } -/* old data, keep it simple and drop the whole pkt, sender -* will retransmit as needed, if needed. -*/ -MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_DUPDATA ); +/* Check for old data. */ +if (!after64 (MPTCP_SKB_CB (skb)->end_seq, msk->ack_seq)) { +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_DUPDATA ); + goto drop; + } + +/* Partial packet, seq < rcv_next < end_seq. */ +MPTCP_SKB_CB (skb)->offset += msk->ack_seq -MPTCP_SKB_CB (skb)->map_seq; + +enqueue: +skb_set_owner_r (skb, sk); +__skb_queue_tail (&sk->sk_receive_queue, skb); +return true; + +drop:mptcp_drop (sk, skb);return false; }
Signature · 1 line
2.51.1
Hi Paolo,
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): Unstable: 10 failed test(s): packetdrill_dss packetdrill_fastclose packetdrill_fastopen packetdrill_mp_join packetdrill_mp_prio packetdrill_mp_reset packetdrill_sockopts packetdrill_syscalls selftest_mptcp_connect selftest_mptcp_sockopt - Critical: 85 Call Trace(s) - Critical: Global Timeout ❌
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 11 failed test(s): packetdrill_dss packetdrill_fastclose packetdrill_fastopen packetdrill_mp_join packetdrill_mp_prio packetdrill_mp_reset packetdrill_sockopts packetdrill_syscalls selftest_mptcp_connect_checksum selftest_mptcp_connect_mmap selftest_mptcp_sockopt 🔴
- 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/19235857403
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/5213638ed0df
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1021627
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)