Skip to contentSkip to conversation

move to next addr and testcases

PATCH In review Geliang Tang 3 participants 6 messages Feb 19, 2021 – Feb 23, 2021

Subsystems (3)
lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

v5 cover move to next addr and testcases

v5:
- rename lookup_anno_list_by_saddr to mptcp_lookup_anno_list_by_saddr.

v4:
- use lookup_anno_list_by_saddr instead of lookup_subflow_by_saddr.
- use MPTCP_PM_SUBFLOW_ESTABLISHED instead of MPTCP_PM_ESTABLISHED.

v3:
- drop MPTCP_PM_NEXT_ADDR, use MPTCP_PM_ESTABLISHED instead.
- hold the msk lock in mptcp_pm_add_addr_echoed.
- tag: export/20210209T062213

v2:
- add patch 2 and 3 for removing testcases.
- tag: export/20210207T062839.

Geliang Tang (3):
mptcp: export lookup_anno_list_by_saddr
mptcp: move to next addr when subflow creation fail
selftests: mptcp: signal addresses testcases

 net/mptcp/options.c                           |  1 +
 net/mptcp/pm.c                                | 15 +++++
 net/mptcp/pm_netlink.c                        | 10 ++--
 net/mptcp/protocol.h                          |  5 ++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++++
 5 files changed, 84 insertions(+), 5 deletions(-)
Signature · 1 line
2.29.2
author
#1 lore raw

PATCH v5 1/3 mptcp: export lookup_anno_list_by_saddr

This patch exported the static function lookup_anno_list_by_saddr, and renamed it to mptcp_lookup_anno_list_by_saddr.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm_netlink.c | 10 +++++-----
 net/mptcp/protocol.h   |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)
net/mptcp/pm_netlink.c +5 -5
index 59ea64e5e914..55fdcb1b5281 100644
@@ -245,9 +245,9 @@ static void check_work_pending(struct mptcp_sock *msk)
 		WRITE_ONCE(msk->pm.work_pending, false);
 }
 
-static struct mptcp_pm_add_entry *
-lookup_anno_list_by_saddr(struct mptcp_sock *msk,
-			  struct mptcp_addr_info *addr)
+struct mptcp_pm_add_entry *
+mptcp_lookup_anno_list_by_saddr(struct mptcp_sock *msk,
+				struct mptcp_addr_info *addr)
 {
 	struct mptcp_pm_add_entry *entry;
 
@@ -331,7 +331,7 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
 	struct sock *sk = (struct sock *)msk;
 
 	spin_lock_bh(&msk->pm.lock);
-	entry = lookup_anno_list_by_saddr(msk, addr);
+	entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
 	if (entry)
 		entry->retrans_times = ADD_ADDR_RETRANS_MAX;
 	spin_unlock_bh(&msk->pm.lock);
@@ -351,7 +351,7 @@ static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
 
 	lockdep_assert_held(&msk->pm.lock);
 
-	if (lookup_anno_list_by_saddr(msk, &entry->addr))
+	if (mptcp_lookup_anno_list_by_saddr(msk, &entry->addr))
 		return false;
 
 	add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC);
net/mptcp/protocol.h +3 -0
index b92bb3972cb7..99c7f1aa7af0 100644
@@ -657,6 +657,9 @@ bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
 struct mptcp_pm_add_entry *
 mptcp_pm_del_add_timer(struct mptcp_sock *msk,
 		       struct mptcp_addr_info *addr);
+struct mptcp_pm_add_entry *
+mptcp_lookup_anno_list_by_saddr(struct mptcp_sock *msk,
+				struct mptcp_addr_info *addr);
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
 			   const struct mptcp_addr_info *addr,
Signature · 1 line
2.29.2
author
#2 lore raw

PATCH v5 2/3 mptcp: move to next addr when subflow creation fail

When an invalid address was announced, the subflow couldn't be created for this address. Therefore mptcp_pm_nl_subflow_established couldn't be invoked. Then the next addresses in the local address list didn't have a chance to be announced.

This patch invokes the new function mptcp_pm_add_addr_echoed when the address is echoed. In it, use mptcp_lookup_anno_list_by_saddr to check whether this address is in the anno_list. If it is, PM schedules the status MPTCP_PM_SUBFLOW_ESTABLISHED to invoke mptcp_pm_create_subflow_or_signal_addr to deal with the next address in the local address list.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/options.c  |  1 +
 net/mptcp/pm.c       | 15 +++++++++++++++
 net/mptcp/protocol.h |  2 ++
 3 files changed, 18 insertions(+)
net/mptcp/options.c +1 -0
index b252aadad3fc..e3ba04044561 100644
@@ -1036,6 +1036,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 			mptcp_pm_add_addr_received(msk, &addr);
 			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR);
 		} else {
+			mptcp_pm_add_addr_echoed(msk, &addr);
 			mptcp_pm_del_add_timer(msk, &addr);
 			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADD);
 		}
net/mptcp/pm.c +15 -0
index b559e06757f7..db2ce84d250a 100644
@@ -196,6 +196,21 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 	spin_unlock_bh(&pm->lock);
 }
 
+void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
+			      struct mptcp_addr_info *addr)
+{
+	struct mptcp_pm_data *pm = &msk->pm;
+
+	pr_debug("msk=%p", msk);
+
+	spin_lock_bh(&pm->lock);
+
+	if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending))
+		mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED);
+
+	spin_unlock_bh(&pm->lock);
+}
+
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)
 {
 	if (!mptcp_pm_should_add_signal(msk))
net/mptcp/protocol.h +2 -0
index 99c7f1aa7af0..6af3e259fa05 100644
@@ -646,6 +646,8 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk);
 void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);
 void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 				const struct mptcp_addr_info *addr);
+void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
+			      struct mptcp_addr_info *addr);
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, struct mptcp_rm_list rm_list);
 void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
Signature · 1 line
2.29.2
author
#3 lore raw

PATCH v5 3/3 selftests: mptcp: signal addresses testcases

This patch added testcases for signalling multi valid and invalid addresses for both signal_address_tests and remove_tests.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +58 -0
index 191303b652a6..5d7f940bceac 100755
@@ -788,6 +788,28 @@ signal_address_tests()
 	run_tests $ns1 $ns2 10.0.1.1
 	chk_join_nr "multiple subflows and signal" 3 3 3
 	chk_add_nr 1 1
+
+	# signal addresses
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 3 3
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.4.1 flags signal
+	ip netns exec $ns2 ./pm_nl_ctl limits 3 3
+	run_tests $ns1 $ns2 10.0.1.1
+	chk_join_nr "signal addresses" 3 3 3
+	chk_add_nr 3 3
+
+	# signal invalid addresses
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 3 3
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal
+	ip netns exec $ns2 ./pm_nl_ctl limits 3 3
+	run_tests $ns1 $ns2 10.0.1.1
+	chk_join_nr "signal invalid addresses" 1 1 1
+	chk_add_nr 3 3
 }
 
 link_failure_tests()
@@ -879,6 +901,30 @@ remove_tests()
 	chk_add_nr 1 1
 	chk_rm_nr 2 2
 
+	# addresses remove
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 3 3
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal id 250
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.4.1 flags signal
+	ip netns exec $ns2 ./pm_nl_ctl limits 3 3
+	run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow
+	chk_join_nr "remove addresses" 3 3 3
+	chk_add_nr 3 3
+	chk_rm_nr 3 3 invert
+
+	# invalid addresses remove
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 3 3
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal
+	ip netns exec $ns2 ./pm_nl_ctl limits 3 3
+	run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow
+	chk_join_nr "remove invalid addresses" 1 1 1
+	chk_add_nr 3 3
+	chk_rm_nr 3 1 invert
+
 	# subflows and signal, flush
 	reset
 	ip netns exec $ns1 ./pm_nl_ctl limits 0 3
@@ -913,6 +959,18 @@ remove_tests()
 	chk_join_nr "flush addresses" 3 3 3
 	chk_add_nr 3 3
 	chk_rm_nr 3 3 invert
+
+	# invalid addresses flush
+	reset
+	ip netns exec $ns1 ./pm_nl_ctl limits 3 3
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal
+	ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal
+	ip netns exec $ns2 ./pm_nl_ctl limits 3 3
+	run_tests $ns1 $ns2 10.0.1.1 0 -8 0 slow
+	chk_join_nr "flush invalid addresses" 1 1 1
+	chk_add_nr 3 3
+	chk_rm_nr 3 1 invert
 }
 
 add_tests()
Signature · 1 line
2.29.2
#4 lore raw
In reply to Geliang Tang
Quoted 3 lines · Geliang Tang

v5:
- rename lookup_anno_list_by_saddr to mptcp_lookup_anno_list_by_saddr.

Thanks Geliang, v5 is good to merge in the export branch.

Before we close #151, what happens if the peer does not send echoes or echoes are lost? Should there be another patch to also call mptcp_pm_create_subflow_or_signal_addr when an ADD_ADDR has been retransmitted the maximum number of times?

Mat

Quoted 20 lines

v4:
- use lookup_anno_list_by_saddr instead of lookup_subflow_by_saddr.
- use MPTCP_PM_SUBFLOW_ESTABLISHED instead of MPTCP_PM_ESTABLISHED.

v3:
- drop MPTCP_PM_NEXT_ADDR, use MPTCP_PM_ESTABLISHED instead.
- hold the msk lock in mptcp_pm_add_addr_echoed.
- tag: export/20210209T062213

v2:
- add patch 2 and 3 for removing testcases.
- tag: export/20210207T062839.

Geliang Tang (3):
mptcp: export lookup_anno_list_by_saddr
mptcp: move to next addr when subflow creation fail
selftests: mptcp: signal addresses testcases

Quoted 13 lines
net/mptcp/options.c                           |  1 +
net/mptcp/pm.c                                | 15 +++++
net/mptcp/pm_netlink.c                        | 10 ++--
net/mptcp/protocol.h                          |  5 ++
.../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++++
5 files changed, 84 insertions(+), 5 deletions(-)
Signature · 4 lines
2.29.2
_______________________________________________
mptcp mailing list -- mptcp(a)lists.01.org
To unsubscribe send an email to mptcp-leave(a)lists.01.org

--
Mat Martineau
Intel

#5 lore raw
In reply to Geliang Tang

Hi Geliang, Mat,

Quoted 7 lines · Geliang Tang

v5:
- rename lookup_anno_list_by_saddr to mptcp_lookup_anno_list_by_saddr.

v4:
- use lookup_anno_list_by_saddr instead of lookup_subflow_by_saddr.
- use MPTCP_PM_SUBFLOW_ESTABLISHED instead of MPTCP_PM_ESTABLISHED.

Quoted 8 lines

v3:
- drop MPTCP_PM_NEXT_ADDR, use MPTCP_PM_ESTABLISHED instead.
- hold the msk lock in mptcp_pm_add_addr_echoed.
- tag: export/20210209T062213

v2:
- add patch 2 and 3 for removing testcases.
- tag: export/20210207T062839.

Thank you for the patches and reviews!

With a bit of delay, sorry for that, it is now at the end of our tree with Mat's RvB tag:

- 4877b4409cd8: mptcp: export lookup_anno_list_by_saddr
- 57e57640c326: mptcp: move to next addr when subflow creation fail
- 608768e00068: selftests: mptcp: signal addresses testcases
- Results: 08fd790ee3b7..8d9171e1a9d2

Tests + export are in progress!

Quoted 1 line

I didn't close this issue because there are other patches in review linked to this issue.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net