Skip to content

Commit

Permalink
selftests: mptcp: join: check CURRESTAB counters
Browse files Browse the repository at this point in the history
This patch adds a new helper chk_cestab_nr() to check the current
established connections counter MIB_CURRESTAB.

In do_transfer(), invoke chk_cestab_nr() to check during the connection
and when the connectin closed.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Nov 29, 2023
1 parent a7efa06 commit 0b0b2dc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,23 @@ pm_nl_set_endpoint()
fi
}

chk_cestab_nr()
{
local ns=$1
local cestab=$2
local count

print_check "cestab"
count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab")
if [ -z "$count" ]; then
print_skip
elif [ "$count" != "$cestab" ]; then
fail_test "got $count current establish[s] expected $cestab"
else
print_ok
fi
}

do_transfer()
{
local listener_ns="$1"
Expand All @@ -990,6 +1007,9 @@ do_transfer()
local fastclose=${fastclose:-""}
local speed=${speed:-"fast"}

local addr_nr_ns1=${addr_nr_ns1:-0}
local addr_nr_ns2=${addr_nr_ns2:-0}

:> "$cout"
:> "$sout"
:> "$capout"
Expand Down Expand Up @@ -1090,6 +1110,13 @@ do_transfer()

pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr

if [ $addr_nr_ns1 != "0" ]; then
chk_cestab_nr $ns1 1
fi
if [ $addr_nr_ns2 != "0" ]; then
chk_cestab_nr $ns2 1
fi

wait $cpid
local retc=$?
wait $spid
Expand All @@ -1100,6 +1127,13 @@ do_transfer()
kill $cappid
fi

if [ $addr_nr_ns1 != "0" ]; then
chk_cestab_nr $ns1 0
fi
if [ $addr_nr_ns2 != "0" ]; then
chk_cestab_nr $ns2 0
fi

NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \
nstat | grep Tcp > /tmp/${listener_ns}.out
NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \
Expand Down

0 comments on commit 0b0b2dc

Please sign in to comment.