Skip to content

Commit 5e15395

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: fix ack generation for fallback msk
mptcp_cleanup_rbuf() needs to know the last most recent, mptcp-level rcv_wnd sent, and such information is tracked into the msk->old_wspace field, updated at ack transmission time by mptcp_write_options(). Fallback socket do not add any mptcp options, such helper is never invoked, and msk->old_wspace value remain stale. That in turn makes ack generation at recvmsg() time quite random. Address the issue ensuring mptcp_write_options() is invoked even for fallback sockets, and just update the needed info in such a case. The issue went unnoticed for a long time, as mptcp currently overshots the fallback socket receive buffer autotune significantly. It is going to change in the near future. Fixes: e385960 ("mptcp: better msk receive window updates") Cc: stable@vger.kernel.org Closes: multipath-tcp/mptcp_net-next#594 Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Geliang Tang <geliang@kernel.org> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20251118-net-mptcp-misc-fixes-6-18-rc6-v1-1-806d3781c95f@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent e31a11b commit 5e15395

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

net/mptcp/options.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,11 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
838838

839839
opts->suboptions = 0;
840840

841+
/* Force later mptcp_write_options(), but do not use any actual
842+
* option space.
843+
*/
841844
if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb)))
842-
return false;
845+
return true;
843846

844847
if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) {
845848
if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) ||
@@ -1319,6 +1322,20 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
13191322
WRITE_ONCE(msk->old_wspace, tp->rcv_wnd);
13201323
}
13211324

1325+
static void mptcp_track_rwin(struct tcp_sock *tp)
1326+
{
1327+
const struct sock *ssk = (const struct sock *)tp;
1328+
struct mptcp_subflow_context *subflow;
1329+
struct mptcp_sock *msk;
1330+
1331+
if (!ssk)
1332+
return;
1333+
1334+
subflow = mptcp_subflow_ctx(ssk);
1335+
msk = mptcp_sk(subflow->conn);
1336+
WRITE_ONCE(msk->old_wspace, tp->rcv_wnd);
1337+
}
1338+
13221339
__sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum)
13231340
{
13241341
struct csum_pseudo_header header;
@@ -1611,6 +1628,10 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
16111628
opts->reset_transient,
16121629
opts->reset_reason);
16131630
return;
1631+
} else if (unlikely(!opts->suboptions)) {
1632+
/* Fallback to TCP */
1633+
mptcp_track_rwin(tp);
1634+
return;
16141635
}
16151636

16161637
if (OPTION_MPTCP_PRIO & opts->suboptions) {

0 commit comments

Comments
 (0)