* [PATCH mptcp-next v9 1/6] mptcp: only send RM_ADDR in nl_cmd_remove
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 15:22 ` Matthieu Baerts
2023-04-25 7:55 ` [PATCH mptcp-next v9 2/6] selftests: mptcp: update userspace pm addr tests Geliang Tang
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
The specifications from [1] about the "REMOVE" command say:
Announce that an address has been lost to the peer
It was then only supposed to send a RM_ADDR and not trying to delete
associated subflows.
A new helper mptcp_pm_remove_addrs() is then introduced to do just
that, compared to mptcp_pm_remove_addrs_and_subflows() also removing
subflows.
To delete a subflow, the userspace daemon can use the "SUB_DESTROY"
command, see mptcp_nl_cmd_sf_destroy().
Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Link: https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.96/include/uapi/linux/mptcp.h
[1]
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_netlink.c | 16 ++++++++++++++++
net/mptcp/pm_userspace.c | 2 +-
net/mptcp/protocol.h | 1 +
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index e8336b8bd30e..d85649bc27e2 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1555,6 +1555,22 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
return ret;
}
+void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
+{
+ struct mptcp_rm_list alist = { .nr = 0 };
+ struct mptcp_pm_addr_entry *entry;
+
+ list_for_each_entry(entry, rm_list, list) {
+ if (remove_anno_list_by_saddr(msk, &entry->addr) &&
+ alist.nr < MPTCP_RM_IDS_MAX) {
+ alist.ids[alist.nr++] = entry->addr.id;
+ spin_lock_bh(&msk->pm.lock);
+ mptcp_pm_remove_addr(msk, &alist);
+ spin_unlock_bh(&msk->pm.lock);
+ }
+ }
+}
+
void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
struct list_head *rm_list)
{
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 27a275805c06..6beadea8c67d 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -232,7 +232,7 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
list_move(&match->list, &free_list);
- mptcp_pm_remove_addrs_and_subflows(msk, &free_list);
+ mptcp_pm_remove_addrs(msk, &free_list);
release_sock((struct sock *)msk);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index c39e172c95db..1a2772902e9d 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -845,6 +845,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
bool echo);
int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
+void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list);
void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
struct list_head *rm_list);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH mptcp-next v9 1/6] mptcp: only send RM_ADDR in nl_cmd_remove
2023-04-25 7:55 ` [PATCH mptcp-next v9 1/6] mptcp: only send RM_ADDR in nl_cmd_remove Geliang Tang
@ 2023-04-25 15:22 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2023-04-25 15:22 UTC (permalink / raw)
To: Geliang Tang, mptcp
Hi Geliang,
On 25/04/2023 09:55, Geliang Tang wrote:
> The specifications from [1] about the "REMOVE" command say:
>
> Announce that an address has been lost to the peer
>
> It was then only supposed to send a RM_ADDR and not trying to delete
> associated subflows.
>
> A new helper mptcp_pm_remove_addrs() is then introduced to do just
> that, compared to mptcp_pm_remove_addrs_and_subflows() also removing
> subflows.
>
> To delete a subflow, the userspace daemon can use the "SUB_DESTROY"
> command, see mptcp_nl_cmd_sf_destroy().
>
> Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
> Link: https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.96/include/uapi/linux/mptcp.h
> [1]
This "[1] should go at the end of the previous line.
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> net/mptcp/pm_netlink.c | 16 ++++++++++++++++
> net/mptcp/pm_userspace.c | 2 +-
> net/mptcp/protocol.h | 1 +
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index e8336b8bd30e..d85649bc27e2 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1555,6 +1555,22 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
> return ret;
> }
>
> +void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
> +{
> + struct mptcp_rm_list alist = { .nr = 0 };
> + struct mptcp_pm_addr_entry *entry;
> +
> + list_for_each_entry(entry, rm_list, list) {
> + if (remove_anno_list_by_saddr(msk, &entry->addr) &&
> + alist.nr < MPTCP_RM_IDS_MAX) {
> + alist.ids[alist.nr++] = entry->addr.id;
> + spin_lock_bh(&msk->pm.lock);
> + mptcp_pm_remove_addr(msk, &alist);
Sorry, I didn't notice the issue before: this should be executed after
the for-loop. Without this modification and if you have multiple
addresses to remove, you will send multiple RM_ADDR re-using the same
list with a new item added each time.
> + spin_unlock_bh(&msk->pm.lock);
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH mptcp-next v9 2/6] selftests: mptcp: update userspace pm addr tests
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
2023-04-25 7:55 ` [PATCH mptcp-next v9 1/6] mptcp: only send RM_ADDR in nl_cmd_remove Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 7:55 ` [PATCH mptcp-next v9 3/6] mptcp: add addr into userspace pm list Geliang Tang
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch is linked to the previous commit ("mptcp: only send RM_ADDR in
nl_cmd_remove").
To align with what is done by the in-kernel PM, update userspace pm addr
selftests, by sending a remove_subflows command together before the
remove_addrs command.
Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Fixes: 97040cf9806e ("selftests: mptcp: userspace pm address tests")
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 26310c17b4c6..b3cbcf27fec1 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -849,6 +849,14 @@ do_transfer()
sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id
sleep 1
+ sp=$(grep "type:10" "$evts_ns1" |
+ sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
+ da=$(grep "type:10" "$evts_ns1" |
+ sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
+ dp=$(grep "type:10" "$evts_ns1" |
+ sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q')
+ ip netns exec ${listener_ns} ./pm_nl_ctl dsf lip "::ffff:$addr" \
+ lport $sp rip $da rport $dp token $tk
ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
fi
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH mptcp-next v9 3/6] mptcp: add addr into userspace pm list
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
2023-04-25 7:55 ` [PATCH mptcp-next v9 1/6] mptcp: only send RM_ADDR in nl_cmd_remove Geliang Tang
2023-04-25 7:55 ` [PATCH mptcp-next v9 2/6] selftests: mptcp: update userspace pm addr tests Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 15:24 ` Matthieu Baerts
2023-04-25 7:55 ` [PATCH mptcp-next v9 4/6] mptcp: export remove_anno_list_by_saddr Geliang Tang
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
Add the address into userspace_pm_local_addr_list when the subflow is
created. And delete it in the new helper
mptcp_userspace_pm_delete_local_addr().
By doing that, the "REMOVE" command also works with subflows that have
been created via the "SUB_CREATE" command instead of restricting to
the addresses that have been announced via the "ANNOUNCE" command.
Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 6beadea8c67d..b494c72efe2b 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -79,6 +79,23 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
return ret;
}
+static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
+ struct mptcp_pm_addr_entry *addr)
+{
+ struct mptcp_pm_addr_entry *entry, *tmp;
+
+ list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
+ if (mptcp_addresses_equal(&entry->addr, &addr->addr, false) &&
+ msk->pm.subflows == 1) {
+ list_del_rcu(&entry->list);
+ kfree(entry);
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
unsigned int id,
u8 *flags, int *ifindex)
@@ -251,6 +268,7 @@ int mptcp_nl_cmd_sf_create(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 mptcp_pm_addr_entry local = { 0 };
struct mptcp_addr_info addr_r;
struct mptcp_addr_info addr_l;
struct mptcp_sock *msk;
@@ -302,12 +320,25 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}
+ local.addr = addr_l;
+ err = mptcp_userspace_pm_append_new_local_addr(msk, &local);
+ if (err < 0) {
+ GENL_SET_ERR_MSG(info, "did not match address and id");
+ goto create_err;
+ }
+
lock_sock(sk);
err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
release_sock(sk);
+ if (err) {
+ spin_lock_bh(&msk->pm.lock);
+ mptcp_userspace_pm_delete_local_addr(msk, &local);
+ spin_unlock_bh(&msk->pm.lock);
+ }
+
create_err:
sock_put((struct sock *)msk);
return err;
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH mptcp-next v9 3/6] mptcp: add addr into userspace pm list
2023-04-25 7:55 ` [PATCH mptcp-next v9 3/6] mptcp: add addr into userspace pm list Geliang Tang
@ 2023-04-25 15:24 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2023-04-25 15:24 UTC (permalink / raw)
To: Geliang Tang, mptcp
On 25/04/2023 09:55, Geliang Tang wrote:
> Add the address into userspace_pm_local_addr_list when the subflow is
> created. And delete it in the new helper
> mptcp_userspace_pm_delete_local_addr().
>
> By doing that, the "REMOVE" command also works with subflows that have
> been created via the "SUB_CREATE" command instead of restricting to
> the addresses that have been announced via the "ANNOUNCE" command.
>
> Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
> Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> net/mptcp/pm_userspace.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index 6beadea8c67d..b494c72efe2b 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -79,6 +79,23 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
> return ret;
> }
>
> +static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
> + struct mptcp_pm_addr_entry *addr)
> +{
> + struct mptcp_pm_addr_entry *entry, *tmp;
> +
> + list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
> + if (mptcp_addresses_equal(&entry->addr, &addr->addr, false) &&
> + msk->pm.subflows == 1) {
I'm not a big fan of this workaround, especially for a fix that is
supposed to be backported.
Do you need to do a lot of modifications to add a "refcount_t" in
"struct mptcp_pm_addr_entry" and use it?
If really it is complex, I think we will at least need a comment with a
TODO explaining why we need a refcount. (and a new ticket)
(and probably better without "msk->pm.subflows == 1" then)
> + list_del_rcu(&entry->list);
> + kfree(entry);
> + return 0;
> + }
> + }
> +
> + return -EINVAL;
> +}
> +
> int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
> unsigned int id,
> u8 *flags, int *ifindex)
> @@ -251,6 +268,7 @@ int mptcp_nl_cmd_sf_create(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 mptcp_pm_addr_entry local = { 0 };
> struct mptcp_addr_info addr_r;
> struct mptcp_addr_info addr_l;
> struct mptcp_sock *msk;
> @@ -302,12 +320,25 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
> goto create_err;
> }
>
> + local.addr = addr_l;
> + err = mptcp_userspace_pm_append_new_local_addr(msk, &local);
> + if (err < 0) {
> + GENL_SET_ERR_MSG(info, "did not match address and id");
> + goto create_err;
> + }
> +
> lock_sock(sk);
>
> err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
>
> release_sock(sk);
>
> + if (err) {
> + spin_lock_bh(&msk->pm.lock);
> + mptcp_userspace_pm_delete_local_addr(msk, &local);
> + spin_unlock_bh(&msk->pm.lock);
> + }
> +
When the subflow is deleted by the other peer, we also need to delete
the local address, no?
Or maybe we want to keep it not to assign the same ID to another
address? And/or to be able to send RM_ADDR after the removal of the
subflow? If yes, it would be clearer to add a comment about that.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH mptcp-next v9 4/6] mptcp: export remove_anno_list_by_saddr
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
` (2 preceding siblings ...)
2023-04-25 7:55 ` [PATCH mptcp-next v9 3/6] mptcp: add addr into userspace pm list Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 15:25 ` Matthieu Baerts
2023-04-25 7:55 ` [PATCH mptcp-next v9 5/6] mptcp: add addr into pm anno_list Geliang Tang
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
Rename remove_anno_list_by_saddr() with "mptcp_pm_" prefix and export it
in protocol.h.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_netlink.c | 10 +++++-----
net/mptcp/protocol.h | 2 ++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index d85649bc27e2..3958b8ec4269 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1399,8 +1399,8 @@ int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id
return 0;
}
-static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
- const struct mptcp_addr_info *addr)
+bool mptcp_pm_remove_anno_list_by_saddr(struct mptcp_sock *msk,
+ const struct mptcp_addr_info *addr)
{
struct mptcp_pm_add_entry *entry;
@@ -1423,7 +1423,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk,
list.ids[list.nr++] = addr->id;
- ret = remove_anno_list_by_saddr(msk, addr);
+ ret = mptcp_pm_remove_anno_list_by_saddr(msk, addr);
if (ret || force) {
spin_lock_bh(&msk->pm.lock);
mptcp_pm_remove_addr(msk, &list);
@@ -1561,7 +1561,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
struct mptcp_pm_addr_entry *entry;
list_for_each_entry(entry, rm_list, list) {
- if (remove_anno_list_by_saddr(msk, &entry->addr) &&
+ if (mptcp_pm_remove_anno_list_by_saddr(msk, &entry->addr) &&
alist.nr < MPTCP_RM_IDS_MAX) {
alist.ids[alist.nr++] = entry->addr.id;
spin_lock_bh(&msk->pm.lock);
@@ -1582,7 +1582,7 @@ void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
slist.nr < MPTCP_RM_IDS_MAX)
slist.ids[slist.nr++] = entry->addr.id;
- if (remove_anno_list_by_saddr(msk, &entry->addr) &&
+ if (mptcp_pm_remove_anno_list_by_saddr(msk, &entry->addr) &&
alist.nr < MPTCP_RM_IDS_MAX)
alist.ids[alist.nr++] = entry->addr.id;
}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 1a2772902e9d..bfa7d93a1c1a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -831,6 +831,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
struct mptcp_pm_add_entry *
mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,
const struct mptcp_addr_info *addr);
+bool mptcp_pm_remove_anno_list_by_saddr(struct mptcp_sock *msk,
+ const struct mptcp_addr_info *addr);
int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
unsigned int id,
u8 *flags, int *ifindex);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH mptcp-next v9 4/6] mptcp: export remove_anno_list_by_saddr
2023-04-25 7:55 ` [PATCH mptcp-next v9 4/6] mptcp: export remove_anno_list_by_saddr Geliang Tang
@ 2023-04-25 15:25 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2023-04-25 15:25 UTC (permalink / raw)
To: Geliang Tang, mptcp
Hi Geliang,
On 25/04/2023 09:55, Geliang Tang wrote:
> Rename remove_anno_list_by_saddr() with "mptcp_pm_" prefix and export it
> in protocol.h.
Please always add a reason explaining why this commit is needed, even if
it is obvious when looking at the series (but less when looking at the
individual commit).
Here it can be very short, e.g. This function will be re-used in the
userspace PM code in the following commit.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH mptcp-next v9 5/6] mptcp: add addr into pm anno_list
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
` (3 preceding siblings ...)
2023-04-25 7:55 ` [PATCH mptcp-next v9 4/6] mptcp: export remove_anno_list_by_saddr Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 15:25 ` Matthieu Baerts
2023-04-25 7:55 ` [PATCH mptcp-next v9 6/6] selftests: mptcp: update userspace pm subflow tests Geliang Tang
2023-04-25 15:21 ` [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Matthieu Baerts
6 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
Add address into pm anno_list in mptcp_nl_cmd_sf_create(). Remove
it when connecting fails.
By doing this, the "REMOVE" command also works with subflows that have
been created via the "SUB_CREATE" command instead of restricting to
the addresses that have been announced via the "ANNOUNCE" command.
Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index b494c72efe2b..47aea147e334 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -327,6 +327,14 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}
+ spin_lock_bh(&msk->pm.lock);
+ if (!mptcp_pm_alloc_anno_list(msk, &local)) {
+ mptcp_userspace_pm_delete_local_addr(msk, &local);
+ spin_unlock_bh(&msk->pm.lock);
+ goto create_err;
+ }
+ spin_unlock_bh(&msk->pm.lock);
+
lock_sock(sk);
err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
@@ -335,6 +343,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
if (err) {
spin_lock_bh(&msk->pm.lock);
+ mptcp_pm_remove_anno_list_by_saddr(msk, &addr_l);
mptcp_userspace_pm_delete_local_addr(msk, &local);
spin_unlock_bh(&msk->pm.lock);
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH mptcp-next v9 5/6] mptcp: add addr into pm anno_list
2023-04-25 7:55 ` [PATCH mptcp-next v9 5/6] mptcp: add addr into pm anno_list Geliang Tang
@ 2023-04-25 15:25 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2023-04-25 15:25 UTC (permalink / raw)
To: Geliang Tang, mptcp
Hi Geliang,
On 25/04/2023 09:55, Geliang Tang wrote:
> Add address into pm anno_list in mptcp_nl_cmd_sf_create(). Remove
> it when connecting fails.
>
> By doing this, the "REMOVE" command also works with subflows that have
> been created via the "SUB_CREATE" command instead of restricting to
> the addresses that have been announced via the "ANNOUNCE" command.
The reason given here is the same as the one from patch 3/6. But then
what's the difference? Does it mean the patch 3/6 doesn't fully fix the
issue? What does it not fix and what does this one do?
Or does it mean we should squash patches 3/6 and 5/6?
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH mptcp-next v9 6/6] selftests: mptcp: update userspace pm subflow tests
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
` (4 preceding siblings ...)
2023-04-25 7:55 ` [PATCH mptcp-next v9 5/6] mptcp: add addr into pm anno_list Geliang Tang
@ 2023-04-25 7:55 ` Geliang Tang
2023-04-25 9:17 ` selftests: mptcp: update userspace pm subflow tests: Tests Results MPTCP CI
2023-04-25 15:21 ` [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Matthieu Baerts
6 siblings, 1 reply; 13+ messages in thread
From: Geliang Tang @ 2023-04-25 7:55 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
To align with what is done by the in-kernel PM, update userspace pm
subflow selftests, by sending the a remove_addrs command together after
the remove_subflows command. This will get a RM_ADDR in chk_rm_nr().
Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Fixes: 5e986ec46874 ("selftests: mptcp: userspace pm subflow tests")
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index b3cbcf27fec1..878acfcdba58 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -925,6 +925,7 @@ do_transfer()
sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
rip $da rport $dp token $tk
+ ip netns exec ${connector_ns} ./pm_nl_ctl rem token $tk id $id
fi
counter=$((counter + 1))
add_nr_ns2=$((add_nr_ns2 - 1))
@@ -3137,7 +3138,7 @@ userspace_tests()
pm_nl_set_limits $ns1 0 1
run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow
chk_join_nr 1 1 1
- chk_rm_nr 0 1
+ chk_rm_nr 1 1
kill_events_pids
fi
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1
2023-04-25 7:55 [PATCH mptcp-next v9 0/6] update userspace pm mptcp_info fields, pt 1 Geliang Tang
` (5 preceding siblings ...)
2023-04-25 7:55 ` [PATCH mptcp-next v9 6/6] selftests: mptcp: update userspace pm subflow tests Geliang Tang
@ 2023-04-25 15:21 ` Matthieu Baerts
6 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2023-04-25 15:21 UTC (permalink / raw)
To: Geliang Tang, mptcp
Hi Geliang,
On 25/04/2023 09:55, Geliang Tang wrote:
> v9:
> - address Matt's commets in v8.
Thank you for this v9. It looks better!
It looks like the CI spot some issues with the userspace_pm selftest:
> - KVM Validation: normal (except selftest_mptcp_join):
> - Unstable: 1 failed test(s): selftest_userspace_pm 🔴:
> - Task: https://cirrus-ci.com/task/6754937204375552
> - Summary: https://api.cirrus-ci.com/v1/artifact/task/6754937204375552/summary/summary.txt
>
> - KVM Validation: debug (except selftest_mptcp_join):
> - Unstable: 1 failed test(s): selftest_userspace_pm 🔴:
> - Task: https://cirrus-ci.com/task/5629861931253760
> - Summary: https://api.cirrus-ci.com/v1/artifact/task/5629861931253760/summary/summary.txt
I have a few comments and ideas, I'm going to share that in each
individual patch.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 13+ messages in thread