From: Paolo Abeni <pabeni@redhat.com>
To: quanyeyang@proton.me, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net 1/2] mptcp: reset msk state on early connect failure
Date: Thu, 10 Sep 2026 17:57:03 +0200 [thread overview]
Message-ID: <b2107d7d-6202-42ec-a431-ec2fae7db53e@redhat.com> (raw)
In-Reply-To: <20260910-mptcp-connect-undo-net-v1-1-446e4a4ae3e7@proton.me>
On 9/10/26 2:23 PM, Quanye Yang via B4 Relay wrote:
> mptcp_connect() can fall back before the subflow SYN is sent, for
> example when the netns is in an MPTCP blackhole, token allocation
> fails, or MD5SIG is in use. If the subsequent subflow connect()
> fails immediately (EAFNOSUPPORT, ENETUNREACH, ...),
> __inet_stream_connect() returns while the socket is still
> SS_UNCONNECTED and never calls ->disconnect().
>
> The error path only dropped the token and moved the msk back to
> TCP_CLOSE. MPTCP_FALLBACK_DONE, allow_subflows and
> request_mptcp were left as after early fallback, so a later
> connect() on the same fd stayed TCP-only.
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/633
> Fixes: 0235d075a592 ("mptcp: mark as fallback even early ones")
> Signed-off-by: Quanye Yang <quanyeyang@proton.me>
> ---
> net/mptcp/protocol.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e1f08f71cdb1..ad476d29bf3d 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -4129,6 +4129,24 @@ static int mptcp_ioctl(struct sock *sk, int cmd, int *karg)
> return 0;
> }
>
> +static void mptcp_connect_undo(struct sock *sk)
> +{
> + struct mptcp_sock *msk = mptcp_sk(sk);
> + struct sock *ssk = msk->first;
> +
> + mptcp_token_destroy(msk);
> + mptcp_set_state(sk, TCP_CLOSE);
> +
> + spin_lock_bh(&msk->fallback_lock);
> + msk->allow_subflows = true;
> + msk->allow_infinite_fallback = true;
> + clear_bit(MPTCP_FALLBACK_DONE, &msk->flags);
> + spin_unlock_bh(&msk->fallback_lock);
> +
> + if (ssk)
> + mptcp_subflow_ctx_reset(mptcp_subflow_ctx(ssk));
Overall LGTM, but I think ssk should always be != NULL. Also it possibly
make sense to avoid entirely the additional helper, just open code it
into the mptcp_connect() error path.
/P
next prev parent reply other threads:[~2026-09-10 15:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 12:23 [PATCH mptcp-net 0/2] mptcp: fix leftover fallback after failed connect Quanye Yang
2026-09-10 12:23 ` Quanye Yang via B4 Relay
2026-09-10 12:23 ` [PATCH mptcp-net 1/2] mptcp: reset msk state on early connect failure Quanye Yang
2026-09-10 12:23 ` Quanye Yang via B4 Relay
2026-09-10 15:57 ` Paolo Abeni [this message]
2026-09-10 12:23 ` [PATCH mptcp-net 2/2] selftests: mptcp: join: retry connect after early fallback Quanye Yang
2026-09-10 12:23 ` Quanye Yang via B4 Relay
2026-09-10 13:27 ` [PATCH mptcp-net 0/2] mptcp: fix leftover fallback after failed connect MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2107d7d-6202-42ec-a431-ec2fae7db53e@redhat.com \
--to=pabeni@redhat.com \
--cc=mptcp@lists.linux.dev \
--cc=quanyeyang@proton.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.