move to next addr and testcases
Subsystems (3)
Geliang Tang
v4 cover move to next addr and testcases
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 (2):
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 | 2 +- net/mptcp/protocol.h | 5 ++ .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-)
Signature · 1 line
2.29.2
Geliang Tang
PATCH v4 1/2 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 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.
--- net/mptcp/options.c | 1 + net/mptcp/pm.c | 15 +++++++++++++++ net/mptcp/pm_netlink.c | 2 +- net/mptcp/protocol.h | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-)
net/mptcp/options.c +1 -0
@@ -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
@@ -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 (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/pm_netlink.c +1 -1
@@ -245,7 +245,7 @@ static void check_work_pending(struct mptcp_sock *msk)WRITE_ONCE (msk->pm.work_pending, false); } -static struct mptcp_pm_add_entry * +struct mptcp_pm_add_entry *lookup_anno_list_by_saddr (struct mptcp_sock *msk,struct mptcp_addr_info *addr) {
net/mptcp/protocol.h +5 -0
@@ -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);
@@ -657,6 +659,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 * +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
Geliang Tang
PATCH v4 2/2 selftests: mptcp: signal addresses testcases
This patch added testcases for signalling multi valid and invalid addresses for both signal_address_tests and remove_tests.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +58 -0
@@ -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
Mat Martineau
[MPTCP] Re: [MPTCP][PATCH v4 mptcp-next 1/2] mptcp: move to next addr when subflow creation fail
In reply to Geliang TangQuoted 87 lines · Geliang Tang
When an invalid address was announced, the subflow couldn't be created for this address. Therefore
mptcp_pm_nl_subflow_establishedcouldn'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_echoedwhen the address is echoed. In it, uselookup_anno_list_by_saddrto check whether this address is in theanno_list. If it is, PM schedules the statusMPTCP_PM_SUBFLOW_ESTABLISHEDto invokemptcp_pm_create_subflow_or_signal_addrto 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/pm_netlink.c | 2 +- net/mptcp/protocol.h | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-)net/mptcp/options.c +1
-0@@ -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@@ -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 (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/pm_netlink.c +1
-1@@ -245,7 +245,7 @@ static void check_work_pending(struct mptcp_sock *msk)WRITE_ONCE (msk->pm.work_pending, false); } -static struct mptcp_pm_add_entry * +struct mptcp_pm_add_entry *lookup_anno_list_by_saddr (struct mptcp_sock *msk,struct mptcp_addr_info *addr) {net/mptcp/protocol.h +2
-0@@ -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);@@ -657,6 +659,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(structmptcp_sock*msk,struct mptcp_addr_info *addr);
net/mptcp/protocol.h bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk); · line 664
Quoted 3 lines
net/mptcp/protocol.h +3
-0+struct mptcp_pm_add_entry * +lookup_anno_list_by_saddr (struct mptcp_sock *msk, +struct mptcp_addr_info *addr);
Since this symbol is no longer static, it needs to be renamed to mptcp_lookup_anno_list_by_saddr().
The rest of the patch looks ok. Thanks!
Quoted 5 lines
int mptcp_pm_announce_addr(struct
mptcp_sock*msk,
const structmptcp_addr_info*addr,Signature · 1 line
2.29.2
--
Mat Martineau
Intel