[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <387a16252f20df06f0926d5e8ca328ce288b864f.1645584573.git.geliang.tang@suse.com>
Date: Wed, 23 Feb 2022 10:59:49 +0800
From: Geliang Tang <geliang.tang@...e.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...nel.org>
CC: Geliang Tang <geliang.tang@...e.com>, netdev@...r.kernel.org,
mptcp@...ts.linux.dev,
Mat Martineau <mathew.j.martineau@...ux.intel.com>
Subject: [PATCH iproute2-next v2 3/3] 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@...ux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@...e.com>
---
ip/ipmptcp.c | 7 +++++--
man/man8/ip-mptcp.8 | 11 +++++++----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index 247d1caf..b06afcf7 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 bddbff3c..72762f49 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 "
--
2.34.1
Powered by blists - more mailing lists