From nobody Thu Nov 27 12:37:17 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 7F8FC8462 for ; Wed, 26 Nov 2025 18:31:24 +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=1764181884; cv=none; b=DnP1XLQadvP6FGkEdhpX6ENgkyKXvB23EwqxG6dnAOG2Gl8Y06d+oCWHNB/casZgmAfXZkHqWnH89NgrkfJA8ywUN0kBUdmPeq/iTSnVsOL3M5GrnSgjcc5lnAbbj+IwHqMy0fu2WfBH4Z3daIpf0BFImNpBVLfyDlu1DmK6s8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764181884; c=relaxed/simple; bh=oWDb2ylL1XiSI5MQqx19XRUboiHTT08OtPrMvbPD/Es=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jc9/hasR9ZOdL2Z3V5FP8cNjEVzngAA1UwCZ4Uj4DGbO8QsY5FfOV/f6x8bau820Wr4yKVUWudNExeeeSX/ywhHreeBjAPEMAUstYiNGWR37bp6zrLXS+1/+fxZxQ13TjhIsO8Ots8lD64gK4MNxLlJ72Cq0WPvlKWEqn5cMQ+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HP74cIL8; 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="HP74cIL8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99583C4CEF8; Wed, 26 Nov 2025 18:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764181884; bh=oWDb2ylL1XiSI5MQqx19XRUboiHTT08OtPrMvbPD/Es=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HP74cIL8JKBB3qfKkWnaOCo9SdzAP8GSy47vE8sYlefWpHZfI0EJkEwYcUHLqEUOL lCTsM0xz/d2wKMhnBpFy5a5EaxxcJQ2MtwUT81NdIDVuO0UBgn/JcaGNG5NshDyzSb DB0ReiDJR2HJsDJ+eayI2bzaw4NbBBczuXhgD/6dFbQCA/hrHXTfq1HyHuwjoTxD11 I3giqPxenvbXVjkwZDnLgRuPiHb+eASTKEfhXeed9WSfWV5b3j3aj8UwX3aWFNY0RC M+vMufc2qRDM2udtXdDge1TMBDD7to9T9TvXAHH9NidFVaSMhU7kRYpZu3aU/9Jcbn SezuMrtxAFplA== From: "Matthieu Baerts (NGI0)" Date: Wed, 26 Nov 2025 19:31:09 +0100 Subject: [PATCH mptcp-net 1/3] mptcp: pm: ignore unknown endpoint flags 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: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-1-d2e4c2ebce0c@kernel.org> References: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> In-Reply-To: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> To: MPTCP Upstream Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2294; i=matttbe@kernel.org; h=from:subject:message-id; bh=oWDb2ylL1XiSI5MQqx19XRUboiHTT08OtPrMvbPD/Es=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDLV3cudM/hdf+UvzH0yew9T2KzcLe1Xrx6dqXPINsew6 ln8vzcHO0pZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACbis52R4dP/aTcs93JxPFTN TqvLcDp1/k8Ms4ThzzPrF110Uk+/6szI8F75hbzywZ4X4m92el+Zt/GLZWTax80BHLfM/804cFf /NT8A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Before this patch, the kernel was saving any flags set by the userspace, even unknown ones. This doesn't cause critical issues because the kernel is only looking at specific ones. But on the other hand, endpoints dumps could tell the userspace some recent flags seem to be supported on older kernel versions. Instead, ignore all unknown flags when parsing them. By doing that, the userspace can continue to set unsupported flags, but it has a way to verify what is supported by the kernel. Note that it sounds better to continue accepting unsupported flags not to change the behaviour, but also that eases things on the userspace side by adding "optional" endpoint types only supported by newer kernel versions without having to deal with the different kernel versions. A note for the backports: there will be conflicts in mptcp.h on older versions not having the mentioned flags, the new line should still be added last, and the '5' needs to be adapted to have the same value as the last entry. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- include/uapi/linux/mptcp.h | 1 + net/mptcp/pm_netlink.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 04eea6d1d0a9..72a5d030154e 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -40,6 +40,7 @@ #define MPTCP_PM_ADDR_FLAG_FULLMESH _BITUL(3) #define MPTCP_PM_ADDR_FLAG_IMPLICIT _BITUL(4) #define MPTCP_PM_ADDR_FLAG_LAMINAR _BITUL(5) +#define MPTCP_PM_ADDR_FLAGS_MASK GENMASK(5, 0) =20 struct mptcp_info { __u8 mptcpi_subflows; diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d5b383870f79..7aa42de9c47b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -119,7 +119,8 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct ge= nl_info *info, } =20 if (tb[MPTCP_PM_ADDR_ATTR_FLAGS]) - entry->flags =3D nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]); + entry->flags =3D nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]) & + MPTCP_PM_ADDR_FLAGS_MASK; =20 if (tb[MPTCP_PM_ADDR_ATTR_PORT]) entry->addr.port =3D htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT])); --=20 2.51.0 From nobody Thu Nov 27 12:37:17 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 5493C8462 for ; Wed, 26 Nov 2025 18:31:25 +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=1764181885; cv=none; b=U/9X2l8vOMtilGVWmYT9Nx4h0A8O7QnNk3ZR2bcbzgnIpvD9Eay+wAzsk66NBAM1t0aZpVthnK22qk1EqXyJLmFfcAf0maP3vIUjSJgb9jrk7qL/plked8cbGhsdT3UE2WChXcGClKBaWdGa+FpJyoq6RYJ1jwEdsvGke1S7WfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764181885; c=relaxed/simple; bh=MhLPNzdTWtfH1tgVNYZ+dFModedBNk/+vgcSo4LUjhs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lefKxpzk4NSYTL+V2ooXK4cv6p5Qo/JcsQU6iGV7hiuZrjJDJ//JwvkAUZ77ZvmH0eHAbsDv+dVqS95xS2jNdVExuHD+Iv0p+zCkh770F0Ulgufc6ieA26eYQE0SF19EnhanPlH3NzaPfRrjuC+pDaUVoH03yoFxscwbhj0ktis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oDCZfVCu; 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="oDCZfVCu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763D4C4CEF7; Wed, 26 Nov 2025 18:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764181884; bh=MhLPNzdTWtfH1tgVNYZ+dFModedBNk/+vgcSo4LUjhs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oDCZfVCuWbXdxaRZ7b9QQS/eXuhMjPdx+NsfRFU3XJE/ZlLxTGWZ/V3MV5IJu9pix GjH2eFprAdljJNYaf7Gi1Rvse7YuOBtVDDJOdUodCxrCb6j8t0yk+fQ0gf17W76kwV oydSEBQg8Glvar5O1KNCQQSIIEMt8bEbiW4/hmul+MpvB1Iywuic1uFDjK4DcxD8gW bvn7OVZT8my8VwoG0coJyNXQrfE8VGkbDYkwaCvi7W+ERCVH8u3r+fNiTVy+BceLNI 4VLzdKcbfKM4epgwUffnv17MMedXv1B9TU0hQh1r1jOru5sHnscdRLjq5mD6/sHSzH IX5EyGx8JoDGw== From: "Matthieu Baerts (NGI0)" Date: Wed, 26 Nov 2025 19:31:10 +0100 Subject: [PATCH mptcp-net 2/3] selftests: mptcp: pm: ensure unknown flags are ignored 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: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-2-d2e4c2ebce0c@kernel.org> References: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> In-Reply-To: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> To: MPTCP Upstream Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2569; i=matttbe@kernel.org; h=from:subject:message-id; bh=MhLPNzdTWtfH1tgVNYZ+dFModedBNk/+vgcSo4LUjhs=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDLV3SvWf/msUrqayfWxdVP7XraGdef9t9jFrFonYJi+q HhdSvn2jlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIk8+MvwP2Ji4WzWhpfVD9K/ F4Y9tjt3oEY38G9R3eoFvPmu+7/WSDMyPFFdtFvNU4fv6/GOUJtajlWByRb3T/Nctln9Tz2uNvU 1NwA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This validates the previous commit: the userspace can set unknown flags -- the 7th bit is currently unused -- without errors, but only the supported ones are printed in the endpoints dumps. 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: 01cacb00b35c ("mptcp: add netlink-based PM") Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 4 ++++ tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testin= g/selftests/net/mptcp/pm_netlink.sh index ec6a87588191..123d9d7a0278 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -192,6 +192,10 @@ check "show_endpoints" \ flush_endpoint check "show_endpoints" "" "flush addrs" =20 +add_endpoint 10.0.1.1 flags unknown +check "show_endpoints" "$(format_endpoints "1,10.0.1.1")" "ignore unknown = flags" +flush_endpoint + set_limits 9 1 2>/dev/null check "get_limits" "${default_limits}" "rcv addrs above hard limit" =20 diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/= selftests/net/mptcp/pm_nl_ctl.c index 65b374232ff5..99eecccbf0c8 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -24,6 +24,8 @@ #define IPPROTO_MPTCP 262 #endif =20 +#define MPTCP_PM_ADDR_FLAG_UNKNOWN _BITUL(7) + static void syntax(char *argv[]) { fprintf(stderr, "%s add|ann|rem|csf|dsf|get|set|del|flush|dump|events|lis= ten|accept []\n", argv[0]); @@ -836,6 +838,8 @@ int add_addr(int fd, int pm_family, int argc, char *arg= v[]) flags |=3D MPTCP_PM_ADDR_FLAG_BACKUP; else if (!strcmp(tok, "fullmesh")) flags |=3D MPTCP_PM_ADDR_FLAG_FULLMESH; + else if (!strcmp(tok, "unknown")) + flags |=3D MPTCP_PM_ADDR_FLAG_UNKNOWN; else error(1, errno, "unknown flag %s", argv[arg]); @@ -1048,6 +1052,13 @@ static void print_addr(struct rtattr *attrs, int len) printf(","); } =20 + if (flags & MPTCP_PM_ADDR_FLAG_UNKNOWN) { + printf("unknown"); + flags &=3D ~MPTCP_PM_ADDR_FLAG_UNKNOWN; + if (flags) + printf(","); + } + /* bump unknown flags, if any */ if (flags) printf("0x%x", flags); --=20 2.51.0 From nobody Thu Nov 27 12:37:17 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 2C6C78462 for ; Wed, 26 Nov 2025 18:31:25 +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=1764181886; cv=none; b=jh5G/9/h8xDFz2lz/7uYCzwgBhZCkfXCzxesshRwsy0c///izUc8K8vbZkgcNOb8/VVuKgKuSNGFHIlQQpjnBcnwctw+qxESsyaxy6oQGaq2aUh8rLmtTi9h1CSmzG+nq3gDYOS6xZFQAwJTPLr/tU4tkTyGSgAo8c3t87HGeKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764181886; c=relaxed/simple; bh=ATsuF4obbflErMUuDj0V1hDDZSOEjOmOnDC//M7VLjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hOBSGgNVQTbHmzJzwXLij11hM0AuH9dmIm1kq9ciIzvniIspNwqkPXKTRAYO9wYlBjA0ia+kYwW4uhumUylu1Slr9e4H5YmAMEMqZR2CXROCQgszGRksHd49KIF+KmyhzxK3Q/QjMisCBiPRrZJ4tTSEjIKHNzvNciofWB+qLvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lCprx91c; 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="lCprx91c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 530CBC4CEF8; Wed, 26 Nov 2025 18:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764181885; bh=ATsuF4obbflErMUuDj0V1hDDZSOEjOmOnDC//M7VLjI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lCprx91cVWsQqPfIk4jjpPhIG5tDmZPpvWjaW+rGept9USb3gw23aYVt/Uabn/Oft t305v4/YiBq9ADH3itsXPtZCpFG8iblqpDVQ+Iq6iUi37eSWgxHhbmSwVMsqhMBLO7 fTux5/AH2s16Mf0/g7wsul5/MD6o6HhmMcLA4XvXqnPufPskymAfJwtQ1LM6vIC3sy KYx5a95BK0uwgwu2q6ufgJYitjUeklRIW5RArxjYXYbKJtJQyzCAn3T53fzbNr1fP4 iSqBw536PclLlGWb0l6dBrb2mxdL1sqo5wLwW36i88AEGSayqlUQiZ4RF1l9bCFrNn e2zEeiWKKxKfQ== From: "Matthieu Baerts (NGI0)" Date: Wed, 26 Nov 2025 19:31:11 +0100 Subject: [PATCH mptcp-net 3/3] mptcp: pm: align endpoint flags size with the NL specs 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: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-3-d2e4c2ebce0c@kernel.org> References: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> In-Reply-To: <20251126-mptcp-pm-kern-drop-unknown-flags-v1-0-d2e4c2ebce0c@kernel.org> To: MPTCP Upstream Cc: "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1228; i=matttbe@kernel.org; h=from:subject:message-id; bh=ATsuF4obbflErMUuDj0V1hDDZSOEjOmOnDC//M7VLjI=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDLV3atiA+KmRi8usmos617yaEuI5JINR583f3l0MWIL3 +bp+fv0OkpZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACYyv4fhn70OR1j32sAo9Z6L to8L05jXRvzi5F6h/eagmdXO6q47xxgZTr3aWWy6QriE6W9D2esdmy3WftNwWOx7QivNM6x9/u6 9rAA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The MPTCP Netlink specs describe the 'flags' as a u32 type. Internally, a u8 type was used. Using a u8 is currently fine, because only the 5 first bits are used. But there is also no reason not to be aligns with the specs, and to stick to a u8. Especially because there is a whole of 3 bytes after in both mptcp_pm_local and mptcp_pm_addr_entry structures. Also, setting it to a u32 will allow future flags, just in case. Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau --- This is for mptcp-next, and it explains why setting flags between the 8th to the 31st bit in the previous patch didn't have any effect. --- net/mptcp/protocol.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 199f28f3dd5e..d98c0cfa5889 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -247,14 +247,14 @@ struct mptcp_pm_data { =20 struct mptcp_pm_local { struct mptcp_addr_info addr; - u8 flags; + u32 flags; int ifindex; }; =20 struct mptcp_pm_addr_entry { struct list_head list; struct mptcp_addr_info addr; - u8 flags; + u32 flags; int ifindex; struct socket *lsk; }; --=20 2.51.0