All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next v5 0/2] add the id argument for set_flags
@ 2022-01-26  2:56 Geliang Tang
  2022-01-26  2:56 ` [PATCH mptcp-next v5 1/2] selftests: mptcp: " Geliang Tang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Geliang Tang @ 2022-01-26  2:56 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

v5:
v4:
 - update the output of pm_netlink.sh

v3:
 - update the usage of set_flags in #1
 - check more of the intermediate states with "pm_nl_ctl dump" in #2

v2:
 - make standalone patches, instead of squash-to ones.
 - add test cases in pm_netlink.sh, instead of mptcp_join.sh

Add the id argument for 'pm_nl_ctl set', and allow to use the port keyword
with the non-signal flags for the setting flags in 'ip mptcp endpoint
change', more commands can be used to set the address flags:

 pm_nl_ctl set 10.0.2.1 flags backup port 10100
 pm_nl_ctl set id 1 flags backup
 ip mptcp endpoint change id 1 backup
 ip mptcp endpoint change 10.0.2.1 backup port 10100

Geliang Tang (2):
  selftests: mptcp: add the id argument for set_flags
  selftests: mptcp: add set_flags tests in pm_netlink.sh

 .../testing/selftests/net/mptcp/pm_netlink.sh | 18 ++++++
 tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 63 ++++++++++++-------
 2 files changed, 60 insertions(+), 21 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH mptcp-next v5 1/2] selftests: mptcp: add the id argument for set_flags
  2022-01-26  2:56 [PATCH mptcp-next v5 0/2] add the id argument for set_flags Geliang Tang
@ 2022-01-26  2:56 ` Geliang Tang
  2022-01-26  2:56 ` [PATCH mptcp-next v5 2/2] selftests: mptcp: add set_flags tests in pm_netlink.sh Geliang Tang
  2022-01-26 21:45 ` [PATCH mptcp-next v5 0/2] add the id argument for set_flags Mat Martineau
  2 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2022-01-26  2:56 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added the id argument for setting the address flags in
pm_nl_ctl.

Usage:

    pm_nl_ctl set id 1 flags backup

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 63 ++++++++++++-------
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index 2a57462764d0..22a5ec1e128e 100644
--- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
+++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
@@ -28,7 +28,7 @@ static void syntax(char *argv[])
 	fprintf(stderr, "\tadd [flags signal|subflow|backup|fullmesh] [id <nr>] [dev <name>] <ip>\n");
 	fprintf(stderr, "\tdel <id> [<ip>]\n");
 	fprintf(stderr, "\tget <id>\n");
-	fprintf(stderr, "\tset <ip> [flags backup|nobackup|fullmesh|nofullmesh] [port <nr>]\n");
+	fprintf(stderr, "\tset [<ip>] [id <nr>] flags [no]backup|[no]fullmesh [port <nr>]\n");
 	fprintf(stderr, "\tflush\n");
 	fprintf(stderr, "\tdump\n");
 	fprintf(stderr, "\tlimits [<rcv addr max> <subflow max>]\n");
@@ -657,8 +657,10 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 	u_int32_t flags = 0;
 	u_int16_t family;
 	int nest_start;
+	int use_id = 0;
+	u_int8_t id;
 	int off = 0;
-	int arg;
+	int arg = 2;
 
 	memset(data, 0, sizeof(data));
 	nh = (void *)data;
@@ -674,29 +676,45 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 	nest->rta_len = RTA_LENGTH(0);
 	off += NLMSG_ALIGN(nest->rta_len);
 
-	/* addr data */
-	rta = (void *)(data + off);
-	if (inet_pton(AF_INET, argv[2], RTA_DATA(rta))) {
-		family = AF_INET;
-		rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
-		rta->rta_len = RTA_LENGTH(4);
-	} else if (inet_pton(AF_INET6, argv[2], RTA_DATA(rta))) {
-		family = AF_INET6;
-		rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
-		rta->rta_len = RTA_LENGTH(16);
+	if (!strcmp(argv[arg], "id")) {
+		if (++arg >= argc)
+			error(1, 0, " missing id value");
+
+		use_id = 1;
+		id = atoi(argv[arg]);
+		rta = (void *)(data + off);
+		rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
+		rta->rta_len = RTA_LENGTH(1);
+		memcpy(RTA_DATA(rta), &id, 1);
+		off += NLMSG_ALIGN(rta->rta_len);
 	} else {
-		error(1, errno, "can't parse ip %s", argv[2]);
+		/* addr data */
+		rta = (void *)(data + off);
+		if (inet_pton(AF_INET, argv[arg], RTA_DATA(rta))) {
+			family = AF_INET;
+			rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
+			rta->rta_len = RTA_LENGTH(4);
+		} else if (inet_pton(AF_INET6, argv[arg], RTA_DATA(rta))) {
+			family = AF_INET6;
+			rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
+			rta->rta_len = RTA_LENGTH(16);
+		} else {
+			error(1, errno, "can't parse ip %s", argv[arg]);
+		}
+		off += NLMSG_ALIGN(rta->rta_len);
+
+		/* family */
+		rta = (void *)(data + off);
+		rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
+		rta->rta_len = RTA_LENGTH(2);
+		memcpy(RTA_DATA(rta), &family, 2);
+		off += NLMSG_ALIGN(rta->rta_len);
 	}
-	off += NLMSG_ALIGN(rta->rta_len);
 
-	/* family */
-	rta = (void *)(data + off);
-	rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
-	rta->rta_len = RTA_LENGTH(2);
-	memcpy(RTA_DATA(rta), &family, 2);
-	off += NLMSG_ALIGN(rta->rta_len);
+	if (++arg >= argc)
+		error(1, 0, " missing flags keyword");
 
-	for (arg = 3; arg < argc; arg++) {
+	for (; arg < argc; arg++) {
 		if (!strcmp(argv[arg], "flags")) {
 			char *tok, *str;
 
@@ -724,6 +742,9 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 		} else if (!strcmp(argv[arg], "port")) {
 			u_int16_t port;
 
+			if (use_id)
+				error(1, 0, " port can't be used with id");
+
 			if (++arg >= argc)
 				error(1, 0, " missing port value");
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH mptcp-next v5 2/2] selftests: mptcp: add set_flags tests in pm_netlink.sh
  2022-01-26  2:56 [PATCH mptcp-next v5 0/2] add the id argument for set_flags Geliang Tang
  2022-01-26  2:56 ` [PATCH mptcp-next v5 1/2] selftests: mptcp: " Geliang Tang
@ 2022-01-26  2:56 ` Geliang Tang
  2022-01-26 21:45 ` [PATCH mptcp-next v5 0/2] add the id argument for set_flags Mat Martineau
  2 siblings, 0 replies; 5+ messages in thread
From: Geliang Tang @ 2022-01-26  2:56 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch added the setting flags test cases, using both addr-based and
id-based lookups for the setting address.

The output looks like this:

 set flags (backup)                                 [ OK ]
           (nobackup)                               [ OK ]
           (fullmesh)                               [ OK ]
           (nofullmesh)                             [ OK ]
           (backup,fullmesh)                        [ OK ]

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 .../testing/selftests/net/mptcp/pm_netlink.sh  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
index cbacf9f6538b..89839d1ff9d8 100755
--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
+++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
@@ -164,4 +164,22 @@ id 253 flags  10.0.0.5
 id 254 flags  10.0.0.2
 id 255 flags  10.0.0.3" "wrap-around ids"
 
+ip netns exec $ns1 ./pm_nl_ctl flush
+ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 flags subflow
+ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags backup
+check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
+subflow,backup 10.0.1.1" "set flags (backup)"
+ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags nobackup
+check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
+subflow 10.0.1.1" "          (nobackup)"
+ip netns exec $ns1 ./pm_nl_ctl set id 1 flags fullmesh
+check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
+subflow,fullmesh 10.0.1.1" "          (fullmesh)"
+ip netns exec $ns1 ./pm_nl_ctl set id 1 flags nofullmesh
+check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
+subflow 10.0.1.1" "          (nofullmesh)"
+ip netns exec $ns1 ./pm_nl_ctl set id 1 flags backup,fullmesh
+check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
+subflow,backup,fullmesh 10.0.1.1" "          (backup,fullmesh)"
+
 exit $ret
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH mptcp-next v5 0/2] add the id argument for set_flags
  2022-01-26  2:56 [PATCH mptcp-next v5 0/2] add the id argument for set_flags Geliang Tang
  2022-01-26  2:56 ` [PATCH mptcp-next v5 1/2] selftests: mptcp: " Geliang Tang
  2022-01-26  2:56 ` [PATCH mptcp-next v5 2/2] selftests: mptcp: add set_flags tests in pm_netlink.sh Geliang Tang
@ 2022-01-26 21:45 ` Mat Martineau
  2022-01-28 17:09   ` Matthieu Baerts
  2 siblings, 1 reply; 5+ messages in thread
From: Mat Martineau @ 2022-01-26 21:45 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Wed, 26 Jan 2022, Geliang Tang wrote:

> v5:
> v4:
> - update the output of pm_netlink.sh
>

Thanks for updating, patches look good to me.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

> v3:
> - update the usage of set_flags in #1
> - check more of the intermediate states with "pm_nl_ctl dump" in #2
>
> v2:
> - make standalone patches, instead of squash-to ones.
> - add test cases in pm_netlink.sh, instead of mptcp_join.sh
>
> Add the id argument for 'pm_nl_ctl set', and allow to use the port keyword
> with the non-signal flags for the setting flags in 'ip mptcp endpoint
> change', more commands can be used to set the address flags:
>
> pm_nl_ctl set 10.0.2.1 flags backup port 10100
> pm_nl_ctl set id 1 flags backup
> ip mptcp endpoint change id 1 backup
> ip mptcp endpoint change 10.0.2.1 backup port 10100
>
> Geliang Tang (2):
>  selftests: mptcp: add the id argument for set_flags
>  selftests: mptcp: add set_flags tests in pm_netlink.sh
>
> .../testing/selftests/net/mptcp/pm_netlink.sh | 18 ++++++
> tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 63 ++++++++++++-------
> 2 files changed, 60 insertions(+), 21 deletions(-)
>
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH mptcp-next v5 0/2] add the id argument for set_flags
  2022-01-26 21:45 ` [PATCH mptcp-next v5 0/2] add the id argument for set_flags Mat Martineau
@ 2022-01-28 17:09   ` Matthieu Baerts
  0 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts @ 2022-01-28 17:09 UTC (permalink / raw)
  To: Mat Martineau, Geliang Tang; +Cc: mptcp

Hi Mat, Geliang,

On 26/01/2022 22:45, Mat Martineau wrote:
> On Wed, 26 Jan 2022, Geliang Tang wrote:
> 
>> v5:
>> v4:
>> - update the output of pm_netlink.sh
>>
> 
> Thanks for updating, patches look good to me.
> 
> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

Thank you for the patches and the reviews!

Now in our tree (feat. for net-next) with Mat's RvB tag:

- f8e513817b09: selftests: mptcp: add the id argument for set_flags
- ec38992d3ed7: selftests: mptcp: add set_flags tests in pm_netlink.sh
- Results: d57649f20e6e..6cf1fda75aaf

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220128T170856
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-28 17:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  2:56 [PATCH mptcp-next v5 0/2] add the id argument for set_flags Geliang Tang
2022-01-26  2:56 ` [PATCH mptcp-next v5 1/2] selftests: mptcp: " Geliang Tang
2022-01-26  2:56 ` [PATCH mptcp-next v5 2/2] selftests: mptcp: add set_flags tests in pm_netlink.sh Geliang Tang
2022-01-26 21:45 ` [PATCH mptcp-next v5 0/2] add the id argument for set_flags Mat Martineau
2022-01-28 17:09   ` Matthieu Baerts

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.