From nobody Sat Aug 15 20:33:04 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 91C9B363096 for ; Fri, 7 Aug 2026 08:42:01 +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=1786092123; cv=none; b=Ibj0Z/XoVl8/wIwE1j6Pmem8kdnjOkOHRIYhhkouJQMf4fN2jnQE1i3L0hElYnfgqZwfOeSMXOnl8mYWUtU+yCZFn8lW6CB3ACe2CuL4fgtbZjk6U4uReieV2nBzzL9jZs85t7dsKKRSx9M3RfxwOzPcXuoBoCpPmrsAnAt6YPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092123; c=relaxed/simple; bh=pQRKBO7A/N+F2nFGDi5tNgHJt/0ea1X9mQal4EWMTBw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MRAYzRdo2eE3JAlHpjTO5dplEMI3RwenKy1k7gNsSkDcJgXXvt0EH2/ZQoRplrFMgtENANd9seAJLhl7Hj/SfhZ7PDAq2jXDrxDZVQci+pA7BXvyx4PKRH7AhhyZvctnBhiVKULVJNfPcqxQN8NkbZCgwplTqKIOXXIyS3ANnzo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wm4L+xxq; 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="Wm4L+xxq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C82CA1F00A3A; Fri, 7 Aug 2026 08:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092121; bh=MiTeTHzLoDbaeuTuvLx3IvmYwFOyKJk+OfMJdJYxmOI=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Wm4L+xxq/TYn+XJ5driUJa+DVcuhB5Yrt+NP0FTv8yZIIGVJrFbNtIJdki8z4yEW6 PlGT3+nn+kJol6DjjHGHMnMEFpmhtbDZj+a8UYJr7efIzm0O2EpahtM8AF/YtybriD QhTA3aZqdkL+brUqkO2K6OuEJmNpYw+cWvqMCkweMsNNyVn7jyti1xd2je58DgaFwH u36ZlaqXrhB8iH73ZRU3/8r/hFMPGczzvO/3fyCqIPKKGzHh/dCKLNdf4ayTE+JZQx 6GWFygzwXYCxbi19DtxpnLO8e/JkTqfJivIWvaKnVDFJLqAA4Jk9X7IWgg1AQvx4HS xAcwh5UKpYAxw== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:48 +0200 Subject: [PATCH mptcp-net v3 1/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-1-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4305; i=matttbe@kernel.org; h=from:subject:message-id; bh=pQRKBO7A/N+F2nFGDi5tNgHJt/0ea1X9mQal4EWMTBw=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZwV65YeEhD/mec6ndCV9+dQZ5Qe3XWq5ZeDwn+e+u +XUcPnjHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABN5e5fhf1z829cT7Fe2OBid W/cgWPPUw8uN5+VeHg18qXBNQj/jxwlGhhUz5QwuLDvlqiAj8nPlwdm/T2yezSs6L//GKquAhHW 2BUwA 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. 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) v3: - Split local_addr_used case: that's fixing another commit. - Set port to 0 (msk) instead of adding exceptions in lookups. --- net/mptcp/pm.c | 4 ++++ net/mptcp/pm_userspace.c | 20 ++++++++++++++++++++ net/mptcp/protocol.h | 1 + 3 files changed, 25 insertions(+) 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..663cbeb79548 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -696,6 +696,26 @@ 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); + entry->addr.port =3D 0; /* msk port */ + + 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:33:04 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 D07B03DDDC1 for ; Fri, 7 Aug 2026 08:42:02 +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=1786092124; cv=none; b=r+vGzjo7mNmpX1134gzqH4wP6x949efLXK5Zzy3iwWetIN4aKNN+y1l5BBk0oi8xZs/CDrmL4rM4j8G27FAJhF1Ix44zX2vKXcNXrR/sJWnvAxx0WD8kStYCODtfGRBWcHvvMSjejHHXerT41q8lwrMMuKYh/svM160nNacf2PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092124; c=relaxed/simple; bh=AwLbiHudTi5LJ/tSjBIPC6inR6NWLPNk7kx5ujUb2Yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mL2u4rgKLPMkqRlRmbaWbZU6LScqZ2N99CaS572lJwxw71KPjU+nlKvYdOoDTp2x0InbzQGG1W29s18jIP1JRNWH+ggGpl1tPW2xPVNe5erSfOXOlq0pFQrjTLzCIHDDaNDGOZnf3SWv2p5KmSjD4YLrdK0mxOkVwelPRqAbIiA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dHuSXBoh; 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="dHuSXBoh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A3931F00A3D; Fri, 7 Aug 2026 08:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092122; bh=0vzWfe8w0VbiaBY3HPEuUOeOEHXCj5FDBoujPFjT5ow=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=dHuSXBohqyeKxmg4B6vlQ8bQoKnarYxBLsjsbKUlMSfYdkf6+4IjM/bWv73UzRhqs sGOuGUOjwwMEy4rZQYOEdp71JFkrd9YAcJUtB19l6JJVbz5q0GeOAaSTYgALfTI2WP xe3YhH1wfYx3+h0B4bRBeoDpZ9pxJ+JtZ45OxpvtP1rD4h40We+Zjs+T4RAvXo3+9X 9Bb7reY541sLZPGYguD1gmLUTCXGe5W3IvasH4roIOunevGE8g0L+a5NlzsdTLpDep ZrDASjoABobniQPD9dqwfhFPt+6ShuCG34nitk7OLciyQhxi9DHkP96lEB44giON+h ravHTuP4Ff7/A== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:49 +0200 Subject: [PATCH mptcp-net v3 2/8] mptcp: pm: userspace: lookup: match port in priority 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: <20260807-mptcp-pm-userspace-id0-case-v3-2-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1501; i=matttbe@kernel.org; h=from:subject:message-id; bh=AwLbiHudTi5LJ/tSjBIPC6inR6NWLPNk7kx5ujUb2Yw=; b=kA0DAAoWfCLwwvNHCpcByyZiAGp1mlKjLOs8y89oZOKzDzdbHjKiAZO8Ku7h2ixl0M5D9/zcx 4h1BAAWCgAdFiEEG4ZZb5nneg10Sk44fCLwwvNHCpcFAmp1mlIACgkQfCLwwvNHCpf2RwD8Cl0H pNqd/kuhh/yjuQHxV3DeONiQHtgA3xy6VnaXDf8A/0eZGV7XIxWt68XtKp8da+mubXIo+xXhHqs gq1Id4EwJ X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 In the local address list, there can be entries with the port set to 0 -- corresponding to the source port used by the initial subflow -- and others with a specific port. When performing a lookup, it is important to compare the ports to pick the right entry: when a specific port is given, then try to match it first. If no match is found, try to find entries with the port set to 0. Fixes: 24430f8bf516 ("mptcp: add address into userspace pm list") Signed-off-by: Matthieu Baerts (NGI0) --- v3: new (Sashiko) --- net/mptcp/pm_userspace.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 663cbeb79548..3f1471ec3fc7 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -33,10 +33,22 @@ mptcp_userspace_pm_lookup_addr(struct mptcp_sock *msk, { struct mptcp_pm_addr_entry *entry; =20 + /* Compare ports when set in addr */ mptcp_for_each_userspace_pm_addr(msk, entry) { - if (mptcp_addresses_equal(&entry->addr, addr, false)) + if (mptcp_addresses_equal(&entry->addr, addr, addr->port !=3D 0)) return entry; } + + if (addr->port =3D=3D 0) + return NULL; + + /* Check only wildcard ports if no exact match with the port */ + mptcp_for_each_userspace_pm_addr(msk, entry) { + if (entry->addr.port =3D=3D 0 && + mptcp_addresses_equal(&entry->addr, addr, false)) + return entry; + } + return NULL; } =20 --=20 2.53.0 From nobody Sat Aug 15 20:33:04 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 453D8363096 for ; Fri, 7 Aug 2026 08:42:03 +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=1786092125; cv=none; b=HBqsL/Xb+qsLM3QW1izAIglJ0IJ/6udtwF1pD1oRy7h/OlEdFpLXROF5OzsrCJaabvv2Gpwk8uZ/GZHKTlnjMjDpsE6iZ0tpe5TMhomqH4o4EdaHIgobwtKd5MDSEmDGfIbptbuIV62nACCLED1kEbS/2rMQ2EaCuLdZJfC5vb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092125; c=relaxed/simple; bh=Iw0J80hmMVIXVDH9gSMCsfAx5zDQWfkb7qWoVUxe5+o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jdaFEJLmKlzGDTlHjqjORv2+eL+X1LBYICcu6AdMwWpZcJj1Dl3UtbtJS7zDaqh6Suk1fYtpAhlsCxXVRhmzY5oVlCtsUI5aPY4vauyzUNcTbC3FVOkE3TislF3qdtXDeKwsrYx7KtkPpbMKUeXvK1Tbkn3z7tsFIUnouDPmHWY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BurYvFYp; 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="BurYvFYp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C0D21F000E9; Fri, 7 Aug 2026 08:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092122; bh=hk5zDGBo5xWN/u3H1NR9bT2AO5UFDkdvL373SmX+IpE=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=BurYvFYpiKDFH2OlUeAB7BJNwZm57l9s5A2QEnX106MgoaZ+WUQMmx8ka7NugwzUZ MciQSL1tfMxsY38LOJATMryxLVYL1CZX0JaJ91rvJEwAWGqJMxKmxFnW6oJ4gsUUUM 1bRzg8Hk9RT6aUyDqHlwFGXiJ8B5Xjj7lwpI50T5YmnqBAsjFU6zBZoKl0WZ4fFrhR JXOHgfSmif46PujRM5x0EGf2dTSg7K+4VBwL78JBBUMh2AZr2vBrZ3FOsiF7jmZgIf HvHimxlh5WfCc6VGK9DKXH3UR5iKH5WcDgNQKPi/ciKxsW0eKBIazdlkE3lo1OiPLS r4Ptct2kKnOtw== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:50 +0200 Subject: [PATCH mptcp-net v3 3/8] mptcp: pm: userspace: ID0 is not part of local_addr_used 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: <20260807-mptcp-pm-userspace-id0-case-v3-3-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2180; i=matttbe@kernel.org; h=from:subject:message-id; bh=Iw0J80hmMVIXVDH9gSMCsfAx5zDQWfkb7qWoVUxe5+o=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZwUH8e5yf/rrn07OocvBt/ZKrmbl4nyxef+zWRLnb FPeaee2dZSyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAEwkYB3DPyXnHVx1Jwx3hNxf zvHh16XS9Wu/NE3qSl2mw73VfopLcQ7D/2C9kx8kWzbV6vZdvf70t0e0cFaahkZk0+UbH+bMtHf XYgAA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The PM's local_addr_used counter doesn't take into account the ID0, similar to what is done with the in-kernel PM. When deleting a local address, only decrement the counter if it is not linked to the (initial) ID0. Similarly, do not increment it when re-adding the exact same entry. Fixes: 77e4b94a3de6 ("mptcp: update userspace pm infos") Signed-off-by: Matthieu Baerts (NGI0) --- v3: - split from patch 1. - do the same check when incrementing it to avoid a "leak". (Sashiko) - use a new dedicated helper, clearer. --- net/mptcp/pm_userspace.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 3f1471ec3fc7..27fed3519d39 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -27,6 +27,12 @@ void mptcp_userspace_pm_free_local_addr_list(struct mptc= p_sock *msk) } } =20 +static bool +is_init_id0(struct mptcp_pm_addr_entry *entry) +{ + return entry->addr.id =3D=3D 0 && entry->addr.port =3D=3D 0; +} + static struct mptcp_pm_addr_entry * mptcp_userspace_pm_lookup_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr) @@ -95,7 +101,9 @@ static int mptcp_userspace_pm_append_new_local_addr(stru= ct mptcp_sock *msk, MPTCP_PM_MAX_ADDR_ID + 1, 1); list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); - msk->pm.local_addr_used++; + /* Just to avoid this counter not to decrease when deleted */ + if (!is_init_id0(e)) + msk->pm.local_addr_used++; ret =3D e->addr.id; } else if (addr_match && id_match) { ret =3D entry->addr.id; @@ -121,12 +129,15 @@ static int mptcp_userspace_pm_delete_local_addr(struc= t mptcp_sock *msk, if (!entry) return -EINVAL; =20 + /* The initial address ID doesn't increment local_addr_used */ + if (!is_init_id0(entry)) + msk->pm.local_addr_used--; + /* 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--; return 0; } =20 --=20 2.53.0 From nobody Sat Aug 15 20:33:04 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 BFC2D37F74C for ; Fri, 7 Aug 2026 08:42:03 +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=1786092125; cv=none; b=ujtD54DQWKUzTFjOW66lfvobYMDZ0OWVH2eEJyugwEdSYYbgpq+7e/sQfEXOvoJSLMhyMmRUQIbh0msZ/kNzvXt5XPXNCII3f2J9qpAYx3PWeChtvS0K0ZGwzLMNsiUjWRvoz+Py5DqLejgOiTGgLEfrFOcgEVh3d0iP8lhGEk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092125; c=relaxed/simple; bh=PsAf6aOFwwWNOdRDRZGLcNbLIDbeB6FmOkiZS2+Fzso=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ksklIa+5i738Qf6vqNwZ4F8dLD84qS88rdTP+R6nH7JxsW5PYbGTSEGWTdgt48dK5iqHQwAZ65bcKbI1RTR8XvWoEsti4iJ0/CEs2f9PQ3ylpnxcpw4aliJXprx7Gp17BjD0xVr8R56EaAMaFNuMcHKAal9+xbiaRkSAnmqHluU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Eca9bW6A; 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="Eca9bW6A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EED31F00A3A; Fri, 7 Aug 2026 08:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092123; bh=HfmpyDWvAua5R7g7MwjzVD9n/Qq7gVNvPI6vDus6r+M=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Eca9bW6AFWrprtppaU/cIHnVVkJXexXOJnOFoDBt3Srj+mOSvkJ/9DaKEEBz5vY2I uvUq0Yz6wLYAvdrHHP3geKe2uaOWN7F6LmGKRejhZSryv1ns0gAy7oA25VnkdvAvn9 7tozqx05YVhHrFm0Fz610hjF7zoaYMMOka3Kcm9mJRBn314yTtELyKTLpySxs+LgMZ ww+Hr4vZEruGjVxmt5QXywSy8crbv0+QfvFwsaCnX1zRUsFfVpGg8iwBa2pxVEJSmH 26MihxgwByTaR7wwpbcHvNvlzscz8t+UrVBgVps3m18ljKfJRVFqvimgJHBpZG2fnJ YBOwY6HWYAD7g== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:51 +0200 Subject: [PATCH mptcp-net v3 4/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-4-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@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=PsAf6aOFwwWNOdRDRZGLcNbLIDbeB6FmOkiZS2+Fzso=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZwUXubU9DlinVHNpUcUOvYsOXFcsKst5Nzk1+Zh0d 6R92l/WUcrCIMbFICumyCLdFpk/83kVb4mXnwXMHFYmkCEMXJwCMBG+l4wMu+X/+TFP/CNRHR82 7dXuTR9vXyr+v3yHUVb4u+AXLF1TdzAybPptVf70/OUD+VMLzq09Pc/jwXfFl77Rbjsefk1uO7f bnQ0A 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 27fed3519d39..2c13c6273ad3 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -236,12 +236,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:33:04 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 10BD23D5C26 for ; Fri, 7 Aug 2026 08:42:04 +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=1786092130; cv=none; b=sbiwkRKxbtIGOOr+1qlCy/TBlWPTO8t5YrdfKdqD8iw8fYC+31UOOZdf2yU7I8DZ0lej68VQ9/9DbySZWhHDITPX7gbzAx7kHYf7YdirVvTKOkBqUb5SPp6OwJnpjAlLgQ/P7yxaCJTOQJAw3q+WOhpdE4G76oOau0gzz7DLrqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092130; c=relaxed/simple; bh=oXhP65Bb6c4I6YfmJ91tWwg67ouAQLd+6zEA4qz/GUk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HNhqHYpcDOSHbG8J4QxW9+Tg29huYOMOLghA3yoaTN9dIWnK8wdtyi3WC12pBYJPigMUpFhThnNQJKk9sBOrKhKJ9VOgY4FAe9GIU8vmtm9699CLvbcyIRvZNJGi+u5+XKDb2r2RhiASAVg2OE/YW/icrJid/oHk7fC90ewKgLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QbNmjb0t; 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="QbNmjb0t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C051F00A3F; Fri, 7 Aug 2026 08:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092124; bh=TEBtzxY2vVmIXtmIiWIfHCAIsc2I8Rs/XDueGFwVu4c=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QbNmjb0tCKDAF/kquBZSq1UjOO4b5/a4e2gtQCJucQk077bDfP9dSwOfltgNyJO/m 2Z/p5LGde9Zlbul/ZrQOBAh/Ie9MueBKMH2YMgcrO7hDxykInciUVexGiDQshohPF3 G29xqZh8nCraovYhV42SHCC9bPDSnYC7/OIhe2lxIyxikSNxcXJV5YVbHZ820f12Xq oZPctql/XYGi/X6Vc1f73jsC5YeTqCSARrl97AW+04tag+RZ1NKq2yIgDx0R2eurGc 7xrTZ4axeTz3RCIcHh8e9jkFo+jPkSVWOPGVzM2pgiV4gyLbEton8ZULx6huockGFm +uzUONC6VQzSw== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:52 +0200 Subject: [PATCH mptcp-net v3 5/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-5-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@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=oXhP65Bb6c4I6YfmJ91tWwg67ouAQLd+6zEA4qz/GUk=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZ4Uw7ZGMElY7rLJS7neUpOtJg0VBU+6Gln1ecXzRw 4WXT8tO6ChlYRDjYpAVU2SRbovMn/m8irfEy88CZg4rE8gQBi5OAZhIrjPDfy+exmYrw+rvug7V k1d86AopeeWnzm0+c/Yxkc49x3Zp/mf4nzt7s15ZPPNqqzcREbrNy/RNb74P9fyedLAg786zx/c q+QA= 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 2c13c6273ad3..87f044735c59 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -267,37 +267,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) { @@ -339,11 +308,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:33:04 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 8896441835F for ; Fri, 7 Aug 2026 08:42:05 +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=1786092129; cv=none; b=GWm1ArSfyD1SBv6C1XKCKGhu66dEZ7WDBV6PAcxJapLmkqt8+4xXpbX/JxtSNcLnnHf461bpqeuPzOh+9DUEwdWxINJ7V3laFN0fIeUons/0T5jYhBWqkqBQnqmRcoZBFJUwm9ctE6qkYx/TAVc7L4zEMN6Q0M/WnEynRSbTnAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092129; c=relaxed/simple; bh=TfS1HZredEFp4AK/plqRsUtvZlkrUGAe36gdGMcN4RU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EdDgc9IV4PuoAXHRSXbqzyAdF+rYRAxoDC21YGQ5K4IXbb4xq/hK1HmThcp6RORFO1BcVSRZGAV0Ll0KJAeE/FUO4rY/C/VrI0TOGCxzosroYfB+G3y1bhr//tDqEeZRRGGlptPRptGFr2i98pEyInxvR4lFdy55w4FFL+NF5qw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gphiS1E9; 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="gphiS1E9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6E1F1F00A3D; Fri, 7 Aug 2026 08:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092125; bh=qCu1uTbhaNhE5xnOrza1p3d/8b/aUWZ/RPDL9++KkQ8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=gphiS1E9dklkVNXlrlsY2lGUuEYKjrPZwEfhQ1PSTE1i3ru2WktR5hrBm5m1aFVBJ S1egooqvgYnfGOwXtlD5uOdQ7WKCiH26Cxm73AJnmovKwgjSWlqw2OViNMGikp4jGa jKaMvqmcNlI13w5OWBsKnvd0GyNWw8bRJqxKL0mwo8vOud+b4bM79ndb362Nx1cgNG G1iX2N181eHtLkNFeU23ZG3DmKxsbq7i6lpoKttXGvfamBtA7Pa1wbsDZsuHoDDHPe IC5uheja9bIawq6qBwOL39FOgLJ3HcF+lpP2HZffi7jObye9RB2eL7I/Jsnx3uYFtV b8KHDiUiLxuPg== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:53 +0200 Subject: [PATCH mptcp-net v3 6/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-6-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1301; i=matttbe@kernel.org; h=from:subject:message-id; bh=TfS1HZredEFp4AK/plqRsUtvZlkrUGAe36gdGMcN4RU=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZ4V+U9sYlz555q7ZSow1zI8UJZwOtlnsLypfeIW7f iJ/mP3fjlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIm8ecLwT/nR5QKRXduqGmSn CYZ9WXrEdu/9KQfXfduqkfBs6pu/cxYyMhyP3XbA4C1LqPKDQut5gR5HfPLWXLrZ/dGI6XblzPs tzbwA 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) --- v3: - use is_init_id0() helper, to check the port and not the flags (prev workaround, but doesn't work if modified later) --- net/mptcp/pm_userspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 87f044735c59..284d021c6e5e 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -633,7 +633,7 @@ 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)) + if (is_init_id0(entry) || 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:33:04 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 7627041835A for ; Fri, 7 Aug 2026 08:42:06 +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=1786092129; cv=none; b=QCkDPKqnQp+lEeiLD/7JYLLofBuZtjiKlwWd4vNXNpT3zDx2CilpvhALcAIprwHjFY+sQ0ghPK6Fu4PeZW33wCceabSV72dzcIujsW1GRcTbK5UAdXuxzSovhiDT9NQSXMQrFDYo0X/rUKwUwmlWO2Sby1uNPiGjCfBPh/neWjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092129; c=relaxed/simple; bh=1l2BrGr9D/QMBsvEatr2e8K8+KHsAP3MHOIJ7Ihr8S8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tEQocHmL8CrbGlWs9gvrHSuGmUsctUbXPX/94v44ynqBOb8kav4UTAq2PXCb6I8ZkgqkI95SYTigD0Satsa0MRE0Q1Yqoeo6y3DGs+QSiaAcNbyl8BYVOGxdwog2CSFjJnKlc9DjQaqldvPrhSUJHGSnsOWaKx74uf4kRuEluT4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HhvnuaTf; 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="HhvnuaTf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8EA81F000E9; Fri, 7 Aug 2026 08:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092126; bh=sHPVh6MsIT/s+4EMlZhmg8CEKL4NWWGYMsxIK5TzmKk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=HhvnuaTfaYlsZji2Byc+XsWTjDUkeOUnkqnqCOCQ5HbiUi1/iIwprRciz0aVAFMQ9 fuJ/q1I8TFlqoTE7/5FPIvvUuUFaUkMVW5qYqXVS6P600RNVvoSBASXIDy4kF0yKef HR6N4RaEpMVIi22AfDmWCnsD1Io2hhZnp41GibNP+igQ4Tbx/vreqkz3fwLCfy7tnE zgwMcOWyM5qaA3X9gQsJeI3WHPV8Mrx35imv48hhZGoL8C5g4pfX6Nwc98C0MxPABE i7p5w75kKgGiBk91mEWtCElXUrBSWlqCJLcJWXbuzZhabFtxECPrPQdKu3NX22M4ba gHRRlNC064PRg== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:54 +0200 Subject: [PATCH mptcp-net v3 7/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-7-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@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/Th0Gd3rumMp9WSGLJKZ4WJ8NSI6X4oeFK7X6bec3v9kuVvzSUyDpn6vxVry nIQzj3VUcrCIMbFICumyCLdFpk/83kVb4mXnwXMHFYmkCEMXJwCMBF3NUaG3WsnPO6RPpLIHicy 5Y/wFrN93ct8DPZ0eB/Yt2ttsUzzNUaGNadmqxkxxibPYVHgeWUZX8927pyriHnEk6mtD8LtMri YAA== 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:33:04 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 7914940DB2E for ; Fri, 7 Aug 2026 08:42:07 +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=1786092129; cv=none; b=ayP/Ezl8EAU+anig5Z7OA5f9rGTtkC2BNinRVIqP7KtC3HsBfNyzcmj1SKwxdPofN7d0XRSc9zM8fAyURgq4yYd41I9Q/cBFGTda+ok3EjRTUWSFZUvwVpoXZdnns8j5j1Ybe0USUuJiTWY0aJ6daDWSmqcqgto/ugJoLCdFtXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786092129; c=relaxed/simple; bh=pVlY5V1NdZnRmS1Bty8FhCGUI3wTuQyo/9EimjK5A2w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ct/qJqAWUPP1pvkoUFrCwYgpY9E63/4gmO3GJeDDY1JKZBxxI4ZJM6FafQIxaWtU3LzfSHae5NsLbVbZoOt26sBsB57nYM5t1+cfRayRrH4h3F1bUhHZho2EqvzM/+IvKxcyDdftb0DOYeJ7LRlXRC2N/j+NV1M8wvCc1VNR5U0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DyJ75GhN; 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="DyJ75GhN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AA9D1F00A3A; Fri, 7 Aug 2026 08:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786092126; bh=4WRRWXYFEP0SFsYWbYx26UZhcenm1tKE9W3RVC8waQk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=DyJ75GhN7hmbh/Xv0oTxXMVAGXMfUM8344S0ooQEGDGmtqQcLHgpfkOFm1ThmNPIn NUliJiJy8mMxeuTtJEqemwjJ4yE0xFT6+SxApNbhjWWsBrXerjEnAz/PoNdH2LEiPT l+ZBZrWg9ZNo9fPg4Dp6zWe4z3Xrb56r4fgjTPRGVUb2IKr8yrMA2php7lubffVMmi 72sX/kKVtUPQB0FnR9ptJyip/iWEs3V4y4fZKc6fE3KRdMqTPqaM6O1xzyMPe62SCV kligEBXJf23KumR1b+DyJMAL2jSZtiQha+PpfR5cKkG0UH057RU++YwvNn43cALzcH SSIyZZ8hX4HGg== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Aug 2026 10:41:55 +0200 Subject: [PATCH mptcp-net v3 8/8] 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: <20260807-mptcp-pm-userspace-id0-case-v3-8-de9088549924@kernel.org> References: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> In-Reply-To: <20260807-mptcp-pm-userspace-id0-case-v3-0-de9088549924@kernel.org> To: MPTCP Linux Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=784; i=matttbe@kernel.org; h=from:subject:message-id; bh=pVlY5V1NdZnRmS1Bty8FhCGUI3wTuQyo/9EimjK5A2w=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJKZ4Vf/Lj4+YX/U77tCy7b+XyW8N5ZzW83ZU3oERXi4 Nq+88j9FR2lLAxiXAyyYoos0m2R+TOfV/GWePlZwMxhZQIZwsDFKQATOWXPyPCb7e3zKQVXLaZO OlMl+OlaaV0/c57OHbaQL26tm1z3HZ3P8D+uSpPvUOjpVv+p94tPBN/LYMg4tVW3yeyO69KWyu3 m5vwA 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) --- v3: use !mptcp_pm_is_userspace(), to handle WIP BPF MPTCP PM --- 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..ecf123526786 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_userspace(msk)) + __mptcp_pm_kernel_worker(msk); =20 spin_unlock_bh(&msk->pm.lock); } --=20 2.53.0