Re: [PATCH net 05/10] mptcp: fix snd_wnd initialization for passive socket: manual merge

From: Matthieu Baerts
Date: Fri Feb 23 2024 - 11:35:47 EST


Hi Jakub, Paolo, Stephen,

On 23/02/2024 5:14 pm, Matthieu Baerts (NGI0) wrote:
> From: Paolo Abeni <pabeni@xxxxxxxxxx>
>
> Such value should be inherited from the first subflow, but
> passive sockets always used 'rsk_rcv_wnd'.
>
> Fixes: 6f8a612a33e4 ("mptcp: keep track of advertised windows right edge")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
> Reviewed-by: Mat Martineau <martineau@xxxxxxxxxx>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
> ---
> net/mptcp/protocol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 442fa7d9b57a..2c8f931c6d5b 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3211,7 +3211,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
> msk->write_seq = subflow_req->idsn + 1;
> msk->snd_nxt = msk->write_seq;
> msk->snd_una = msk->write_seq;
> - msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd;
> + msk->wnd_end = msk->snd_nxt + tcp_sk(ssk)->snd_wnd;

Please note that this patch will conflict with the following commit from
net-next:

3f83d8a77eee ("mptcp: fix more tx path fields initialization")

That's because this commit modifies the same line as the one modified
here. We cannot avoid a conflict here. To fix it, please use
'WRITE_ONCE()' with the new line from -net:

WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd);

A 3-way diff has been attached to this email.

> msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq;
> mptcp_init_sched(msk, mptcp_sk(sk)->sched);
>
>

Cheers,
Matt
--
Sponsored by the NGI0 Core fund.diff --cc net/mptcp/protocol.c
index 7833a49f6214,9df4eaddfd48..000000000000
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@@ -3242,25 -3204,18 +3247,25 @@@ struct sock *mptcp_sk_clone_init(const

__mptcp_init_sock(nsk);

+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
+ if (nsk->sk_family == AF_INET6)
+ mptcp_copy_ip6_options(nsk, sk);
+ else
+#endif
+ mptcp_copy_ip_options(nsk, sk);
+
msk = mptcp_sk(nsk);
- msk->local_key = subflow_req->local_key;
- msk->token = subflow_req->token;
+ WRITE_ONCE(msk->local_key, subflow_req->local_key);
+ WRITE_ONCE(msk->token, subflow_req->token);
msk->in_accept_queue = 1;
WRITE_ONCE(msk->fully_established, false);
if (mp_opt->suboptions & OPTION_MPTCP_CSUMREQD)
WRITE_ONCE(msk->csum_enabled, true);

- msk->write_seq = subflow_req->idsn + 1;
- msk->snd_nxt = msk->write_seq;
- msk->snd_una = msk->write_seq;
- msk->wnd_end = msk->snd_nxt + tcp_sk(ssk)->snd_wnd;
+ WRITE_ONCE(msk->write_seq, subflow_req->idsn + 1);
+ WRITE_ONCE(msk->snd_nxt, msk->write_seq);
+ WRITE_ONCE(msk->snd_una, msk->write_seq);
- WRITE_ONCE(msk->wnd_end, msk->snd_nxt + req->rsk_rcv_wnd);
++ WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd);
msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq;
mptcp_init_sched(msk, mptcp_sk(sk)->sched);