* [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support
@ 2022-02-21 6:12 Geliang Tang
2022-02-21 6:12 ` [PATCH iproute2-next v2 1/3] mptcp: add fullmesh check for adding address Geliang Tang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Geliang Tang @ 2022-02-21 6:12 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This is v2 I try to send to net-dev, v1 was marked as Changes Requested.
I did some updates for it, so I send it to our ML for review first.
v2:
- split into three patches, each one does one thing.
- update the commit log.
base-commit: 4f015972988a5f5d74e1f5f6435d08506eedca15
Geliang Tang (3):
mptcp: add fullmesh check for adding address
mptcp: add fullmesh support for setting flags
mptcp: add port support for setting flags
ip/ipmptcp.c | 28 ++++++++++++++++++++--------
man/man8/ip-mptcp.8 | 17 ++++++++++++-----
2 files changed, 32 insertions(+), 13 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH iproute2-next v2 1/3] mptcp: add fullmesh check for adding address 2022-02-21 6:12 [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support Geliang Tang @ 2022-02-21 6:12 ` Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 3/3] mptcp: add port " Geliang Tang 2 siblings, 0 replies; 6+ messages in thread From: Geliang Tang @ 2022-02-21 6:12 UTC (permalink / raw) To: mptcp; +Cc: Geliang Tang, Mat Martineau 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(+) 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)) -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags 2022-02-21 6:12 [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 1/3] mptcp: add fullmesh check for adding address Geliang Tang @ 2022-02-21 6:12 ` Geliang Tang 2022-02-23 1:23 ` Mat Martineau 2022-02-21 6:12 ` [PATCH iproute2-next v2 3/3] mptcp: add port " Geliang Tang 2 siblings, 1 reply; 6+ messages in thread From: Geliang Tang @ 2022-02-21 6:12 UTC (permalink / raw) To: mptcp; +Cc: Geliang Tang, Paolo Abeni, Mat Martineau A pair of new flags, fullmesh and nofullmesh, had been added in the setting flags of MPTCP PM netlink in kernel space recently by the commit 73c762c1f07d ("mptcp: set fullmesh flag in pm_netlink"). This patch added the corresponding logic to pass these two flags to the netlink in user space. These new flags can be used like this: ip mptcp endpoint change id 1 fullmesh ip mptcp endpoint change id 1 nofullmesh ip mptcp endpoint change id 1 backup fullmesh ip mptcp endpoint change id 1 nobackup nofullmesh Acked-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Geliang Tang <geliang.tang@suse.com> --- ip/ipmptcp.c | 18 +++++++++++------- man/man8/ip-mptcp.8 | 8 ++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 0b744720..247d1caf 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -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,9 +124,10 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) (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)) + /* allow changing the 'backup' and 'fullmesh' flags only */ + if (setting && + (flags & ~(MPTCP_PM_ADDR_FLAG_BACKUP | + MPTCP_PM_ADDR_FLAG_FULLMESH))) invarg("invalid flags\n", *argv); } else if (matches(*argv, "id") == 0) { diff --git a/man/man8/ip-mptcp.8 b/man/man8/ip-mptcp.8 index 0e789225..bddbff3c 100644 --- a/man/man8/ip-mptcp.8 +++ b/man/man8/ip-mptcp.8 @@ -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 -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags 2022-02-21 6:12 ` [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags Geliang Tang @ 2022-02-23 1:23 ` Mat Martineau 0 siblings, 0 replies; 6+ messages in thread From: Mat Martineau @ 2022-02-23 1:23 UTC (permalink / raw) To: Geliang Tang; +Cc: mptcp, Paolo Abeni On Mon, 21 Feb 2022, Geliang Tang wrote: > A pair of new flags, fullmesh and nofullmesh, had been added in the > setting flags of MPTCP PM netlink in kernel space recently by the commit > 73c762c1f07d ("mptcp: set fullmesh flag in pm_netlink"). > > This patch added the corresponding logic to pass these two flags to the > netlink in user space. > > These new flags can be used like this: > > ip mptcp endpoint change id 1 fullmesh > ip mptcp endpoint change id 1 nofullmesh > ip mptcp endpoint change id 1 backup fullmesh > ip mptcp endpoint change id 1 nobackup nofullmesh > I suggest you add an example here in the commit message that includes 'ip mptcp endpoint show' and mention that it already supports showing the 'fullmesh' flag. I think that's what Stephan was asking about on netdev. Other than that, the series looks good. Thanks. Mat > Acked-by: Paolo Abeni <pabeni@redhat.com> > Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com> > Signed-off-by: Geliang Tang <geliang.tang@suse.com> > --- > ip/ipmptcp.c | 18 +++++++++++------- > man/man8/ip-mptcp.8 | 8 ++++++-- > 2 files changed, 17 insertions(+), 9 deletions(-) > > diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c > index 0b744720..247d1caf 100644 > --- a/ip/ipmptcp.c > +++ b/ip/ipmptcp.c > @@ -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,9 +124,10 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) > (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)) > + /* allow changing the 'backup' and 'fullmesh' flags only */ > + if (setting && > + (flags & ~(MPTCP_PM_ADDR_FLAG_BACKUP | > + MPTCP_PM_ADDR_FLAG_FULLMESH))) > invarg("invalid flags\n", *argv); > > } else if (matches(*argv, "id") == 0) { > diff --git a/man/man8/ip-mptcp.8 b/man/man8/ip-mptcp.8 > index 0e789225..bddbff3c 100644 > --- a/man/man8/ip-mptcp.8 > +++ b/man/man8/ip-mptcp.8 > @@ -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 > -- > 2.34.1 > > -- Mat Martineau Intel ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH iproute2-next v2 3/3] mptcp: add port support for setting flags 2022-02-21 6:12 [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 1/3] mptcp: add fullmesh check for adding address Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags Geliang Tang @ 2022-02-21 6:12 ` Geliang Tang 2 siblings, 0 replies; 6+ messages in thread From: Geliang Tang @ 2022-02-21 6:12 UTC (permalink / raw) To: mptcp; +Cc: Geliang Tang, Mat Martineau 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> --- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support @ 2022-02-23 2:59 Geliang Tang 0 siblings, 0 replies; 6+ messages in thread From: Geliang Tang @ 2022-02-23 2:59 UTC (permalink / raw) To: Stephen Hemminger, David Ahern; +Cc: Geliang Tang, netdev, mptcp This patchset added the fullmesh flags setting, the related flags checks and updated the usage. v2: - split into three patches, each one does one thing. - update the commit log. base-commit: e8fd4d4b8448c1e1dfe56b260af50c191a3f4cdd Geliang Tang (3): mptcp: add fullmesh check for adding address mptcp: add fullmesh support for setting flags mptcp: add port support for setting flags ip/ipmptcp.c | 28 ++++++++++++++++++++-------- man/man8/ip-mptcp.8 | 17 ++++++++++++----- 2 files changed, 32 insertions(+), 13 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-23 2:59 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-02-21 6:12 [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 1/3] mptcp: add fullmesh check for adding address Geliang Tang 2022-02-21 6:12 ` [PATCH iproute2-next v2 2/3] mptcp: add fullmesh support for setting flags Geliang Tang 2022-02-23 1:23 ` Mat Martineau 2022-02-21 6:12 ` [PATCH iproute2-next v2 3/3] mptcp: add port " Geliang Tang -- strict thread matches above, loose matches on Subject: below -- 2022-02-23 2:59 [PATCH iproute2-next v2 0/3] mptcp: add the fullmesh flag setting support Geliang Tang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.