Skip to content

Commit

Permalink
selftests: mptcp: explicitly trigger the listener diag code-path
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Paolo Abeni authored and intel-lab-lkp committed Feb 21, 2024
1 parent 9712550 commit 4023796
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/testing/selftests/net/mptcp/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ chk_msk_nr()
__chk_msk_nr "grep -c token:" "$@"
}

chk_listener_nr()
{
local expected=$1
local msg="$2"

__chk_nr "ss -inmlHMON $ns | wc -l" "$expected" "$msg - mptcp" 0
__chk_nr "ss -inmlHtON $ns | wc -l" "$expected" "$msg - subflows"
}

wait_msk_nr()
{
local condition="grep -c token:"
Expand Down Expand Up @@ -279,5 +288,20 @@ flush_pids
chk_msk_inuse 0 "many->0"
chk_msk_cestab 0 "many->0"

chk_listener_nr 0 "no listener sockets"
NR_SERVERS=100
for I in $(seq 1 $NR_SERVERS); do
ip netns exec $ns ./mptcp_connect -p $((I + 20001)) -l 0.0.0.0 2>&1 >/dev/null &
mptcp_lib_wait_local_port_listen $ns $((I + 20001))
done

chk_listener_nr $NR_SERVERS "many listener sockets"

# gracefull termination
for I in $(seq 1 $NR_SERVERS); do
echo a | ip netns exec $ns ./mptcp_connect -p $((I + 20001)) 127.0.0.1 2>&1 >/dev/null
done
flush_pids

mptcp_lib_result_print_all_tap
exit $ret

0 comments on commit 4023796

Please sign in to comment.