@@ -25,14 +25,15 @@ 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 [ backup | nobackup ]\n"
+ " ip mptcp endpoint change id ID 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"
" ip mptcp limits show\n"
" ip mptcp monitor\n"
"FLAG-LIST := [ FLAG-LIST ] FLAG\n"
- "FLAG := [ signal | subflow | backup | fullmesh ]\n");
+ "FLAG := [ signal | subflow | backup | fullmesh ]\n"
+ "CHANGE-OPT := [ backup | nobackup | fullmesh | nofullmesh ]\n");
exit(-1);
}
@@ -46,7 +47,7 @@ static int genl_family = -1;
GENL_REQUEST(_req, MPTCP_BUFLEN, genl_family, 0, \
MPTCP_PM_VER, _cmd, _flags)
-#define MPTCP_PM_ADDR_FLAG_NOBACKUP 0x0
+#define MPTCP_PM_ADDR_FLAG_NONE 0x0
/* Mapping from argument to address flag mask */
static const struct {
@@ -57,7 +58,8 @@ static const struct {
{ "subflow", MPTCP_PM_ADDR_FLAG_SUBFLOW },
{ "backup", MPTCP_PM_ADDR_FLAG_BACKUP },
{ "fullmesh", MPTCP_PM_ADDR_FLAG_FULLMESH },
- { "nobackup", MPTCP_PM_ADDR_FLAG_NOBACKUP }
+ { "nobackup", MPTCP_PM_ADDR_FLAG_NONE },
+ { "nofullmesh", MPTCP_PM_ADDR_FLAG_NONE }
};
static void print_mptcp_addr_flags(unsigned int flags)
@@ -102,6 +104,7 @@ static int get_flags(const char *arg, __u32 *flags)
static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
{
+ bool setting = cmd == MPTCP_PM_CMD_SET_FLAGS;
bool adding = cmd == MPTCP_PM_CMD_ADD_ADDR;
bool deling = cmd == MPTCP_PM_CMD_DEL_ADDR;
struct rtattr *attr_addr;
@@ -121,10 +124,11 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd)
(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))
- invarg("invalid flags\n", *argv);
+ /* allow changing the 'backup' and 'fullmesh' flags only */
+ if (setting &&
+ (flags & ~(MPTCP_PM_ADDR_FLAG_BACKUP |
+ MPTCP_PM_ADDR_FLAG_FULLMESH)))
+ invarg("invalid flags, backup and fullmesh only", *argv);
} else if (matches(*argv, "id") == 0) {
NEXT_ARG();
@@ -41,7 +41,7 @@ ip-mptcp \- MPTCP path manager configuration
.BR "ip mptcp endpoint change id "
.I ID
.RB "[ "
-.I BACKUP-OPT
+.I CHANGE-OPT
.RB "] "
.ti -8
@@ -68,10 +68,14 @@ ip-mptcp \- MPTCP path manager configuration
.RB "]"
.ti -8
-.IR BACKUP-OPT " := ["
+.IR CHANGE-OPT " := ["
.B backup
.RB "|"
.B nobackup
+.RB "|"
+.B fullmesh
+.RB "|"
+.B nofullmesh
.RB "]"
.ti -8