From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A62C441BA97 for ; Thu, 6 Aug 2026 08:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005995; cv=none; b=VJ9o/isngoXhvDH7ES8tm3U41ONXZhmtOmARmS8sPWM7S28326JDymunkJ3jckHhad7tlq6r8ANS6LpIZeGrMWA/J3u5S1PYvEo2BTc6iCCegzwmcx5hgecY1thwH1MR1ormO41/J0nmS89yC4voCir9FDHK10yYY1YIJ4R9/g0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005995; c=relaxed/simple; bh=w3VL+06PFXtlzaaJUTYcXQoVH6sazoOUcH/vdi6VwUc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T1MR611fBOZlcTmq5LpQSTUsGfNFk+d0+VcxOPyNx6FFxi6dlyORx0zqgMg5fjwEgww4mm3xtr4rPSRqQGJtqjgLfJZN8pVFl2fumjT+5vMVOwidLFXVWHzFMWu4GB1wxgb3k2aiz5ZuTds+u80p8XR72rFqpIEwpF13eTWgUfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cDId5D7d; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cDId5D7d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 234DE1F00A3A; Thu, 6 Aug 2026 08:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005992; bh=Ykg/MN484lmK5vyBTCgl2AzeDbhvxxHSS8iNw+9RwjM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=cDId5D7dBRCBKXi0Y+Sqx++A5vwyer4rl5CdiNAnPzYu4Sv7kcMRcG4BK7fnXSMCi +QnjLP3vf21KbwQnNC+xSdZEKx0WtqkrYpxJYi/EO2evvHW84LiRaBL5UtMp4+rkf6 p4/i/E/aCn+FB/TZzeUkKDiqUv7cqeBomvDx6y9u1OjJeEo+TeVDmBcJsPCaxCGkQi Y9CoVbtlAeQ1aZAkMMIhT4AwkNgKbBit7f3r6TRafddioMxEzAsXWLEH20DaLUC3Rm tOekHEN9WjMCw7V8ayvpoxgt5K1O6yhVF2vPUeo+oe5bJE2pYn1Xa7oY2l2DD9NwCs g8ot68TVsnn9g== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:18 +0200 Subject: [PATCH mptcp-net v2 1/6] mptcp: pm: userspace: properly handle the ID0 case Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-1-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6412; i=matttbe@kernel.org; h=from:subject:message-id; bh=w3VL+06PFXtlzaaJUTYcXQoVH6sazoOUcH/vdi6VwUc=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPB84GvHv0JlfV5kuHHNKzT2m52BiRIVGcNLzJ4VWZ 07Me6PUUcrCIMbFICumyCLdFpk/83kVb4mXnwXMHFYmkCEMXJwCMJGtHgz/cziC+rk/nctfve1W zYEeX+eYIP1JC9+u03saHJ8y30v7CsN/lzeXvtx1zvb/+EQxZvv7fcs9D5cbN5+Y3nR67ks/58n X+QE= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 In MPTCP, the local address and port used by the initial subflow has the ID "0". It means that when this address and port are used for some operations -- e.g. creating a new subflow -- they should be linked to the ID0, and no other addresses and ports can get this special ID while the initial IP address and port is used. So far, the ID0 case was handled as an exception: each operation dealing with the ID0 had to be handled differently. Except that this was done in some places like removing the ID0, but not everywhere the list of local addresses was iterated. This way of handling the ID0 is prone to bugs and harder to maintain. Instead, the initial local address corresponding to ID0 can be added to the list when a connection is created, and the number of exceptions can be dramatically reduced, handling this case like any others with existing local address. The existing exceptions are going to be removed in the following patches. Three new small ones are required: - To match the ID0 entry when the port is not specified: the initial port is used, like before. - Not to match the ID0 entry when a new ID is required, and the address doesn't match. - For the local_addr_used variable: this variable represents the number of extra addresses, not including the one linked to the initial subflow. The usage is similar to the one with the in-kernel PM. In fact, the last two exceptions were also missing before when an entry for the ID0 was present in the list, e.g. when a subflow from the same address as the ID0 one was created. The main downside of this is that each connection will now have one allocated entry added the list, possibly one more than before. But that seems OK to do that with the userspace PM where the path management is done per connection, with many Netlink messages sent back and forth. Adding a few more bytes per connections on such setup seems acceptable. Fixes: 4638de5aefe5 ("mptcp: handle local addrs announced by userspace PMs") Signed-off-by: Matthieu Baerts (NGI0) --- v2: - List new exceptions in the commit message. - Handle local_addr_used with the ID0 case properly. (Sashiko) - Handle needs_id where the addrs don't match, but the IDs (0) does. (S) --- net/mptcp/pm.c | 4 ++++ net/mptcp/pm_userspace.c | 45 ++++++++++++++++++++++++++++++++++++++++----- net/mptcp/protocol.h | 1 + 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 5e499ec1c50a..4ff12fe25d0b 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -551,6 +551,10 @@ void mptcp_pm_new_connection(struct mptcp_sock *msk, c= onst struct sock *ssk, int pr_debug("msk=3D%p, token=3D%u side=3D%d\n", msk, READ_ONCE(msk->token), = server_side); =20 WRITE_ONCE(pm->server_side, server_side); + + if (mptcp_pm_is_userspace(msk)) + mptcp_pm_userspace_created(msk, ssk); + mptcp_event(MPTCP_EVENT_CREATED, msk, ssk, GFP_ATOMIC); } =20 diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 102d6d12e0de..b15f8908d503 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -59,10 +59,19 @@ static int mptcp_userspace_pm_append_new_local_addr(str= uct mptcp_sock *msk, goto append_err; } mptcp_for_each_userspace_pm_addr(msk, e) { - addr_match =3D mptcp_addresses_equal(&e->addr, &entry->addr, true); - if (addr_match && entry->addr.id =3D=3D 0 && needs_id) - entry->addr.id =3D e->addr.id; - id_match =3D (e->addr.id =3D=3D entry->addr.id); + /* allow matching ID0 when no port is specified */ + addr_match =3D mptcp_addresses_equal(&e->addr, &entry->addr, + e->addr.id !=3D 0 || + entry->addr.port !=3D 0); + if (entry->addr.id =3D=3D 0 && needs_id) { + /* If ID needed, only match ID0 if addr match */ + if (addr_match) { + entry->addr.id =3D e->addr.id; + id_match =3D true; + } + } else { + id_match =3D (e->addr.id =3D=3D entry->addr.id); + } if (addr_match || id_match) break; __set_bit(e->addr.id, id_bitmap); @@ -104,17 +113,24 @@ static int mptcp_userspace_pm_delete_local_addr(struc= t mptcp_sock *msk, { struct sock *sk =3D (struct sock *)msk; struct mptcp_pm_addr_entry *entry; + bool init_id0; =20 entry =3D mptcp_userspace_pm_lookup_addr(msk, &addr->addr); if (!entry) return -EINVAL; =20 + /* The initial address ID doesn't increment local_addr_used */ + init_id0 =3D entry->addr.id =3D=3D 0 && entry->addr.port =3D=3D 0; + /* TODO: a refcount is needed because the entry can * be used multiple times (e.g. fullmesh mode). */ list_del_rcu(&entry->list); sock_kfree_s(sk, entry, sizeof(*entry)); - msk->pm.local_addr_used--; + + if (!init_id0) + msk->pm.local_addr_used--; + return 0; } =20 @@ -696,6 +712,25 @@ int mptcp_userspace_pm_get_addr(u8 id, struct mptcp_pm= _addr_entry *addr, return ret; } =20 +/* Add the initial local address (ID0) to the local list: easier that way = */ +void mptcp_pm_userspace_created(struct mptcp_sock *msk, const struct sock = *ssk) +{ + struct mptcp_pm_addr_entry *entry; + + entry =3D sock_kmalloc((struct sock *)msk, sizeof(*entry), GFP_ATOMIC); + /* Fine not to handle the ID0 case in memory pressure */ + if (!entry) + return; + + memset(entry, 0, sizeof(*entry)); + mptcp_local_address((struct sock_common *)ssk, &entry->addr); + + spin_lock_bh(&msk->pm.lock); + list_add_tail_rcu(&entry->list, &msk->pm.userspace_pm_local_addr_list); + /* The initial address ID doesn't increment local_addr_used */ + spin_unlock_bh(&msk->pm.lock); +} + static struct mptcp_pm_ops mptcp_pm_userspace =3D { .get_local_id =3D mptcp_pm_userspace_get_local_id, .get_priority =3D mptcp_pm_userspace_get_priority, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 2f5b2f671c44..3e6d08b89476 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1238,6 +1238,7 @@ void __init mptcp_pm_userspace_register(void); void __init mptcp_pm_nl_init(void); void mptcp_pm_worker(struct mptcp_sock *msk); void __mptcp_pm_kernel_worker(struct mptcp_sock *msk); +void mptcp_pm_userspace_created(struct mptcp_sock *msk, const struct sock = *ssk); u8 mptcp_pm_get_endp_signal_max(const struct mptcp_sock *msk); u8 mptcp_pm_get_endp_subflow_max(const struct mptcp_sock *msk); u8 mptcp_pm_get_endp_laminar_max(const struct mptcp_sock *msk); --=20 2.53.0 From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EF8740BCA0 for ; Thu, 6 Aug 2026 08:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005994; cv=none; b=A/6DY4cSwYoY+w0GrZkbN+rjnZwqUUA5WU1SBgtCa9Qj19qY2F63a8sMQsTBH14TcRqZNIVqxxQ58cj/P8i6fo5H9k3z9Pe/uDUT8BBpcV6C1my73CTIqI6n6NS0WtWHaKfVrrqnpcVbDY0EZxTw2JvTMRA25rSHLgokggY5Xlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005994; c=relaxed/simple; bh=WmJNy5ZTm7vIvbOqqfvmFfGJ0JSE0UVrJeQIEdL+Iuc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bxHFDtsHHs5rp49ak8Bxv3cNwuMvXTYzUY+p+k+1Y6d+kDo4HrvYryGF1zoZyd3IaS4ldjrA1ONU3O10kM9Sm987xuzsLi27ss6SsLzM7XEYTPsikDF8veMXifs/tlt42fAcvReZ5iDG62atrtr6MwCWpIhLESv05AYEqCcmf7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PAOt4tGx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PAOt4tGx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBA221F00A3D; Thu, 6 Aug 2026 08:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005993; bh=W/0zVcLyv/v+LWUJTNpgjxsoiBumkOPpWFceJO+aHIY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=PAOt4tGx2HiG1WF7sLpVw86TBM+AggojH/51f3haj3wa4y6TbgFitlq0ecMPSuTFU csbXGlg64cpbx9U9brgAh2nwuZOGSIs2VKbDhQxP+Y7OgQ2SrerUtqvk/on3QjgpJ/ raIY5W5F/kX4xm0IDLeBdl0aHcMP4+2Di0Fhb96KE/kD9yzYV93WwheIUYBE9+LdGt vYqI2v+6H8WteNCQHEH9AlHsDQktKxlXd8NeDO76NreDlyGuQOn4x5/7zriBBrbZ4h ObVmiJj3xz9aKg0CQbq+Exs6ARMFi109E23h+uXEuYaAExXHSZf3xM5T9G5zb2fED6 LBh8Hox0rvm5A== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:19 +0200 Subject: [PATCH mptcp-net v2 2/6] mptcp: pm: userspace: allow announcing ID0 addr Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-2-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1719; i=matttbe@kernel.org; h=from:subject:message-id; bh=WmJNy5ZTm7vIvbOqqfvmFfGJ0JSE0UVrJeQIEdL+Iuc=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPB+y6z63aNv0oueGBP/msjzBzq97n9g4ckjMv/3py nO2vugLHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABNRP8nwV3QDu8rDDdIXgo4n xnu+/HBTJ2X5z2e59XyxW8LPPJZwXMHIsHqhufo5TsmdzWt0Ve2nJ3ye8r2aZfo/NZXQ3oXz5oX qMwIA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It is valid to announce an address with the ID0, the in-kernel PM allows to do that when re-announcing the initial IP address after having been deleted. So no need to have such exception. If the ID is set to 0, but the address doesn't match with the existing one, an error will be returned by mptcp_userspace_pm_append_new_local_addr(). Note that once removed, the ID0 entry could be replaced by another IP address. The RFC8684 doesn't specify this specific case with ID0, but it says [1]: "A host wishing to replace an existing Address ID MUST first remove the existing one". In these unclear conditions, better to let the responsibility to the userspace daemon to pick the same IP or another one, similar to what was in place before. Fixes: 9ab4807c84a4 ("mptcp: netlink: Add MPTCP_PM_CMD_ANNOUNCE") Link: https://datatracker.ietf.org/doc/html/rfc8684#section-3.4.1-13 [1] Signed-off-by: Matthieu Baerts (NGI0) --- v2: Add note about re-using the ID0 with another address (Sashiko) --- net/mptcp/pm_userspace.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index b15f8908d503..eaeaf6fe3b58 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -229,12 +229,6 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, str= uct genl_info *info) if (err < 0) goto announce_err; =20 - if (addr_val.addr.id =3D=3D 0) { - NL_SET_ERR_MSG_ATTR(info->extack, addr, "invalid addr id"); - err =3D -EINVAL; - goto announce_err; - } - if (!(addr_val.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { NL_SET_ERR_MSG_ATTR(info->extack, addr, "invalid addr flags"); err =3D -EINVAL; --=20 2.53.0 From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 912C341DE1C for ; Thu, 6 Aug 2026 08:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005995; cv=none; b=Q8AoFPHllonxZ7hdEBTenA7JjPAlQMVcDtDTK8Xw4KeOz/IZayLi/4iiGy7p5XC2+EjVB7BdIYP6idzvlTTpMQ3TOjtR60ILXkOrBP1VfDMqikJl4m6ZLLWu/5UqoBq6xn9ef1fpuvyYuH6KSZwl4MfHwkrV3KoMVM2vjZG8Ano= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005995; c=relaxed/simple; bh=5o84nJAOa1lyB4CncDxjP8OMyy/YDj6ib88KoJcwD8k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MbAHs/qAwh+D1MsE2p6q4iuk1Ot7tj7PbAzGIzkECapY8v5Kr0U0EeSX6zXXMp3yVSWElDAae3XqCxoG2bwTc3Fs2IYBSVg2ybzYBZSWLau8jI0vQxUJqsKkJ1i4ZCpH37VZT5Q8r+MeUXr4+Y4Nqyo68O64W29I0AD6lzMyOTU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FmsxFXKf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FmsxFXKf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF9BC1F000E9; Thu, 6 Aug 2026 08:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005994; bh=5wihXWMrCzAKxCwX6jI7IhUlKiVuP/ls/W+qo3xvXWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=FmsxFXKfUw6k6S3vpWyQBjABcFRrwC5Qsanpeu85H2/iVmqCtbcu4iUcqvdDgNg3K U/8uZCqqMRQtbVNLQj8th/+3VUO2kIQPTxFL2IRXUUW1JFtKu+ZmPmIuLlqSHzv7dO Y13JRUTH6r4+yqBS9C7mhH9ksL2IndV7PhXL9CHRY7pXJi29ePNMzsZzPv5nS9SP3j pBEC7nAbY2WdQzIcu0xEbK7VXRDBczGsjG7R0U9gUo/6PuGyV9A10ocNqQFev3Dt5X dB7E3aW8/+5y9SqQ7iwsoBjIP28/58ndqcJyt1ENoKsVdPadw14hG8Ua3t+gr2YQH+ QYeM6GcqVfvrQ== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:20 +0200 Subject: [PATCH mptcp-net v2 3/6] mptcp: pm: userspace: no ID0 exception for RM_ADDR Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-3-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1821; i=matttbe@kernel.org; h=from:subject:message-id; bh=5o84nJAOa1lyB4CncDxjP8OMyy/YDj6ib88KoJcwD8k=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPB9tWBr2wUQv/7l4xOuLzr94yh29tkbOzlsVvX/74 TNqAmtnd5SyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAEwkZjIjw7nnE0r/3ZwcYnyx TuPF7aUnveY2si1z3hxuKrGoU/DtkyOMDOvZl3b/XRfiu1Rv0eL3V//cfiYZdN9eUU0u6OPj4uO SLiwA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 After the first patch of this series, the initial ID0 address is present in the local addr list when the connection has been created. Then, no need to have an exception to delete ID0, this can be done like with other IDs. Fixes: 84c531f54ad9 ("mptcp: userspace pm send RM_ADDR for ID 0") Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index eaeaf6fe3b58..359ad5acd836 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -260,37 +260,6 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, str= uct genl_info *info) return err; } =20 -static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *ms= k) -{ - struct mptcp_rm_list list =3D { .nr =3D 0 }; - struct mptcp_subflow_context *subflow; - struct sock *sk =3D (struct sock *)msk; - bool has_id_0 =3D false; - int err =3D -EINVAL; - - lock_sock(sk); - mptcp_for_each_subflow(msk, subflow) { - if (READ_ONCE(subflow->local_id) =3D=3D 0) { - has_id_0 =3D true; - break; - } - } - if (!has_id_0) - goto remove_err; - - list.ids[list.nr++] =3D 0; - - spin_lock_bh(&msk->pm.lock); - mptcp_pm_remove_addr(msk, &list); - spin_unlock_bh(&msk->pm.lock); - - err =3D 0; - -remove_err: - release_sock(sk); - return err; -} - void mptcp_pm_remove_addr_entry(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry) { @@ -332,11 +301,6 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struc= t genl_info *info) =20 sk =3D (struct sock *)msk; =20 - if (id_val =3D=3D 0) { - err =3D mptcp_userspace_pm_remove_id_zero_address(msk); - goto out; - } - lock_sock(sk); =20 spin_lock_bh(&msk->pm.lock); --=20 2.53.0 From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CDD7231832 for ; Thu, 6 Aug 2026 08:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005996; cv=none; b=pCvng66PJn8WflBcvnebFLgnfI/gpzCo41K6NhBNs0IhWyuoseOsEhYoopahmVk2oyRQivkiXMmJxdZHG/JPOQuXxyvsljlmtO8tcJmerE7KJZ0BUVqLlQf9HMN1hhWrWB+YkqUrc8l26eRqrMijrHz6uMcdKoZ6bs86XKp/cNU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005996; c=relaxed/simple; bh=DEz0P9GssJ3vBU1q+8lqEbv/bQF4f/eGaiKLVs8Mnro=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R4JGkhMAipBzPd9uOyEsbsYrXFbNZFU/iEGEjwrv0QuGmGuoMnxoxGEMV1u+Csidp96lRAu0rtfCaptAjQiqM4eIsvrV7e+tf0yAEr6BSWNH7XYTHS5+GkiB5rBAuItEXa9BaYS9ZdW8xcAxLGl4pzqpwlVj8QL4vUw1IiHexro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m9lU6yBz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m9lU6yBz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 938391F00A3E; Thu, 6 Aug 2026 08:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005995; bh=k4bj4mpDpGWsqGh6Nevo5xHgWGWvKG0+OM9F+yiqC3E=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=m9lU6yBzvjAYXNZAl01LAXuTOaQC/Y6tw8F93a41pyMkOocVw6qEaJsQbMVs1uTRm Zb+S7tZ5Of6kP88GwGv0CKfKO4Tuam+0569z2XlOnbZD+4f3iPEzNzDDPGEahnoU3u P9ePD43bi4yKWNRpfw91LvG2c1e3+aaD6Un7bAuRjTUUXQwEiFhniFENhBj7wH+4bl Mkr1VXtkCy/MlIrxQNZPnx0e1f4aBPghCKwfCW4UkHCNIUfyolsZ0cy/lHU12ha2Hh On9mpZdzk4/sugJsanVdZbDdWLOoGaDhQRiQzx8lznJtxwia/CGvYOR6vficl9bheE iDhGIB/X5fuKw== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:21 +0200 Subject: [PATCH mptcp-net v2 4/6] mptcp: pm: userspace: don't dump initial ID0 Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-4-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1246; i=matttbe@kernel.org; h=from:subject:message-id; bh=DEz0P9GssJ3vBU1q+8lqEbv/bQF4f/eGaiKLVs8Mnro=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPB93/97EeDAh68mCXR9O5LQp5Ultd9+6pEl8ht+mL 8xcaw8zdJSyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAExkbiojw+6lfhtig55deNXZ 9q79SHGn4xfBxpR9k3jvrWB1+6J/nZ3hD99bm4aaebP52d+V+NUF/CrcoDYh7lSbvqB1pPHeQq0 9rAA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 After the first patch of this series, the initial ID0 address is present in the local addr list when the connection has been created. Not to change the previous behaviour, but also to have a similar behaviour than what is done with the in-kernel PM, the initial ID0 address is not dumped with the rest. If the address is removed, then re-added later with a new subflow, it can be dumped. Fixes: 34e74a5cf3b7 ("mptcp: implement mptcp_userspace_pm_dump_addr") Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 359ad5acd836..f6c5069e963a 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -626,7 +626,9 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, lock_sock(sk); spin_lock_bh(&msk->pm.lock); mptcp_for_each_userspace_pm_addr(msk, entry) { - if (test_bit(entry->addr.id, bitmap->map)) + /* Ignore default ID0 & already sent */ + if ((entry->addr.id =3D=3D 0 && entry->flags =3D=3D 0) || + test_bit(entry->addr.id, bitmap->map)) continue; =20 if (mptcp_pm_genl_fill_addr(msg, cb, entry) < 0) --=20 2.53.0 From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4E2F38654F for ; Thu, 6 Aug 2026 08:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005997; cv=none; b=CYheBtwIkTzRlqqYxpNX35qRzGZTD5LqHjLblATobSl9cIzU/bh+C9bGjPETrd6ir6HHdfJkUqaFkUOc1v/GGekhzALQ+JS+aiMYyVTii9L/ypVJoZak7Kly9GNBnGsCnLVIvJGcETnp2askKGDjr823QRA/nG67MJGppkwwFkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005997; c=relaxed/simple; bh=1l2BrGr9D/QMBsvEatr2e8K8+KHsAP3MHOIJ7Ihr8S8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=buBYWtmWm8hn/9zjPEVQa9qtX+b9+pC2ANbTPt0uQ4w63pjE+3ixx7qXp2dcq7fHVM+2YqGTbgd0JdDxBUogsEAuEwiUsIyqTbq6lSeCcNkwE8IIoHTuoP75+A1nQtqhvPhLTp3YuSa4+wQi5WNtAryVQnviGdYrr7XJUR9pFEU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kp8SRRXo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kp8SRRXo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C471F00A3A; Thu, 6 Aug 2026 08:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005995; bh=sHPVh6MsIT/s+4EMlZhmg8CEKL4NWWGYMsxIK5TzmKk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=kp8SRRXoyQ242zN5gQn5FMbOl2+L/sTszpxWT4nDprWDmcgbXWbeXizw5wltURvk+ uQJxna5WpdeQm5/C/oMMyaPMSqCseonvEgVM3lzxlNphFZzxbZP2GU1V8OkboaeXc/ +YvssjHULp8cTjdjMXQIkXRft+3/BGqByTLijDxV8snG3C9CwM5VepfexZSMOTgeLH yTgtSnNWVp6r8qF7cnFLAPRvW9Fxh8gkjaSplaT2EX0y8Gcty0n3McDDWWiAnbO2IY 4VcZIrOdtBe40fvXuSO1bhF08UzXH3twOFUCBfcDVJkyCNU/kMCFElh/ZOLHIwvlco DX3YIdk6ZLiyw== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:22 +0200 Subject: [PATCH mptcp-net v2 5/6] selftests: mptcp: join: new ID0 subflow from the right IP Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-5-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2087; i=matttbe@kernel.org; h=from:subject:message-id; bh=1l2BrGr9D/QMBsvEatr2e8K8+KHsAP3MHOIJ7Ihr8S8=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPJ8Gbf2yeeIudX2pQItFFnty20JsF+6LFFjaH2VUP +dbe4VMRykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwEQu/GD47zfh0HXuCOuvgkEf 1zu7Z38W4pNQcFqUuzlT8GP0actKEYb/CZbPPdU0Znfr77O8u2TNabP4xIS917YvvCN8UHjFt4B +TgA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 In MPTCP, the local address and port used by the initial subflow has the ID "0". It means that when this address and port are used for some operations -- e.g. creating a new subflow -- they should be linked to the ID0, and no other addresses and ports can get this special ID while the initial IP address and port is used. Hence, this is not correct here to try to create a subflow with the ID "0", but from a different IP address. With the first patch of this series, this action now returns an error. Instead of simply using the right IP address, continue to also use the wrong one to check that the kernel is correctly not allowing the creation of an ID0 subflow with the wrong IP address. While at it, fix the dumped address: the initial address is not supposed to be dumped, similar to what is being done with the in-kernel PM. So no "extra" addresses should be printed there. Fixes: b2e2248f365a ("selftests: mptcp: userspace pm create id 0 subflow") Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 2413c832af03..0dc81eeb0636 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -4143,10 +4143,11 @@ userspace_tests() wait_event ns2 MPTCP_LIB_EVENT_ESTABLISHED 1 chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 - userspace_pm_add_sf $ns2 10.0.3.2 0 + # from an IP not linked to ID0: failure expected, no new MPJ + userspace_pm_add_sf $ns2 10.0.3.2 0 2>/dev/null + userspace_pm_add_sf $ns2 10.0.1.2 0 wait_event ns2 MPTCP_LIB_EVENT_SUB_ESTABLISHED 1 - userspace_pm_chk_dump_addr "${ns2}" \ - "id 0 flags subflow 10.0.3.2" "id 0 subflow" + userspace_pm_chk_dump_addr "${ns2}" "" "id 0 subflow" chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 --=20 2.53.0 From nobody Sat Aug 15 20:32:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6AA3231832 for ; Thu, 6 Aug 2026 08:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005997; cv=none; b=pdYEMCrEwq2P1dS1Z3Us9jl1mOX170tbaNI6HfSGQaOWwk5uu3csJIXvNm701ckargIcoQwqZOI69xMxJ7nafVUaLhk8qJHPSP+thKmMjRUQsOAT1L+X//wJY0w6LBeR7GRGyduJV/RNir+G3QJuvtBVleAl0XaW8We42Zu8p1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786005997; c=relaxed/simple; bh=WIDaibfPCb/hRcVG1H/uibVqODsxK8qORSYZJgbiMFM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SW4a66eRdyKGFbSEsM5WouPpGxhXnGbQkceS5FLgk+2k6VRrv6x5VK9SEy/T7K1vLq0+FV2N30VSobTr/OHV8c8eoBAiueKSOBCWjSFxAIAoQ46Tzbw7sTJmM6fySRPqoWx+nQAUvW/hfHT86vi6K28R8xW9Dz8qGVJGOCPBSA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TUtTVcof; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TUtTVcof" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B9471F000E9; Thu, 6 Aug 2026 08:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786005996; bh=BQ0dDdJpfJEk57RRec/1WhhKnmTWu2tj330IfarJZ2E=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=TUtTVcofjaIUJNy5x3/QDsGv5F9EcxcFnmJAC4w/NLDJhm/bKxFI/Y4aqGfoDYX3O PlEAM701l2Te5Ii50zE4RZHfvkYCDQIZsuW2eU8WucKxu+ba9WMryDIrjVyz81pJ2+ AJCFxsADfxacReECVb3x8cnFVYCO5AbFTD+N8LFslvW9DgDrvtEhMjFUhgcJtwTbSf vG7CZsYUlsnsbFtiFpkmn+6hyhrFKxwxdcl5ua1RTEgFeLy5YnNkEwqG70Ko5N1II7 Nu3WoKpy1maX8F7Q5eEB5KDQkjamwPVquEDg+LPZKxUR40dFsrPRk1qKrgGiFpyWok KBwTTGC9JPxJg== From: "Matthieu Baerts (NGI0)" Date: Thu, 06 Aug 2026 10:46:23 +0200 Subject: [PATCH mptcp-net v2 6/6] mptcp: pm: restrict in-kernel worker actions to this PM Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-mptcp-pm-userspace-id0-case-v2-6-fea1808e1c57@kernel.org> References: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> In-Reply-To: <20260806-mptcp-pm-userspace-id0-case-v2-0-fea1808e1c57@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=713; i=matttbe@kernel.org; h=from:subject:message-id; bh=WIDaibfPCb/hRcVG1H/uibVqODsxK8qORSYZJgbiMFM=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKPJ/xPjizJTP51SRd3d9pAWzXZ97x3ndubYvmFu5tM Z8lrBbO7ChlYRDjYpAVU2SRbovMn/m8irfEy88CZg4rE8gQBi5OAZjIpOkM/2NuP1AtSGxYdN31 P+ecG4fmZS/jU55hvUO2I+zJJvfghQcY/oeuef2gsTq5Mrz8Zva0+rdVKs/0A2x+f/jC/3OFlXX QGhYA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 No need to check them for the userspace PM. Fixes: a49eb8ae95b8 ("mptcp: pm: worker: split in-kernel and common tasks") Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 4ff12fe25d0b..da4c6686971d 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -1141,7 +1141,9 @@ void mptcp_pm_worker(struct mptcp_sock *msk) pm->status &=3D ~BIT(MPTCP_PM_RM_ADDR_RECEIVED); mptcp_pm_rm_addr_recv(msk); } - __mptcp_pm_kernel_worker(msk); + + if (mptcp_pm_is_kernel(msk)) + __mptcp_pm_kernel_worker(msk); =20 spin_unlock_bh(&msk->pm.lock); } --=20 2.53.0