Re: [PATCH mptcp-next] selftests: mptcp: print stats before socket closure

Matthieu Baerts <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,dev.linux.lists.mptcp
Organization NGI0 Core
Message-ID <[email protected]>
On 14/08/2026 16:15, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Invalid iproute2 command `ip netns id` causes an error message and incorrect NSTAT_HISTORY file path.
> --
> 
> --- Patch [1]: [PATCH mptcp-next] selftests: mptcp: print stats before socket closure ---
> commit 0e02bc2b403cc7ef4929da44802ea29557081b60
> Author: Matthieu Baerts (NGI0) <[email protected]>
> 
> selftests: mptcp: print stats before socket closure
> 
> This commit adds a mechanism to dump socket statistics via ss and nstat
> just before socket closure when a poll timeout occurs. This helps debug
> timeout issues in the mptcp_connect test.
> 
>> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
>> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
>> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> [ ... ]
>> @@ -210,6 +210,19 @@ static void xgetaddrinfo(const char *node, const char *service,
>>  	}
>>  }
>>  
>> +static void print_err_stats(void)
>> +{
>> +	char cmd[128];
>> +
>> +	snprintf(cmd, sizeof(cmd), "ss -Menitam -o '%cport = :%s' >&2",
>> +		 listen_mode ? 's' : 'd', cfg_port);
>> +
>> +	fprintf(stderr, "socket stats before socket closure:\n");
>> +	(void)!system(cmd);
>> +	(void)!system("NSTAT_HISTORY='/tmp/$(ip netns id).nstat' nstat -s | "
> [Severity: Medium]
> Will this ip netns id command fail and cause an iproute2 error during the
> test?
> 
> It appears ip netns id is an invalid command, and should likely be
> ip netns identify.

No, 'ip netns id' is valid and is the same as 'ip netns identify'.

I used the short version initially to fit on 80 chars, but I guess I
should still use 'identify' to avoid this warning when sending the patch
upstream...

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.