aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliang.tang@suse.com>2022-02-23 14:50:37 +0800
committerDavid Ahern <dsahern@kernel.org>2022-02-27 18:41:23 -0700
commit5fb6bda0680a9dcac206c40ee3211abf8507baa4 (patch)
tree4aa5648140531fa3063a629ad80cee61a82d7aed
parent9831202f2125d2822e725fea61097b17eb994fca (diff)
downloadiproute2-5fb6bda0680a9dcac206c40ee3211abf8507baa4.tar.gz
mptcp: add fullmesh check for adding address
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>
-rw-r--r--ip/ipmptcp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index eef7c6f40..5682c7df3 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -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))