diff mbox series

[3/3] selftests: mptcp: add a testcase for invalid addr timeout

Message ID tencent_FF589D3CCA6CB1BB13DCD53D469928F3610A@qq.com (mailing list archive)
State Changes Requested
Delegated to: Geliang Tang
Headers show
Series [1/3] mptcp: fix invalid addr occupy 'add_addr_accepted' | expand

Commit Message

Gang Yan Jan. 9, 2025, 1:32 p.m. UTC
From: Gang Yan <yangang@kylinos.cn>

This patch adds a timeout testcase, which includes a invalid address
within the same LAN, along with another valid address. The invalid
address in the LAN triggers a TCP error, leading to an incorrect
increment of 'add_addr_accepted'. This test ensures the valid address
can still join in this situation.

Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Matthieu Baerts Jan. 9, 2025, 5:39 p.m. UTC | #1
Hi Gang

On 09/01/2025 14:32, Gang Yan wrote:
> From: Gang Yan <yangang@kylinos.cn>
> 
> This patch adds a timeout testcase, which includes a invalid address
> within the same LAN, along with another valid address. The invalid
> address in the LAN triggers a TCP error, leading to an incorrect
> increment of 'add_addr_accepted'. This test ensures the valid address
> can still join in this situation.
> 
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 6b0705d10840..80ce8daac2a8 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -2318,6 +2318,20 @@ add_addr_timeout_tests()
>  			chk_join_nr 1 1 1
>  		chk_add_nr 8 0
>  	fi
> +
> +	# signal invalid LAN addresses, which will cause an error at TCP level
> +	if reset_with_add_addr_timeout "invalid LAN address, ADD_ADDR timeout"; then
> +		pm_nl_set_limits $ns1 2 2
> +		pm_nl_add_endpoint $ns1 10.0.1.3 flags signal

Please add a comment that 10.0.1.3 is invalid: it doesn't look like one
when you look at it.

> +		pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
> +		pm_nl_set_limits $ns2 2 2

Should you not put the limit to 1 accepted add_addr? With 2, it should
be able to connect even without the patch, no?

(or that's maybe what I didn't get with the double increment?)

> +
> +		speed=10 \
> +			run_tests $ns1 $ns2 10.0.1.1
> +		join_syn_tx=+2 \

Is the '+' needed because there might be some retransmissions? Can you
not prevent them somehow? e.g. by setting a different sysctl knob? If
yes, it is more reliable, and the previous patch is not needed.

> +			chk_join_nr 1 1 1
> +		chk_add_nr 8 0
> +	fi
>  }
>  
>  remove_tests()

Cheers,
Matt
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 6b0705d10840..80ce8daac2a8 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -2318,6 +2318,20 @@  add_addr_timeout_tests()
 			chk_join_nr 1 1 1
 		chk_add_nr 8 0
 	fi
+
+	# signal invalid LAN addresses, which will cause an error at TCP level
+	if reset_with_add_addr_timeout "invalid LAN address, ADD_ADDR timeout"; then
+		pm_nl_set_limits $ns1 2 2
+		pm_nl_add_endpoint $ns1 10.0.1.3 flags signal
+		pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
+		pm_nl_set_limits $ns2 2 2
+
+		speed=10 \
+			run_tests $ns1 $ns2 10.0.1.1
+		join_syn_tx=+2 \
+			chk_join_nr 1 1 1
+		chk_add_nr 8 0
+	fi
 }
 
 remove_tests()