Skip to content

Commit 0ace329

Browse files
matttbekuba-moo
authored andcommitted
mptcp: pm: ignore unknown endpoint flags
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: 01cacb0 ("mptcp: add netlink-based PM") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20251205-net-mptcp-misc-fixes-6-19-rc1-v1-1-9e4781a6c1b8@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent db6b35c commit 0ace329

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

include/uapi/linux/mptcp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define MPTCP_PM_ADDR_FLAG_FULLMESH _BITUL(3)
4141
#define MPTCP_PM_ADDR_FLAG_IMPLICIT _BITUL(4)
4242
#define MPTCP_PM_ADDR_FLAG_LAMINAR _BITUL(5)
43+
#define MPTCP_PM_ADDR_FLAGS_MASK GENMASK(5, 0)
4344

4445
struct mptcp_info {
4546
__u8 mptcpi_subflows;

net/mptcp/pm_netlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
119119
}
120120

121121
if (tb[MPTCP_PM_ADDR_ATTR_FLAGS])
122-
entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]);
122+
entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]) &
123+
MPTCP_PM_ADDR_FLAGS_MASK;
123124

124125
if (tb[MPTCP_PM_ADDR_ATTR_PORT])
125126
entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));

0 commit comments

Comments
 (0)