diff mbox series

[iproute2-next,v2,1/3] mptcp: add fullmesh check for adding address

Message ID 295a693ecc4ec1c3c241db0999d97d8718b7d992.1645584573.git.geliang.tang@suse.com (mailing list archive)
State Superseded
Delegated to: David Ahern
Headers show
Series mptcp: add the fullmesh flag setting support | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Geliang Tang Feb. 23, 2022, 2:59 a.m. UTC
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>
---
 ip/ipmptcp.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stephen Hemminger Feb. 23, 2022, 3:08 a.m. UTC | #1
On Wed, 23 Feb 2022 10:59:47 +0800
Geliang Tang <geliang.tang@suse.com> wrote:

> +			if (adding &&
> +			    (flags & MPTCP_PM_ADDR_FLAG_SIGNAL) &&
> +			    (flags & MPTCP_PM_ADDR_FLAG_FULLMESH))
> +				invarg("invalid flags\n", *argv)

There is a duplicate newline here, the message already gets newline from invarg().
If possible could you give explanation to the user.

Looks like mptcp has this in lots of places, and would be helpful
to give better response.
diff mbox series

Patch

diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index eef7c6f4..0b744720 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("invalid flags\n", *argv);
+
 			/* allow changing the 'backup' flag only */
 			if (cmd == MPTCP_PM_CMD_SET_FLAGS &&
 			    (flags & ~MPTCP_PM_ADDR_FLAG_BACKUP))