]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: mptcp: pm: ensure unknown flags are ignored
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 5 Dec 2025 18:55:15 +0000 (19:55 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Dec 2025 07:54:02 +0000 (23:54 -0800)
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")
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-2-9e4781a6c1b8@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/pm_netlink.sh
tools/testing/selftests/net/mptcp/pm_nl_ctl.c

index ec6a8758819194f2c53791d76ae68e088f188813..123d9d7a0278cdda14c7745946beaeb5cac60990 100755 (executable)
@@ -192,6 +192,10 @@ check "show_endpoints" \
 flush_endpoint
 check "show_endpoints" "" "flush addrs"
 
+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"
 
index 65b374232ff5ac06876dcd621fd2109c4d82cd12..99eecccbf0c8764bff203549535fe243bb2664d2 100644 (file)
@@ -24,6 +24,8 @@
 #define IPPROTO_MPTCP 262
 #endif
 
+#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|listen|accept [<args>]\n", argv[0]);
@@ -836,6 +838,8 @@ int add_addr(int fd, int pm_family, int argc, char *argv[])
                                        flags |= MPTCP_PM_ADDR_FLAG_BACKUP;
                                else if (!strcmp(tok, "fullmesh"))
                                        flags |= MPTCP_PM_ADDR_FLAG_FULLMESH;
+                               else if (!strcmp(tok, "unknown"))
+                                       flags |= 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(",");
                        }
 
+                       if (flags & MPTCP_PM_ADDR_FLAG_UNKNOWN) {
+                               printf("unknown");
+                               flags &= ~MPTCP_PM_ADDR_FLAG_UNKNOWN;
+                               if (flags)
+                                       printf(",");
+                       }
+
                        /* bump unknown flags, if any */
                        if (flags)
                                printf("0x%x", flags);