[PATCH mptcp-net] selftests: mptcp: connect: -f: no reconnect

Matthieu Baerts (NGI0) posted 1 patch 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20250127-selftests-mptcp-fastclose-tests-v1-1-787609c66612@kernel.org
There is a newer version of this series
tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH mptcp-net] selftests: mptcp: connect: -f: no reconnect
Posted by Matthieu Baerts (NGI0) 2 months, 1 week ago
The '-f' parameter is there to force the kernel to emit MPTCP FASTCLOSE
by closing the connection with unread bytes in the receive queue.

The xdisconnect() helper was used to stop the connection, but it does
more than that: it will shut it down, then wait before reconnecting to
the same address. This causes the mptcp_join's "fastclose test" to fail
all the time.

This failure is due to a recent change, with commit 218cc166321f
("selftests: mptcp: avoid spurious errors on disconnect"), but that went
unnoticed because the test is currently ignored. The recent modification
only shown an existing issue: xdisconnect() doesn't need to be used
here, only the shutdown() part is needed.

Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Notes:
- With the modification, the mptcp_join's "fastclose test" is still a
  bit unstable on my side with a debug kernel. I didn't try to fix that.
  This is tracked by this (old) issue:
  https://github.com/multipath-tcp/mptcp_net-next/issues/324
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index 414addef9a4514c489ecd09249143fe0ce2af649..d240d02fa443a1cd802f0e705ab36db5c22063a8 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1302,7 +1302,7 @@ int main_loop(void)
 		return ret;
 
 	if (cfg_truncate > 0) {
-		xdisconnect(fd);
+		shutdown(fd, SHUT_WR);
 	} else if (--cfg_repeat > 0) {
 		xdisconnect(fd);
 

---
base-commit: ef015705ac0b0da25ea399d87f1fa2f545b2b3d5
change-id: 20250127-selftests-mptcp-fastclose-tests-af1fdd965826

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>
Re: [PATCH mptcp-net] selftests: mptcp: connect: -f: no reconnect
Posted by Mat Martineau 2 months, 1 week ago
On Mon, 27 Jan 2025, Matthieu Baerts (NGI0) wrote:

> The '-f' parameter is there to force the kernel to emit MPTCP FASTCLOSE
> by closing the connection with unread bytes in the receive queue.
>
> The xdisconnect() helper was used to stop the connection, but it does
> more than that: it will shut it down, then wait before reconnecting to
> the same address. This causes the mptcp_join's "fastclose test" to fail
> all the time.
>
> This failure is due to a recent change, with commit 218cc166321f
> ("selftests: mptcp: avoid spurious errors on disconnect"), but that went
> unnoticed because the test is currently ignored. The recent modification
> only shown an existing issue: xdisconnect() doesn't need to be used
> here, only the shutdown() part is needed.
>
> Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose test-cases")
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> Notes:
> - With the modification, the mptcp_join's "fastclose test" is still a
>  bit unstable on my side with a debug kernel. I didn't try to fix that.
>  This is tracked by this (old) issue:
>  https://github.com/multipath-tcp/mptcp_net-next/issues/324

Hi Matthieu -

Looks good, thank you:

Reviewed-by: Mat Martineau <martineau@kernel.org>

> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 414addef9a4514c489ecd09249143fe0ce2af649..d240d02fa443a1cd802f0e705ab36db5c22063a8 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -1302,7 +1302,7 @@ int main_loop(void)
> 		return ret;
>
> 	if (cfg_truncate > 0) {
> -		xdisconnect(fd);
> +		shutdown(fd, SHUT_WR);
> 	} else if (--cfg_repeat > 0) {
> 		xdisconnect(fd);
>
>
> ---
> base-commit: ef015705ac0b0da25ea399d87f1fa2f545b2b3d5
> change-id: 20250127-selftests-mptcp-fastclose-tests-af1fdd965826
>
> Best regards,
> -- 
> Matthieu Baerts (NGI0) <matttbe@kernel.org>
>
>
>
Re: [PATCH mptcp-net] selftests: mptcp: connect: -f: no reconnect
Posted by Matthieu Baerts 2 months, 1 week ago
Hi Mat,

On 29/01/2025 17:44, Mat Martineau wrote:
> On Mon, 27 Jan 2025, Matthieu Baerts (NGI0) wrote:
> 
>> The '-f' parameter is there to force the kernel to emit MPTCP FASTCLOSE
>> by closing the connection with unread bytes in the receive queue.
>>
>> The xdisconnect() helper was used to stop the connection, but it does
>> more than that: it will shut it down, then wait before reconnecting to
>> the same address. This causes the mptcp_join's "fastclose test" to fail
>> all the time.
>>
>> This failure is due to a recent change, with commit 218cc166321f
>> ("selftests: mptcp: avoid spurious errors on disconnect"), but that went
>> unnoticed because the test is currently ignored. The recent modification
>> only shown an existing issue: xdisconnect() doesn't need to be used
>> here, only the shutdown() part is needed.
>>
>> Fixes: 6bf41020b72b ("selftests: mptcp: update and extend fastclose
>> test-cases")
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
>> Notes:
>> - With the modification, the mptcp_join's "fastclose test" is still a
>>  bit unstable on my side with a debug kernel. I didn't try to fix that.
>>  This is tracked by this (old) issue:
>>  https://github.com/multipath-tcp/mptcp_net-next/issues/324
> 
> Hi Matthieu -
> 
> Looks good, thank you:

Thank you for the review!

Now in our tree (fixes for -net):

New patches for t/upstream-net and t/upstream:
- 9ebcf2ea5cfc: selftests: mptcp: connect: -f: no reconnect
- Results: 062dec17fb88..d2351c5ab4ff (export-net)
- Results: 896f230a519b..96e665850a6e (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/28cc1b7f422a72ee103c7ea46cc33bb65e4d4823/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/ef1b554d4eb2a5413bcca1922d5ae6d609e5d3d0/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.