From 0b0b2dc232c5f08ecc296c7051b0eab618fbc13c Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 29 Nov 2023 19:10:52 +0800 Subject: [PATCH] selftests: mptcp: join: check CURRESTAB counters 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 --- .../testing/selftests/net/mptcp/mptcp_join.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 8362ea454af387..4327269c008a69 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -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" @@ -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" @@ -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 @@ -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} \