aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliang.tang@suse.com>2022-02-23 14:50:39 +0800
committerDavid Ahern <dsahern@kernel.org>2022-02-27 18:41:29 -0700
commitbea92cb07655abdaf6bce72998a6e2be39c0bc69 (patch)
tree1b2cc75d7d50be562b723ee1afe8ec51d6f7f4c3
parent2dbc6c904170f0c93ae89cba11d5339aba8ff6d6 (diff)
downloadiproute2-bea92cb07655abdaf6bce72998a6e2be39c0bc69.tar.gz
mptcp: add port support for setting flags
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>
-rw-r--r--ip/ipmptcp.c7
-rw-r--r--man/man8/ip-mptcp.811
2 files changed, 12 insertions, 6 deletions
diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index c7b63761c..0033f329b 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -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)
diff --git a/man/man8/ip-mptcp.8 b/man/man8/ip-mptcp.8
index bddbff3c8..72762f494 100644
--- a/man/man8/ip-mptcp.8
+++ b/man/man8/ip-mptcp.8
@@ -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 "