]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
mptcp: add fullmesh check for adding address
authorGeliang Tang <geliang.tang@suse.com>
Wed, 23 Feb 2022 06:50:37 +0000 (14:50 +0800)
committerDavid Ahern <dsahern@kernel.org>
Mon, 28 Feb 2022 01:41:23 +0000 (18:41 -0700)
The fullmesh flag mustn't be used with the signal flag when adding an
address. Commands like this should be treated as invalid commands:

 ip mptcp endpoint add 10.0.2.1 signal fullmesh

This patch added the necessary flags check for this case.

Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipmptcp.c

index eef7c6f40b4781175606265659b3157f9eee2010..5682c7df35c7da5a07bb50787435520d78f38250 100644 (file)
@@ -116,6 +116,11 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
        ll_init_map(&rth);
        while (argc > 0) {
                if (get_flags(*argv, &flags) == 0) {
+                       if (adding &&
+                           (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
+                           (flags & MPTCP_PM_ADDR_FLAG_FULLMESH))
+                               invarg("flags mustn't have both signal and fullmesh", *argv);
+
                        /* allow changing the 'backup' flag only */
                        if (cmd == MPTCP_PM_CMD_SET_FLAGS &&
                            (flags & ~MPTCP_PM_ADDR_FLAG_BACKUP))