This patch added the self tests for MP_FASTCLOSE. Added a new argment
fastclose for the function do_transfer(). Passed the extra argments '-I 2'
and '-I 3' to the mptcp_connect commands to disconnect the connections to
trigger the MP_FASTCLOSE sending and receiving. Used chk_fclose_nr to check
the MP_FASTCLOSE mibs and used chk_rst_nr to check the MP_RST mibs.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 37 +++++++++++++++++--
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 5321cab1400c..e4f4117fad36 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -424,6 +424,7 @@ do_transfer()
addr_nr_ns2="$8"
speed="$9"
sflags="${10}"
+ fastclose="${11}"
port=$((10000+$TEST_COUNT))
TEST_COUNT=$((TEST_COUNT+1))
@@ -462,6 +463,13 @@ do_transfer()
extra_args="-r 10"
fi
+ if [ $fastclose -eq 2 ]; then
+ # disconnect
+ extra_args="$extra_args -I 2"
+ elif [ $fastclose -eq 3 ]; then
+ extra_args="$extra_args -I 3"
+ fi
+
local local_addr
if is_v6 "${connect_addr}"; then
local_addr="::"
@@ -607,7 +615,7 @@ do_transfer()
fi
fi
- if [ ! -z $sflags ]; then
+ if [ $sflags != "null" ]; then
sleep 1
for netns in "$ns1" "$ns2"; do
pm_nl_show_endpoints $netns | while read line; do
@@ -698,7 +706,8 @@ run_tests()
addr_nr_ns1="${5:-0}"
addr_nr_ns2="${6:-0}"
speed="${7:-fast}"
- sflags="${8:-""}"
+ sflags="${8:-null}"
+ fastclose="${9:-0}"
# create the input file for the failure test when
# the first failure test run
@@ -725,7 +734,7 @@ run_tests()
fi
do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
- ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags}
+ ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${sflags} ${fastclose}
}
dump_stats()
@@ -2277,6 +2286,21 @@ userspace_tests()
chk_rm_nr 0 0
}
+fastclose_tests()
+{
+ reset
+ run_tests $ns1 $ns2 10.0.1.1 0 0 0 fast null 2
+ chk_join_nr "fastclose test 1" 0 0 0
+ chk_fclose_nr 1 1
+ chk_rst_nr 1 1 invert
+
+ reset
+ run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow null 3
+ chk_join_nr "fastclose test 2" 0 0 0
+ chk_fclose_nr 2 2
+ chk_rst_nr 2 2 invert
+}
+
all_tests()
{
subflows_tests
@@ -2295,6 +2319,7 @@ all_tests()
deny_join_id0_tests
fullmesh_tests
userspace_tests
+ fastclose_tests
}
# [$1: error message]
@@ -2322,6 +2347,7 @@ usage()
echo " -d deny_join_id0_tests"
echo " -m fullmesh_tests"
echo " -u userspace_tests"
+ echo " -z fastclose_tests"
echo " -c capture pcap files"
echo " -C enable data checksum"
echo " -i use ip mptcp"
@@ -2353,7 +2379,7 @@ if [ $do_all_tests -eq 1 ]; then
exit $ret
fi
-while getopts 'fesltra64bpkdmuchCSi' opt; do
+while getopts 'fesltra64bpkdmuchzCSi' opt; do
case $opt in
f)
subflows_tests
@@ -2403,6 +2429,9 @@ while getopts 'fesltra64bpkdmuchCSi' opt; do
u)
userspace_tests
;;
+ z)
+ fastclose_tests
+ ;;
c)
;;
C)
--
2.34.1