]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
mptcp: add port support for setting flags
authorGeliang Tang <geliang.tang@suse.com>
Wed, 23 Feb 2022 06:50:39 +0000 (14:50 +0800)
committerDavid Ahern <dsahern@kernel.org>
Mon, 28 Feb 2022 01:41:29 +0000 (18:41 -0700)
This patch updated the port keyword check for the setting flags, allow
to use the port keyword with the non-signal flags. Don't allow to use
the port keyword with the id number.

With this patch, we can use setting flags in two forms, using the address
and port number directly or the id number of the address:

 ip mptcp endpoint change id 1 fullmesh
 ip mptcp endpoint change 10.0.2.1 fullmesh
 ip mptcp endpoint change 10.0.2.1 port 10100 fullmesh

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
man/man8/ip-mptcp.8

index c7b63761caec368f0a78a51fe08b5855292caed8..0033f329bdefc209679c370ab0c82d349be4d65f 100644 (file)
@@ -25,7 +25,7 @@ static void usage(void)
                "Usage: ip mptcp endpoint add ADDRESS [ dev NAME ] [ id ID ]\n"
                "                                     [ port NR ] [ FLAG-LIST ]\n"
                "       ip mptcp endpoint delete id ID [ ADDRESS ]\n"
-               "       ip mptcp endpoint change id ID CHANGE-OPT\n"
+               "       ip mptcp endpoint change [ id ID ] [ ADDRESS ] [ port NR ] CHANGE-OPT\n"
                "       ip mptcp endpoint show [ id ID ]\n"
                "       ip mptcp endpoint flush\n"
                "       ip mptcp limits set [ subflows NR ] [ add_addr_accepted NR ]\n"
@@ -175,9 +175,12 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
                        invarg("address is needed for deleting id 0 address\n", "ID");
        }
 
-       if (port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
+       if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))
                invarg("flags must have signal when using port", "port");
 
+       if (setting && id_set && port)
+               invarg("port can't be used with id", "port");
+
        attr_addr = addattr_nest(n, MPTCP_BUFLEN,
                                 MPTCP_PM_ATTR_ADDR | NLA_F_NESTED);
        if (id_set)
index bddbff3c8bafe03bbe632075cdde4969e29a678a..72762f49432ef4a4a8bff20c02932cae2831d17b 100644 (file)
@@ -38,11 +38,14 @@ ip-mptcp \- MPTCP path manager configuration
 .RB "] "
 
 .ti -8
-.BR "ip mptcp endpoint change id "
+.BR "ip mptcp endpoint change "
+.RB "[ " id
 .I ID
-.RB "[ "
-.I CHANGE-OPT
-.RB "] "
+.RB "] [ "
+.IR IFADDR
+.RB "] [ " port
+.IR PORT " ]"
+.RB "CHANGE-OPT"
 
 .ti -8
 .BR "ip mptcp endpoint show "