All of lore.kernel.org
 help / color / mirror / Atom feed
From: gang.yan@linux.dev
To: "Abdul Wasey" <w453y.me@gmail.com>, mptcp@lists.linux.dev
Cc: "Matthieu Baerts" <matttbe@kernel.org>,
	"Mat Martineau" <martineau@kernel.org>,
	"Geliang Tang" <geliang@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Mohit P. Tahiliani" <tahiliani@nitk.edu.in>,
	stable@vger.kernel.org
Subject: Re: [PATCH mptcp-net v10 1/2] mptcp: pm: in-kernel: fullmesh: skip closed subflows
Date: Sat, 28 Nov 2026 00:02:32 +0000	[thread overview]
Message-ID: <46df7273bf182ac9e1666c706d3f56d3af8d0b59@linux.dev> (raw)
In-Reply-To: <20261127213756.4154872-2-w453y.me@gmail.com>

November 28, 2026 at 5:37 AM, "Abdul Wasey" <w453y.me@gmail.com mailto:w453y.me@gmail.com?to=%22Abdul%20Wasey%22%20%3Cw453y.me%40gmail.com%3E > wrote:


> 
> With fullmesh endpoints, if the endpoint used by the initial subflow is
> removed and then added back, no new subflow is created from it: the
> connection never uses this local address again.
> 
> The initial subflow is kept in the conn_list once closed. If it was
> still established when closed, it keeps the local ID 0, which is also
> the ID used by the re-added endpoint, and
> fill_remote_addresses_fullmesh() then marks its remote ID as
> unavailable. If it was already in TCP_CLOSE, e.g. after a reset, it is
> disconnected and its context is reset: the 'closing' flag and the remote
> ID are cleared, and its destination port is zeroed. It is then picked as
> a remote address, with the port 0 and the ID 0, which also marks the
> remote ID 0 as unavailable. In both cases, when the peer has a single
> address, all subflows use the remote ID 0, and no valid remote address
> is left.
> 
> Skip the subflows being closed or in TCP_CLOSE state, both when looking
> for the remote IDs already in use and when picking the remote addresses.
> __mptcp_subflow_active() cannot be used here: subflows still being
> established have to keep their remote ID marked as in use, to avoid
> creating duplicated subflows.
> 
> When no subflow is left to take the remote ID 0 address from, e.g. when
> the initial subflow was the only one, use fill_remote_addr(), as for
> non-fullmesh endpoints: it takes the remote address of the MPTCP socket.
> Before, re-adding the initial endpoint created no subflow in this case
> either, and another endpoint only worked by picking the closed initial
> subflow.
> 
> Without the fullmesh flag, the remote address is taken from the MPTCP
> socket, so this issue is specific to fullmesh endpoints.
> 
> Fixes: 045e9d812868 ("mptcp: fix duplicate subflow creation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdul Wasey <w453y.me@gmail.com>
> ---
>  net/mptcp/pm_kernel.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
> index 88610aed45a2..f1e1576fb375 100644
> --- a/net/mptcp/pm_kernel.c
> +++ b/net/mptcp/pm_kernel.c
> @@ -199,6 +199,13 @@ fill_remote_addr(struct mptcp_sock *msk, struct mptcp_addr_info *local,
>  return 1;
>  }
>  
> +static bool mptcp_subflow_is_closed(struct mptcp_subflow_context *subflow)
> +{
> + struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> +
> + return subflow->closing || inet_sk_state_load(ssk) == TCP_CLOSE;
> +}
> +
>  static unsigned int
>  fill_remote_addresses_fullmesh(struct mptcp_sock *msk,
>  struct mptcp_addr_info *local,
> @@ -216,11 +223,18 @@ fill_remote_addresses_fullmesh(struct mptcp_sock *msk,
>  * already created by incoming ADD_ADDR
>  */
>  bitmap_zero(unavail_id, MPTCP_PM_MAX_ADDR_ID + 1);
> - mptcp_for_each_subflow(msk, subflow)
> + mptcp_for_each_subflow(msk, subflow) {
> + if (mptcp_subflow_is_closed(subflow))
> + continue;
> +
>  if (READ_ONCE(subflow->local_id) == local->id)
>  __set_bit(subflow->remote_id, unavail_id);
> + }
>  
>  mptcp_for_each_subflow(msk, subflow) {
> + if (mptcp_subflow_is_closed(subflow))
> + continue;
> +
>  ssk = mptcp_subflow_tcp_sock(subflow);
>  mptcp_remote_address((struct sock_common *)ssk, &addrs[i]);
>  addrs[i].id = READ_ONCE(subflow->remote_id);
> @@ -243,6 +257,11 @@ fill_remote_addresses_fullmesh(struct mptcp_sock *msk,
>  break;
>  }
>  

Hi Abdul,

Thanks for the new version.

Reviewed-by: Gang Yan <yangang@kylinos.cn>


> + /* If the initial subflow is closed, use fill_remote_addr */
> + if (!test_bit(0, unavail_id) && i < addrs_size &&
> + msk->pm.extra_subflows < limit_extra_subflows)
> + i += fill_remote_addr(msk, local, &addrs[i]);
> +
>  return i;
>  }
>  
> -- 
> 2.43.0
>

  reply	other threads:[~2026-11-28  0:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 21:37 [PATCH mptcp-net v10 0/2] mptcp: pm: in-kernel: fullmesh: re-add of the initial subflow endp Abdul Wasey
2026-11-27 21:37 ` [PATCH mptcp-net v10 1/2] mptcp: pm: in-kernel: fullmesh: skip closed subflows Abdul Wasey
2026-11-28  0:02   ` gang.yan [this message]
2026-11-27 21:37 ` [PATCH mptcp-net v10 2/2] selftests: mptcp: join: re-add the initial subflow endp with fullmesh Abdul Wasey
2026-11-27 22:56 ` [PATCH mptcp-net v10 0/2] mptcp: pm: in-kernel: fullmesh: re-add of the initial subflow endp 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=46df7273bf182ac9e1666c706d3f56d3af8d0b59@linux.dev \
    --to=gang.yan@linux.dev \
    --cc=geliang@kernel.org \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tahiliani@nitk.edu.in \
    --cc=w453y.me@gmail.com \
    /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.