selftests: mptcp: add fastclose env var

Use a new env var fastclose instead of passing fastclose to addr_nr_ns2.
It can be set with 'server' or 'client':

  addr_nr_ns2=fastclose_client \
          run_tests $ns1 $ns2 10.0.1.1

  ->

  fastclose=client \
          run_tests $ns1 $ns2 10.0.1.1.

With this change, the fullmesh flag setting code can be moved into
pm_nl_set_endpoint() from do_transfer().

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/20230712-upstream-net-next-20230712-selftests-mptcp-use-local-env-v1-2-f1c8b62fbf95@tessares.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Geliang Tang 2023-07-12 18:03:17 +02:00 committed by Jakub Kicinski
parent 662aa22d7d
commit 080b7f5733
1 changed files with 12 additions and 9 deletions

View File

@ -55,6 +55,7 @@ unset test_linkfail
unset addr_nr_ns1 unset addr_nr_ns1
unset addr_nr_ns2 unset addr_nr_ns2
unset sflags unset sflags
unset fastclose
# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
# (ip6 && (ip6[74] & 0xf0) == 0x30)'" # (ip6 && (ip6[74] & 0xf0) == 0x30)'"
@ -832,6 +833,12 @@ pm_nl_set_endpoint()
local addr_nr_ns2=${addr_nr_ns2:-0} local addr_nr_ns2=${addr_nr_ns2:-0}
local sflags=${sflags:-""} local sflags=${sflags:-""}
local flags="subflow"
if [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then
flags="${flags},fullmesh"
addr_nr_ns2=${addr_nr_ns2:9}
fi
# let the mptcp subflow be established in background before # let the mptcp subflow be established in background before
# do endpoint manipulation # do endpoint manipulation
if [ $addr_nr_ns1 != "0" ] || [ $addr_nr_ns2 != "0" ]; then if [ $addr_nr_ns1 != "0" ] || [ $addr_nr_ns2 != "0" ]; then
@ -984,6 +991,7 @@ do_transfer()
local port=$((10000 + TEST_COUNT - 1)) local port=$((10000 + TEST_COUNT - 1))
local cappid local cappid
local FAILING_LINKS=${FAILING_LINKS:-""} local FAILING_LINKS=${FAILING_LINKS:-""}
local fastclose=${fastclose:-""}
:> "$cout" :> "$cout"
:> "$sout" :> "$sout"
@ -1020,11 +1028,10 @@ do_transfer()
extra_args="-r ${speed:6}" extra_args="-r ${speed:6}"
fi fi
local flags="subflow"
local extra_cl_args="" local extra_cl_args=""
local extra_srv_args="" local extra_srv_args=""
local trunc_size="" local trunc_size=""
if [[ "${addr_nr_ns2}" = "fastclose_"* ]]; then if [ -n "${fastclose}" ]; then
if [ ${test_linkfail} -le 1 ]; then if [ ${test_linkfail} -le 1 ]; then
echo "fastclose tests need test_linkfail argument" echo "fastclose tests need test_linkfail argument"
fail_test fail_test
@ -1033,7 +1040,7 @@ do_transfer()
# disconnect # disconnect
trunc_size=${test_linkfail} trunc_size=${test_linkfail}
local side=${addr_nr_ns2:10} local side=${fastclose}
if [ ${side} = "client" ]; then if [ ${side} = "client" ]; then
extra_cl_args="-f ${test_linkfail}" extra_cl_args="-f ${test_linkfail}"
@ -1046,10 +1053,6 @@ do_transfer()
fail_test fail_test
return 1 return 1
fi fi
addr_nr_ns2=0
elif [[ "${addr_nr_ns2}" = "fullmesh_"* ]]; then
flags="${flags},fullmesh"
addr_nr_ns2=${addr_nr_ns2:9}
fi fi
extra_srv_args="$extra_args $extra_srv_args" extra_srv_args="$extra_args $extra_srv_args"
@ -3186,7 +3189,7 @@ fullmesh_tests()
fastclose_tests() fastclose_tests()
{ {
if reset_check_counter "fastclose test" "MPTcpExtMPFastcloseTx"; then if reset_check_counter "fastclose test" "MPTcpExtMPFastcloseTx"; then
test_linkfail=1024 addr_nr_ns2=fastclose_client \ test_linkfail=1024 fastclose=client \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 chk_join_nr 0 0 0
chk_fclose_nr 1 1 chk_fclose_nr 1 1
@ -3194,7 +3197,7 @@ fastclose_tests()
fi fi
if reset_check_counter "fastclose server test" "MPTcpExtMPFastcloseRx"; then if reset_check_counter "fastclose server test" "MPTcpExtMPFastcloseRx"; then
test_linkfail=1024 addr_nr_ns2=fastclose_server \ test_linkfail=1024 fastclose=server \
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 chk_join_nr 0 0 0
chk_fclose_nr 1 1 invert chk_fclose_nr 1 1 invert