This patch added a new function chk_rst_nr() to check the numbers
of the MP_RST sending and receiving mibs.
Showed in the output whether the inverted namespaces check order is used.
Since if we pass -Cz to mptcp_join.sh, the MP_RST information is showed
twice.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index f71494b87d5e..3252865352f3 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -802,6 +802,55 @@ chk_fail_nr()
[ "${dump_stats}" = 1 ] && dump_stats
}
+chk_rst_nr()
+{
+ local rst_tx=$1
+ local rst_rx=$2
+ local ns_invert=${3:-""}
+ local count
+ local dump_stats
+
+ if [ -z $ns_invert ]; then
+ ns_tx=$ns1
+ ns_rx=$ns2
+ elif [ $ns_invert = "invert" ]; then
+ ns_tx=$ns2
+ ns_rx=$ns1
+ fi
+
+ printf "%-${nr_blank}s %s" " " "rtx"
+ count=`ip netns exec $ns_tx nstat -as | grep MPTcpExtMPRstTx | awk '{print $2}'`
+ [ -z "$count" ] && count=0
+ if [ "$count" != "$rst_tx" ]; then
+ echo "[fail] got $count MP_RST[s] TX expected $rst_tx"
+ ret=1
+ dump_stats=1
+ else
+ echo -n "[ ok ]"
+ fi
+
+ echo -n " - rstrx "
+ count=`ip netns exec $ns_rx nstat -as | grep MPTcpExtMPRstRx | awk '{print $2}'`
+ [ -z "$count" ] && count=0
+ if [ "$count" != "$rst_rx" ]; then
+ echo "[fail] got $count MP_RST[s] RX expected $rst_rx"
+ ret=1
+ dump_stats=1
+ else
+ if [ -z $ns_invert ]; then
+ echo "[ ok ]"
+ elif [ $ns_invert = "invert" ]; then
+ echo -n "[ ok ]"
+ fi
+ fi
+
+ if [ ! -z $ns_invert ] && [ $ns_invert = "invert" ]; then
+ echo " - invert"
+ fi
+
+ [ "${dump_stats}" = 1 ] && dump_stats
+}
+
chk_infi_nr()
{
local mp_infi_nr_tx=$1
@@ -920,6 +969,7 @@ chk_join_nr()
if [ $checksum -eq 1 ]; then
chk_csum_nr
chk_fail_nr 0 0
+ chk_rst_nr 0 0
chk_infi_nr 0 0
fi
}
--
2.34.1