From nobody Wed Sep 17 16:19:24 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EB9692DC77B; Fri, 12 Sep 2025 12:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681586; cv=none; b=Dirhg5um9sk3nB6xXVaqEzO6YRKjCNHNtmV4xxy0dKPu6uB/r3ZLhMIQO0YraHCrH14JHtvdfl8SkKUNB9Gz9789h38iFXHr3zNmWLik3t7pl7T8TGHlrZwd8vhDD/wWvI/VsY9E9UAvX0NoygkcEOLiILmFBsRrDJLzDdl2zpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681586; c=relaxed/simple; bh=O2z45ZEVtTEuSoxtLydb6a4AKStyGDHYl0hsAlKSGCM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ufz3MQX7Llu9Zbi/7ikTFc9yulyYVmRmEQMgSO/v1WnQjgtNTrdRxARBEk5W/o0e8itzCfWZv+UlaIAjl3BWSkbZLvZa4xtXw9IaOctj0n/hqSLhPNWpJYQaGYqyzpgja4OAUHgS2oTZX44QKz6MD+4JObkUhCCEMQeIpnCgQDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FYj3Ztfz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FYj3Ztfz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CB78C4CEFB; Fri, 12 Sep 2025 12:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757681585; bh=O2z45ZEVtTEuSoxtLydb6a4AKStyGDHYl0hsAlKSGCM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FYj3ZtfzRypQNAoMM3zAGa0TQ8MCzpQX2kftMKSO83Qa9vU+23fCBsLgf0f1nrSRQ TrD1QFQ05a1VCSCMw2kxptEms+SywCqrMwyCwVs5ovsERuA5ogMdLO52KbnFNlQ9lF PeBm2UWr7b5xrfcKhtl4Q8SRtK4iMoln3z8PY/F+xxEh+316vlWPacRSJxe6WH5f8D Vpv1JcmzK7h3E6QNMFTRzzKiv3Eb6GLycESWYaA9PMPUS4PrPujDJ3O5dcO9NikT1n XI5OPekA81nAftiPXPC1KO3X6nmEdzI16WmAdivrO6tXGcKcCqK6WQIjUS+1/n+2UT 15oyor+MVhqEA== From: "Matthieu Baerts (NGI0)" Date: Fri, 12 Sep 2025 14:52:20 +0200 Subject: [PATCH net 1/5] mptcp: set remote_deny_join_id0 on SYN recv Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-1-40171884ade8@kernel.org> References: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> In-Reply-To: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Florian Westphal , Kishen Maloor , Shuah Khan , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1257; i=matttbe@kernel.org; h=from:subject:message-id; bh=O2z45ZEVtTEuSoxtLydb6a4AKStyGDHYl0hsAlKSGCM=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKOiC89v0T9ckjg5MSSh9Ivrr51PlfzPH/T/uAVBgmii /LdnHkNOkpZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACbyO4iR4VoNk2NqWUmRBZsm H/ubf+Weynd2GyZIvJg7V7X+j1cnJ8M/7UBJ/2UnTzz3+u9ef/RMxf0ll8psfy/nZ6r9fkpg9tk nfAA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When a SYN containing the 'C' flag (deny join id0) was received, this piece of information was not propagated to the path-manager. Even if this flag is mainly set on the server side, a client can also tell the server it cannot try to establish new subflows to the client's initial IP address and port. The server's PM should then record such info when received, and before sending events about the new connection. Fixes: df377be38725 ("mptcp: add deny_join_id0 in mptcp_options_received") Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/subflow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 3f1b62a9fe889ab1ac07f2a210b9de050436b37e..f31a3a79531a2e160598111d3b0= 765eee2e599fb 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -883,6 +883,10 @@ static struct sock *subflow_syn_recv_sock(const struct= sock *sk, =20 ctx->subflow_id =3D 1; owner =3D mptcp_sk(ctx->conn); + + if (mp_opt.deny_join_id0) + WRITE_ONCE(owner->pm.remote_deny_join_id0, true); + mptcp_pm_new_connection(owner, child, 1); =20 /* with OoO packets we can reach here without ingress --=20 2.51.0 From nobody Wed Sep 17 16:19:24 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A912D304BC5; Fri, 12 Sep 2025 12:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681589; cv=none; b=RfTEbnOsrsltO2cJeziW4MKlKVKhpZnYmZmHOeg0H/4jJaJUAK4QiUza9No92KpVSAx/dGtcrNWRwh+hvMWqaq5xRTafve76PXFQwSgPDukPvbfPda3mAUfXI5YJ2YnYAJSg51/22GrAtgw8tAILE6AJw5+w/vqnOcX9qLncvbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681589; c=relaxed/simple; bh=lkbX7mxCFhUloTL+Yp0yN9A7qSk5SV/fUBoxR5SQYSU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BxUNaJGxvJ0/kNy/hRz4T2UjhT/Bke1XRZMHih0UH/dDQFtpSXA4qwHSfVKooz26TAhS7r1YfTjLPzPCPsMRRfjifCq6RlapsySve6kJs/3Z+BST02nJe0bimsZfIyXVzddaf2YsEFW6VrsCzjDrs9EIaYhNzkJElbLruB08ddc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MbzXRb23; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MbzXRb23" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2B0BC4CEF1; Fri, 12 Sep 2025 12:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757681589; bh=lkbX7mxCFhUloTL+Yp0yN9A7qSk5SV/fUBoxR5SQYSU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MbzXRb23IyU4jhoRH2MbQB2qQ8FyACXfCSrsBFLaHpe1u5yDFJmRRCsI/mY97b1cg 8XqHpPjRPR07vT01qjxc+PSb7nSL22QipcqW6ga9mFz9JXmP5kw5k4jotMTwZZlXjg KhXkIuE0W5XhNQzTXLGnq54tpqwT9/Ar3QgvorwG1MV0fR4/KXmXxJRfn+tr4Maox6 y0XXw2MsNrJ08ypVZ2ElG2wQdXh+Xn3flelaoubNHMrMlMxqH7pe9nzA9LGZ47Q/dF ukJ8oDjnwThEvxApMOSUemyoRZ6hAS6eQh9ad5Z48A6bhiugVJjovYVWQ47Wg/oUYp +FYvdxTyxwE2g== From: "Matthieu Baerts (NGI0)" Date: Fri, 12 Sep 2025 14:52:21 +0200 Subject: [PATCH net 2/5] mptcp: pm: nl: announce deny-join-id0 flag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-2-40171884ade8@kernel.org> References: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> In-Reply-To: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Florian Westphal , Kishen Maloor , Shuah Khan , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Marek Majkowski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5232; i=matttbe@kernel.org; h=from:subject:message-id; bh=lkbX7mxCFhUloTL+Yp0yN9A7qSk5SV/fUBoxR5SQYSU=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKOiC8T+efsMDtqpeyfMqXF86fsb1FXlei8J/i7i3dPt M+8uyHzO0pZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACZS7c7wP6de2rlgxR+lsyap 035osJky6+5tVOSYOCdlZqj6s64acYb/SSvvOEYVF3SVf74U4PWenU1d7Xrxp6y+CSr/TjSvE5d iAQA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 During the connection establishment, a peer can tell the other one that it cannot establish new subflows to the initial IP address and port by setting the 'C' flag [1]. Doing so makes sense when the sender is behind a strict NAT, operating behind a legacy Layer 4 load balancer, or using anycast IP address for example. When this 'C' flag is set, the path-managers must then not try to establish new subflows to the other peer's initial IP address and port. The in-kernel PM has access to this info, but the userspace PM didn't. The RFC8684 [1] is strict about that: (...) therefore the receiver MUST NOT try to open any additional subflows toward this address and port. So it is important to tell the userspace about that as it is responsible for the respect of this flag. When a new connection is created and established, the Netlink events now contain the existing but not currently used 'flags' attribute. When MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 is set, it means no other subflows to the initial IP address and port -- info that are also part of the event -- can be established. Link: https://datatracker.ietf.org/doc/html/rfc8684#section-3.1-20.6 [1] Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establ= ishment") Reported-by: Marek Majkowski Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/532 Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- Documentation/netlink/specs/mptcp_pm.yaml | 4 ++-- include/uapi/linux/mptcp.h | 2 ++ include/uapi/linux/mptcp_pm.h | 4 ++-- net/mptcp/pm_netlink.c | 7 +++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Documentation/netlink/specs/mptcp_pm.yaml b/Documentation/netl= ink/specs/mptcp_pm.yaml index d15335684ec3d6256505f2b3887ce5818eb57462..d1b4829b580ad09baf4afd73b67= abd7b4ef6883a 100644 --- a/Documentation/netlink/specs/mptcp_pm.yaml +++ b/Documentation/netlink/specs/mptcp_pm.yaml @@ -28,13 +28,13 @@ definitions: traffic-patterns it can take a long time until the MPTCP_EVENT_ESTABLISHED is sent. Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, spo= rt, - dport, server-side. + dport, server-side, [flags]. - name: established doc: >- A MPTCP connection is established (can start new subflows). Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, spo= rt, - dport, server-side. + dport, server-side, [flags]. - name: closed doc: >- diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 67d015df8893cc1390a483bda034191525b8fef0..5fd5b4cf75ca1e0099e0effa351= 507d3ab002f1e 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -31,6 +31,8 @@ #define MPTCP_INFO_FLAG_FALLBACK _BITUL(0) #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1) =20 +#define MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 _BITUL(0) + #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) diff --git a/include/uapi/linux/mptcp_pm.h b/include/uapi/linux/mptcp_pm.h index 6ac84b2f636ca22935c191c645449fb62b673899..7359d34da446b94be148b363079= 120db03ba8549 100644 --- a/include/uapi/linux/mptcp_pm.h +++ b/include/uapi/linux/mptcp_pm.h @@ -16,10 +16,10 @@ * good time to allocate memory and send ADD_ADDR if needed. Depending o= n the * traffic-patterns it can take a long time until the MPTCP_EVENT_ESTABL= ISHED * is sent. Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, - * sport, dport, server-side. + * sport, dport, server-side, [flags]. * @MPTCP_EVENT_ESTABLISHED: A MPTCP connection is established (can start = new * subflows). Attributes: token, family, saddr4 | saddr6, daddr4 | daddr= 6, - * sport, dport, server-side. + * sport, dport, server-side, [flags]. * @MPTCP_EVENT_CLOSED: A MPTCP connection has stopped. Attribute: token. * @MPTCP_EVENT_ANNOUNCED: A new address has been announced by the peer. * Attributes: token, rem_id, family, daddr4 | daddr6 [, dport]. diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 50aaf259959aeaf36e7ab954c6f7957eaf2bc390..ce7d42d3bd007b13f214fab699b= c69b5e35c25e3 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -408,6 +408,7 @@ static int mptcp_event_created(struct sk_buff *skb, const struct sock *ssk) { int err =3D nla_put_u32(skb, MPTCP_ATTR_TOKEN, READ_ONCE(msk->token)); + u16 flags =3D 0; =20 if (err) return err; @@ -415,6 +416,12 @@ static int mptcp_event_created(struct sk_buff *skb, if (nla_put_u8(skb, MPTCP_ATTR_SERVER_SIDE, READ_ONCE(msk->pm.server_side= ))) return -EMSGSIZE; =20 + if (READ_ONCE(msk->pm.remote_deny_join_id0)) + flags |=3D MPTCP_PM_EV_FLAG_DENY_JOIN_ID0; + + if (flags && nla_put_u16(skb, MPTCP_ATTR_FLAGS, flags)) + return -EMSGSIZE; + return mptcp_event_add_subflow(skb, ssk); } =20 --=20 2.51.0 From nobody Wed Sep 17 16:19:24 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D52CD30BF60; Fri, 12 Sep 2025 12:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681593; cv=none; b=ZHxhfssAOE479Zij2JOoJgni+VGibfTbwQx+7G3m01NDOiKFmaajo/YsCIdR80BeIWiFxEmWu17aYVrN4rkid1M40dJ1g+O/6ZIChqFLpY59AA3U8owq3oQPu9hDU4m5PpHCt6LC+BkAtN/ZRJ+1F0bU9LPeP+m0Ro5S82bHndA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681593; c=relaxed/simple; bh=3DaJGpjVW/1i1OPjle+Vzn5UOXmKJIuclLYAV3+LrNE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wmq1uHNFpBXer7rdLTkSKQGYR/4BIzCn4W2XKzX8HKX7MiejC9sjNCH54DULYZWZuKnXdkuWVKEnP1aO+cVgtx/khN661paRe78cqJTEcnSMzRAYjlvA2SYEd329Gi8lAdqaQYgMm/cZgYpmEbS1Z3/MRgJf623znBuGyvo0O0s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZNVwEMK5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZNVwEMK5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B310C4CEF4; Fri, 12 Sep 2025 12:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757681592; bh=3DaJGpjVW/1i1OPjle+Vzn5UOXmKJIuclLYAV3+LrNE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZNVwEMK5XT4XY8yX4eyH0UMpGZsSnU5OiBWkjnNfRj6ety6pyG4gr7rDg4mDzSmRW oiUNZIYmvE2Fd1IkAoErdbHk5vIiTMjU319swWRaaK+7KVR+6ZgrxOsFIowVq2lL2K A+KSNzIP03AcmGf+0upZvBZYvVfVuUIt8vQCaUgnKuXoxw71cvkFF/jeZArHfEa8WX YLzVvs+vGi+gLQZUMhJ5bvShvk0A5UqAc51OAFrzKndvbrWohWWWYmyGasmzk1Bmpe j4oKoidyw5kc5NojkPx34hrto1eAeXsxvFc2ODqx1AJb51oRyxIrTcG8j//6A862cS Ft+3oAucBLm3Q== From: "Matthieu Baerts (NGI0)" Date: Fri, 12 Sep 2025 14:52:22 +0200 Subject: [PATCH net 3/5] selftests: mptcp: userspace pm: validate deny-join-id0 flag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-3-40171884ade8@kernel.org> References: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> In-Reply-To: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Florian Westphal , Kishen Maloor , Shuah Khan , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3969; i=matttbe@kernel.org; h=from:subject:message-id; bh=3DaJGpjVW/1i1OPjle+Vzn5UOXmKJIuclLYAV3+LrNE=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKOiC93eVFpvvlz2LJ93tpfXmaWMfxSt2BVY/z55Uub+ kudGVt2d5SyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAExE4xsjwzs1Jz2uTcf2mope 5+URm9ynt09xxVLTj8Kn3nV/PHrKNYaRoePnrebND514eGIPJraXLltxOZgncGex6P4VC7nzX30 t4gIA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The previous commit adds the MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 flag. Make sure it is correctly announced by the other peer when it has been received. pm_nl_ctl will now display 'deny_join_id0:1' when monitoring the events, and when this flag was set by the other peer. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establ= ishment") Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 7 +++++++ tools/testing/selftests/net/mptcp/userspace_pm.sh | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/= selftests/net/mptcp/pm_nl_ctl.c index 994a556f46c15163bae6cb517c371801f0cd6e3b..93fea3442216c8fef43731a99c1= d5710f234b150 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -188,6 +188,13 @@ static int capture_events(int fd, int event_group) fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs)); else if (attrs->rta_type =3D=3D MPTCP_ATTR_SERVER_SIDE) fprintf(stderr, ",server_side:%u", *(__u8 *)RTA_DATA(attrs)); + else if (attrs->rta_type =3D=3D MPTCP_ATTR_FLAGS) { + __u16 flags =3D *(__u16 *)RTA_DATA(attrs); + + /* only print when present, easier */ + if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0) + fprintf(stderr, ",deny_join_id0:1"); + } =20 attrs =3D RTA_NEXT(attrs, msg_len); } diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/test= ing/selftests/net/mptcp/userspace_pm.sh index 970c329735ff14f87f0048ba0030dc7edaaa86bc..3d45991f24ede919264185e3b5c= 2a3b95c1dcc85 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -201,6 +201,9 @@ make_connection() is_v6=3D"v4" fi =20 + # set this on the client side only: will not affect the rest + ip netns exec "$ns2" sysctl -q net.mptcp.allow_join_initial_addr_port=3D0 + :>"$client_evts" :>"$server_evts" =20 @@ -223,23 +226,28 @@ make_connection() local client_token local client_port local client_serverside + local client_nojoin local server_token local server_serverside + local server_nojoin =20 client_token=3D$(mptcp_lib_evts_get_info token "$client_evts") client_port=3D$(mptcp_lib_evts_get_info sport "$client_evts") client_serverside=3D$(mptcp_lib_evts_get_info server_side "$client_evts") + client_nojoin=3D$(mptcp_lib_evts_get_info deny_join_id0 "$client_evts") server_token=3D$(mptcp_lib_evts_get_info token "$server_evts") server_serverside=3D$(mptcp_lib_evts_get_info server_side "$server_evts") + server_nojoin=3D$(mptcp_lib_evts_get_info deny_join_id0 "$server_evts") =20 print_test "Established IP${is_v6} MPTCP Connection ns2 =3D> ns1" - if [ "$client_token" !=3D "" ] && [ "$server_token" !=3D "" ] && [ "$clie= nt_serverside" =3D 0 ] && - [ "$server_serverside" =3D 1 ] + if [ "${client_token}" !=3D "" ] && [ "${server_token}" !=3D "" ] && + [ "${client_serverside}" =3D 0 ] && [ "${server_serverside}" =3D 1 ] && + [ "${client_nojoin:-0}" =3D 0 ] && [ "${server_nojoin:-0}" =3D 1 ] then test_pass print_title "Connection info: ${client_addr}:${client_port} -> ${connect= _addr}:${app_port}" else - test_fail "Expected tokens (c:${client_token} - s:${server_token}) and s= erver (c:${client_serverside} - s:${server_serverside})" + test_fail "Expected tokens (c:${client_token} - s:${server_token}), serv= er (c:${client_serverside} - s:${server_serverside}), nojoin (c:${client_no= join} - s:${server_nojoin})" mptcp_lib_result_print_all_tap exit ${KSFT_FAIL} fi --=20 2.51.0 From nobody Wed Sep 17 16:19:24 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 35D3030CDAF; Fri, 12 Sep 2025 12:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681596; cv=none; b=dMtZ/gZS9/GEb4OvwN2D7IAS1T/gNrXXEWO45ZqoMdSg3/IMpFM8Dc/Ak31n+o1crqURF3S04/Wezv0iZanNexhzWxzu7RGq519/2A/jsJMLfV4NtAzPXSfK/0HnPF+SbUy6D+NMOJ7NMzw/bJQ0Ds1oocv+K1tGYMp9GL0wx4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681596; c=relaxed/simple; bh=uytak4k5ZwFQ8XmiI8MdssXPsqKkEtpvw0SvCwqCmRE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CbeOOXpSlrXOzMLKMibpeJf95Asn26/2BtpgYnAOmatf9lXgMUsjcWUwennMH9mph6QcBlvj4ltl6m33fHM6ybhQWf7XZl2UZSCfbyj4W7qX/6RxcIkMUUphZZXF6PzcN06YNCaiH6q51HNHNzt4qDn6QeCh5fbscwyOlZI35rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i6SQmQEh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i6SQmQEh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFE8CC4CEF1; Fri, 12 Sep 2025 12:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757681595; bh=uytak4k5ZwFQ8XmiI8MdssXPsqKkEtpvw0SvCwqCmRE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=i6SQmQEhcjS+ijLAZf/WLPVpXmWUJarwPLEXq4CyaseR6Qn7zzSKI8Oo3SbTNmUHH gyhmPZwxgHbPnkm0rj0H7GdxlM9LcUi/KNP2g2ybcPYySgpAWkeg27/CYmFabJ9cel fWg6Srh6CyFSG5qiLxwhFk74UY5yi58D05vqLen1t6syMiMYZ3Q8bRFONAPbmHCsQ3 kXAJ+fCg7HBgVXigczJNp6z5laJXDlEmZWH+qR6gvQuK+UZif9Mm5AzJsWnmTnK6zK vojaCrvh0cTk76QDDsmD0y9Xoubj4Z2K5VmtIEYCpTi45OXQl9+LRzlMapgOBUQ81M YnWpIaMmDq4Xw== From: "Matthieu Baerts (NGI0)" Date: Fri, 12 Sep 2025 14:52:23 +0200 Subject: [PATCH net 4/5] mptcp: tfo: record 'deny join id0' info Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-4-40171884ade8@kernel.org> References: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> In-Reply-To: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Florian Westphal , Kishen Maloor , Shuah Khan , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1408; i=matttbe@kernel.org; h=from:subject:message-id; bh=uytak4k5ZwFQ8XmiI8MdssXPsqKkEtpvw0SvCwqCmRE=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKOiK+UXLM76VzKU6V/zlN73MKVnocZ9C141BnA4thif inLWt+lo5SFQYyLQVZMkUW6LTJ/5vMq3hIvPwuYOaxMIEMYuDgFYCJ8/gz/VA++UI6/eEy34WXz W7PlMfs/nFT6+uiT1KpDCkZZuu/vRzD8L2h5+fnPhnOcR4/Ir9j+yuLVp+gZ4i57+V4nXItNPcs SzAEA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When TFO is used, the check to see if the 'C' flag (deny join id0) was set was bypassed. This flag can be set when TFO is used, so the check should also be done when TFO is used. Note that the set_fully_established label is also used when a 4th ACK is received. In this case, deny_join_id0 will not be set. Fixes: dfc8d0603033 ("mptcp: implement delayed seq generation for passive f= astopen") Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 2a8ea28442b271675411d190604073f779bee7fa..1103b3341a70560f563bfb21ca1= 43ce2f2c60321 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -985,13 +985,13 @@ static bool check_fully_established(struct mptcp_sock= *msk, struct sock *ssk, return false; } =20 - if (mp_opt->deny_join_id0) - WRITE_ONCE(msk->pm.remote_deny_join_id0, true); - if (unlikely(!READ_ONCE(msk->pm.server_side))) pr_warn_once("bogus mpc option on established client sk"); =20 set_fully_established: + if (mp_opt->deny_join_id0) + WRITE_ONCE(msk->pm.remote_deny_join_id0, true); + mptcp_data_lock((struct sock *)msk); __mptcp_subflow_fully_established(msk, subflow, mp_opt); mptcp_data_unlock((struct sock *)msk); --=20 2.51.0 From nobody Wed Sep 17 16:19:24 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 88DB73081D6; Fri, 12 Sep 2025 12:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681599; cv=none; b=bww1BJyuTJ3EUARWKenK/jJO9LYUiLiJlU70GEmZ+W2cq0QD+jVnZ1q1Qzy9j8WrQc4ol14IX9XB9JJDamuytcgn11Ccc+ETnQZgm5vpdh1rnqkKhhORtJl41rXIkr/BjQa0Oe4RWovYF2ZU7JsRBs17WtsjzCIUoYBPsFrj0ls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757681599; c=relaxed/simple; bh=HIFJWzHgSq2h9T+HcGgSfW0yc/cfScRA14LNQRiK9cc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J/NsNUAgBft4P+pn80UOsYQZwRUORrr3fhIZ6+gGM3BHJxZD+Rwbl2PasCCTJRYcnXYruaqeh1TaiZLbyGUtzoJynA1RQcjSwraYkrDVgV8b4uboIjV5DKUXD03/Zjg98+2yubl94HHoEFvvDxhWUuLbiuJYqEzn+DxbscZL1YM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g8Z6AOWz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g8Z6AOWz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30517C4CEF7; Fri, 12 Sep 2025 12:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757681599; bh=HIFJWzHgSq2h9T+HcGgSfW0yc/cfScRA14LNQRiK9cc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g8Z6AOWzQtjySqdPEHaBoUe5v1/Dv9qja9uhXY8w63kvwKNts9K9hbvwsBKdsBdQX yOlOhUn04h6zMWCOiPx/gLkLT+GfZOcuoZFXriEuIh6Sm2FYEVX5iVD6cA6oiWcicw iR+SFffpnXmwsmqQ2XXkfcVV7mGziQJlVVWzzwiNAoBC638T686YuGy5ZjscHXt1F/ Umw3Z1FnC1hWmvRJgPbWj/rxve520weSJPHFg8pPTLWGSLgOWI7Y5xPPPlYDRHEfqR vZu0iIT0js5EmGlfB3zCQUAPq1ppOPwP16L1DHY919Zy8INoiVaZq350jZSsa+0bNB RAU+i5yJ/UreA== From: "Matthieu Baerts (NGI0)" Date: Fri, 12 Sep 2025 14:52:24 +0200 Subject: [PATCH net 5/5] selftests: mptcp: sockopt: fix error messages Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-5-40171884ade8@kernel.org> References: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> In-Reply-To: <20250912-net-mptcp-pm-uspace-deny_join_id0-v1-0-40171884ade8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Florian Westphal , Kishen Maloor , Shuah Khan , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3129; i=matttbe@kernel.org; h=from:subject:message-id; bh=cpAk7g4LSetFcO9JBtJAi95qFs0Yx7aiWJZhlHLpHW0=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKOiK+aMkFTyfvr8xUhDedv9i339Nu+JdOh5Nne1tL3i rZBzsUnOkpZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACZSwsrIcKl97c+l3yM9V9q8 P35s5s5otp8pm//+2GvmE5q4+pnNRWdGhj2RyrqJNwoerXiw5VfhnwWrv2ZM/2KkbFdolS75W+F HBD8A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch fixes several issues in the error reporting of the MPTCP sockopt selftest: 1. Fix diff not printed: The error messages for counter mismatches had the actual difference ('diff') as argument, but it was missing in the format string. Displaying it makes the debugging easier. 2. Fix variable usage: The error check for 'mptcpi_bytes_acked' incorrectly used 'ret2' (sent bytes) for both the expected value and the difference calculation. It now correctly uses 'ret' (received bytes), which is the expected value for bytes_acked. 3. Fix off-by-one in diff: The calculation for the 'mptcpi_rcv_delta' diff was 's.mptcpi_rcv_delta - ret', which is off-by-one. It has been corrected to 's.mptcpi_rcv_delta - (ret + 1)' to match the expected value in the condition above it. Fixes: 5dcff89e1455 ("selftests: mptcp: explicitly tests aggregate counters= ") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/test= ing/selftests/net/mptcp/mptcp_sockopt.c index e934dd26a59d9b50445d61e8b8013ce3c8d2a8a0..112c07c4c37a3c827290a0b06d6= 307abca98c849 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c @@ -667,22 +667,26 @@ static void process_one_client(int fd, int pipefd) =20 do_getsockopts(&s, fd, ret, ret2); if (s.mptcpi_rcv_delta !=3D (uint64_t)ret + 1) - xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64, s.mptcpi_rcv_del= ta, ret + 1, s.mptcpi_rcv_delta - ret); + xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64 ", diff %" PRId64, + s.mptcpi_rcv_delta, ret + 1, s.mptcpi_rcv_delta - (ret + 1)); =20 /* be nice when running on top of older kernel */ if (s.pkt_stats_avail) { if (s.last_sample.mptcpi_bytes_sent !=3D ret2) - xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64, + xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64 + ", diff %" PRId64, s.last_sample.mptcpi_bytes_sent, ret2, s.last_sample.mptcpi_bytes_sent - ret2); if (s.last_sample.mptcpi_bytes_received !=3D ret) - xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64, + xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64 + ", diff %" PRId64, s.last_sample.mptcpi_bytes_received, ret, s.last_sample.mptcpi_bytes_received - ret); if (s.last_sample.mptcpi_bytes_acked !=3D ret) - xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64, - s.last_sample.mptcpi_bytes_acked, ret2, - s.last_sample.mptcpi_bytes_acked - ret2); + xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64 + ", diff %" PRId64, + s.last_sample.mptcpi_bytes_acked, ret, + s.last_sample.mptcpi_bytes_acked - ret); } =20 close(fd); --=20 2.51.0