[PATCH mptcp-next v4 6/6] selftests: mptcp: userspace pm remove id 0 address

Geliang Tang posted 6 patches 1 year ago
Only 5 patches received!
There is a newer version of this series
[PATCH mptcp-next v4 6/6] selftests: mptcp: userspace pm remove id 0 address
Posted by Geliang Tang 1 year ago
This patch adds a selftest for userpsace PM to remove id 0 address.

A new helper userspace_pm_rm_id_0_address_ns2() is added, in it use

        ./pm_nl_ctl rem token $tk id 0

to remove id 0 address.

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

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 322adac0cb1b..1c5c0bbae38f 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -3336,6 +3336,14 @@ userspace_pm_rm_id_0_subflow_ns2()
 	wait_rm_sf $ns2 1
 }
 
+userspace_pm_rm_id_0_address_ns2()
+{
+	local tk=$(evts_get_info token "$evts_ns2")
+
+	ip netns exec $ns2 ./pm_nl_ctl rem token $tk id 0
+	wait_rm_addr $ns2 1
+}
+
 # $1: subflows in ns1 ; $2: subflows in ns2
 chk_subflows()
 {
@@ -3514,6 +3522,27 @@ userspace_tests()
 		kill_events_pids
 		wait $tests_pid
 	fi
+
+	# userspace pm remove id 0 address
+	if reset_with_events "userspace pm remove id 0 address" &&
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+		set_userspace_pm $ns2
+		pm_nl_set_limits $ns1 0 1
+		speed=10 \
+			run_tests $ns1 $ns2 10.0.1.1 &
+		local tests_pid=$!
+		wait_mpj $ns2
+		userspace_pm_add_sf 10.0.3.2 20
+		chk_join_nr 1 1 1
+		chk_mptcp_info subflows 1 subflows 1
+		chk_subflows 2 2
+		userspace_pm_rm_id_0_address_ns2
+		chk_rm_nr 1 0
+		chk_mptcp_info subflows 1 subflows 1
+		chk_subflows 1 1
+		kill_events_pids
+		wait $tests_pid
+	fi
 }
 
 endpoint_tests()
-- 
2.35.3
Re: [PATCH mptcp-next v4 6/6] selftests: mptcp: userspace pm remove id 0 address
Posted by Matthieu Baerts 1 year ago
Hi Geliang,

On 18/08/2023 09:12, Geliang Tang wrote:
> This patch adds a selftest for userpsace PM to remove id 0 address.
> 
> A new helper userspace_pm_rm_id_0_address_ns2() is added, in it use
> 
>         ./pm_nl_ctl rem token $tk id 0
> 
> to remove id 0 address.
> 
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 322adac0cb1b..1c5c0bbae38f 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -3336,6 +3336,14 @@ userspace_pm_rm_id_0_subflow_ns2()
>  	wait_rm_sf $ns2 1
>  }
>  
> +userspace_pm_rm_id_0_address_ns2()
> +{
> +	local tk=$(evts_get_info token "$evts_ns2")
> +
> +	ip netns exec $ns2 ./pm_nl_ctl rem token $tk id 0
> +	wait_rm_addr $ns2 1
> +}
> +
>  # $1: subflows in ns1 ; $2: subflows in ns2
>  chk_subflows()
>  {
> @@ -3514,6 +3522,27 @@ userspace_tests()
>  		kill_events_pids
>  		wait $tests_pid
>  	fi
> +
> +	# userspace pm remove id 0 address
> +	if reset_with_events "userspace pm remove id 0 address" &&
> +	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
> +		set_userspace_pm $ns2
> +		pm_nl_set_limits $ns1 0 1
> +		speed=10 \
> +			run_tests $ns1 $ns2 10.0.1.1 &
> +		local tests_pid=$!
> +		wait_mpj $ns2
> +		userspace_pm_add_sf 10.0.3.2 20
> +		chk_join_nr 1 1 1
> +		chk_mptcp_info subflows 1 subflows 1
> +		chk_subflows 2 2
> +		userspace_pm_rm_id_0_address_ns2
> +		chk_rm_nr 1 0
> +		chk_mptcp_info subflows 1 subflows 1
> +		chk_subflows 1 1

When we only send a REMOVE_ADDR, why do we have one subflow that is
being removed? Is it because the other peer disconnected the subflow
linked to ID=0?

Do you mind checking this please?
Because the remove address command should not result in a host sending
both a REMOVE_ADDR and a FIN. That's up to the other host to take an
action when the REMOVE_ADDR is received, no?

Cheers,
Matt

> +		kill_events_pids
> +		wait $tests_pid
> +	fi
>  }
>  
>  endpoint_tests()

-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net