* [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address
@ 2023-08-08 5:38 Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 1/4] mptcp: allow creating id 0 subflow Geliang Tang
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Geliang Tang @ 2023-08-08 5:38 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patchset addresses #379 and #391, add the abilities to remove id 0
subflow and address for userspace PM. And a selftest.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/391
Geliang Tang (4):
mptcp: allow creating id 0 subflow
mptcp: remove id 0 subflow & address
selftests: mptcp: add id argument for dsf
selftests: mptcp: remove id 0 subflow & address
net/mptcp/pm_userspace.c | 41 +++++++++++++++----
.../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++++
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 33 ++++++++++++++-
3 files changed, 90 insertions(+), 8 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH mptcp-next 1/4] mptcp: allow creating id 0 subflow
2023-08-08 5:38 [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address Geliang Tang
@ 2023-08-08 5:38 ` Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 2/4] mptcp: remove id 0 subflow & address Geliang Tang
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Geliang Tang @ 2023-08-08 5:38 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang, Matthieu Baerts
This patch drops id 0 limitation in mptcp_nl_cmd_sf_create() to allow
creating additional subflows with the local addr ID 0.
Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establishment")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/391
Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index b5a8aa4c1ebd..d042d32beb4d 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -307,12 +307,6 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}
- if (addr_l.id == 0) {
- NL_SET_ERR_MSG_ATTR(info->extack, laddr, "missing local addr id");
- err = -EINVAL;
- goto create_err;
- }
-
err = mptcp_pm_parse_addr(raddr, info, &addr_r);
if (err < 0) {
NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr");
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH mptcp-next 2/4] mptcp: remove id 0 subflow & address
2023-08-08 5:38 [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 1/4] mptcp: allow creating id 0 subflow Geliang Tang
@ 2023-08-08 5:38 ` Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 3/4] selftests: mptcp: add id argument for dsf Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 4/4] selftests: mptcp: remove id 0 subflow & address Geliang Tang
3 siblings, 0 replies; 6+ messages in thread
From: Geliang Tang @ 2023-08-08 5:38 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch adds the ability to send RM_ADDR for local ID 0 and the
ability to remove id 0 subflow.
Put id 0 into a removing list, pass it to mptcp_pm_remove_addr() to
remve id 0 address and pass it to mptcp_pm_nl_rm_subflow_received() to
remove id 0 subflow.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index d042d32beb4d..90472cd62342 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -241,6 +241,19 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
lock_sock((struct sock *)msk);
+ if (id_val == 0) {
+ struct mptcp_rm_list list = { .nr = 0 };
+
+ list.ids[list.nr++] = 0;
+
+ spin_lock_bh(&msk->pm.lock);
+ mptcp_pm_remove_addr(msk, &list);
+ spin_unlock_bh(&msk->pm.lock);
+ release_sock((struct sock *)msk);
+ err = 0;
+ goto remove_err;
+ }
+
list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) {
if (entry->addr.id == id_val) {
match = entry;
@@ -399,14 +412,16 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE];
struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR];
+ struct nlattr *id = info->attrs[MPTCP_PM_ATTR_LOC_ID];
struct mptcp_addr_info addr_l;
struct mptcp_addr_info addr_r;
struct mptcp_sock *msk;
struct sock *sk, *ssk;
int err = -EINVAL;
u32 token_val;
+ u8 id_val;
- if (!laddr || !raddr || !token) {
+ if (((!laddr || !raddr) && !id) || !token) {
GENL_SET_ERR_MSG(info, "missing required inputs");
return err;
}
@@ -424,6 +439,24 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
goto destroy_err;
}
+ if (id) {
+ id_val = nla_get_u8(id);
+ if (id_val == 0) {
+ struct mptcp_rm_list list = { .nr = 0 };
+
+ list.ids[list.nr++] = 0;
+
+ sk = (struct sock *)msk;
+ lock_sock(sk);
+ spin_lock_bh(&msk->pm.lock);
+ mptcp_pm_nl_rm_subflow_received(msk, &list);
+ spin_unlock_bh(&msk->pm.lock);
+ release_sock(sk);
+ err = 0;
+ goto destroy_err;
+ }
+ }
+
err = mptcp_pm_parse_addr(laddr, info, &addr_l);
if (err < 0) {
NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr");
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH mptcp-next 3/4] selftests: mptcp: add id argument for dsf
2023-08-08 5:38 [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 1/4] mptcp: allow creating id 0 subflow Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 2/4] mptcp: remove id 0 subflow & address Geliang Tang
@ 2023-08-08 5:38 ` Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 4/4] selftests: mptcp: remove id 0 subflow & address Geliang Tang
3 siblings, 0 replies; 6+ messages in thread
From: Geliang Tang @ 2023-08-08 5:38 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch adds a id argument for userspace PM subflow removing
function dsf(), to remove id 0 subflow.
./pm_nl_ctl dsf token $tk id 0
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 33 ++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index 49369c4a5f26..6e078854f440 100644
--- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
+++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
@@ -358,9 +358,40 @@ int dsf(int fd, int pm_family, int argc, char *argv[])
off = init_genl_req(data, pm_family, MPTCP_PM_CMD_SUBFLOW_DESTROY,
MPTCP_PM_VER);
- if (argc < 12)
+ if (argc < 6)
syntax(argv);
+ if (argc < 12) {
+ u_int8_t id;
+
+ for (arg = 2; arg < argc; arg++) {
+ if (!strcmp(argv[arg], "id")) {
+ if (++arg >= argc)
+ error(1, 0, " missing id value");
+
+ id = atoi(argv[arg]);
+ rta = (void *)(data + off);
+ rta->rta_type = MPTCP_PM_ATTR_LOC_ID;
+ rta->rta_len = RTA_LENGTH(1);
+ memcpy(RTA_DATA(rta), &id, 1);
+ off += NLMSG_ALIGN(rta->rta_len);
+ } else if (!strcmp(argv[arg], "token")) {
+ if (++arg >= argc)
+ error(1, 0, " missing token value");
+
+ token = strtoul(argv[arg], NULL, 10);
+ rta = (void *)(data + off);
+ rta->rta_type = MPTCP_PM_ATTR_TOKEN;
+ rta->rta_len = RTA_LENGTH(4);
+ memcpy(RTA_DATA(rta), &token, 4);
+ off += NLMSG_ALIGN(rta->rta_len);
+ } else
+ error(1, 0, "unknown keyword %s", argv[arg]);
+ }
+ do_nl_req(fd, nh, off, 0);
+ return 0;
+ }
+
/* Params recorded in this order:
* <local-ip>, <local-port>, <remote-ip>, <remote-port>, <token>
*/
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH mptcp-next 4/4] selftests: mptcp: remove id 0 subflow & address
2023-08-08 5:38 [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address Geliang Tang
` (2 preceding siblings ...)
2023-08-08 5:38 ` [PATCH mptcp-next 3/4] selftests: mptcp: add id argument for dsf Geliang Tang
@ 2023-08-08 5:38 ` Geliang Tang
2023-08-08 7:15 ` selftests: mptcp: remove id 0 subflow & address: Tests Results MPTCP CI
3 siblings, 1 reply; 6+ messages in thread
From: Geliang Tang @ 2023-08-08 5:38 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch adds a selftest for userpsace PM to remove id 0 subflow and
id 0 address.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ee1f89a872b3..9bcfacaa4124 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -3434,6 +3434,30 @@ userspace_tests()
kill_events_pids
wait $tests_pid
fi
+
+ # userspace pm remove id 0 subflow & address
+ if reset_with_events "userspace pm remove id 0 subflow & address" &&
+ continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+ local tk
+
+ set_userspace_pm $ns2
+ pm_nl_set_limits $ns1 0 2
+ speed=10 \
+ run_tests $ns1 $ns2 10.0.1.1 &
+ local tests_pid=$!
+ wait_mpj $ns2
+ userspace_pm_add_sf 10.0.1.2 0
+ userspace_pm_add_sf 10.0.3.2 20
+ chk_join_nr 2 2 2
+ chk_mptcp_info subflows 2 subflows 2
+ tk=$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
+ ip netns exec $ns2 ./pm_nl_ctl rem token $tk id 0
+ ip netns exec $ns2 ./pm_nl_ctl dsf token $tk id 0
+ chk_rm_nr 2 2
+ chk_mptcp_info subflows 1 subflows 1
+ kill_events_pids
+ wait $tests_pid
+ fi
}
endpoint_tests()
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: selftests: mptcp: remove id 0 subflow & address: Tests Results
2023-08-08 5:38 ` [PATCH mptcp-next 4/4] selftests: mptcp: remove id 0 subflow & address Geliang Tang
@ 2023-08-08 7:15 ` MPTCP CI
0 siblings, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2023-08-08 7:15 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5332343926292480
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5332343926292480/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6458243833135104
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6458243833135104/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5050868949581824
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5050868949581824/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6176768856424448
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6176768856424448/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/8b35cc97750c
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debug
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-08 7:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 5:38 [PATCH mptcp-next 0/4] userspace pm remove id 0 subflow & address Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 1/4] mptcp: allow creating id 0 subflow Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 2/4] mptcp: remove id 0 subflow & address Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 3/4] selftests: mptcp: add id argument for dsf Geliang Tang
2023-08-08 5:38 ` [PATCH mptcp-next 4/4] selftests: mptcp: remove id 0 subflow & address Geliang Tang
2023-08-08 7:15 ` selftests: mptcp: remove id 0 subflow & address: Tests Results MPTCP CI
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.