Skip to content

Commit b4b51d3

Browse files
Paolo Abenikuba-moo
authored andcommitted
selftests: mptcp: explicitly trigger the listener diag code-path
The mptcp diag interface already experienced a few locking bugs that lockdep and appropriate coverage have detected in advance. Let's add a test-case triggering the relevant code path, to prevent similar issues in the future. Be careful to cope with very slow environments. Note that we don't need an explicit timeout on the mptcp_connect subprocess to cope with eventual bug/hang-up as the final cleanup terminating the child processes will take care of that. Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-10-162e87e48497@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d6a9608 commit b4b51d3

File tree

1 file changed

+29
-1
lines changed
  • tools/testing/selftests/net/mptcp

1 file changed

+29
-1
lines changed

tools/testing/selftests/net/mptcp/diag.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ flush_pids()
2020

2121
ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
2222

23-
for _ in $(seq 10); do
23+
for _ in $(seq $((timeout_poll * 10))); do
2424
[ -z "$(ip netns pids "${ns}")" ] && break
2525
sleep 0.1
2626
done
@@ -91,6 +91,15 @@ chk_msk_nr()
9191
__chk_msk_nr "grep -c token:" "$@"
9292
}
9393

94+
chk_listener_nr()
95+
{
96+
local expected=$1
97+
local msg="$2"
98+
99+
__chk_nr "ss -inmlHMON $ns | wc -l" "$expected" "$msg - mptcp" 0
100+
__chk_nr "ss -inmlHtON $ns | wc -l" "$expected" "$msg - subflows"
101+
}
102+
94103
wait_msk_nr()
95104
{
96105
local condition="grep -c token:"
@@ -289,5 +298,24 @@ flush_pids
289298
chk_msk_inuse 0 "many->0"
290299
chk_msk_cestab 0 "many->0"
291300

301+
chk_listener_nr 0 "no listener sockets"
302+
NR_SERVERS=100
303+
for I in $(seq 1 $NR_SERVERS); do
304+
ip netns exec $ns ./mptcp_connect -p $((I + 20001)) \
305+
-t ${timeout_poll} -l 0.0.0.0 >/dev/null 2>&1 &
306+
done
307+
308+
for I in $(seq 1 $NR_SERVERS); do
309+
mptcp_lib_wait_local_port_listen $ns $((I + 20001))
310+
done
311+
312+
chk_listener_nr $NR_SERVERS "many listener sockets"
313+
314+
# graceful termination
315+
for I in $(seq 1 $NR_SERVERS); do
316+
echo a | ip netns exec $ns ./mptcp_connect -p $((I + 20001)) 127.0.0.1 >/dev/null 2>&1 &
317+
done
318+
flush_pids
319+
292320
mptcp_lib_result_print_all_tap
293321
exit $ret

0 commit comments

Comments
 (0)