Commit cbfafac4 authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski

selftests: mptcp: add extra_args in do_transfer

Instead of using a global variable mptcp_connect, this patch added
a new local variable extra_args in do_transfer() to store the extra
arguments passing to the mptcp_connect commands.

This patch also renamed the speed level 'least' to 'speed_*'. This
more flexible way can avoid the need to add new speed levels in the
future.
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 922fd2b3
...@@ -12,7 +12,6 @@ cout="" ...@@ -12,7 +12,6 @@ cout=""
ksft_skip=4 ksft_skip=4
timeout_poll=30 timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1)) timeout_test=$((timeout_poll * 2 + 1))
mptcp_connect=""
capture=0 capture=0
checksum=0 checksum=0
ip_mptcp=0 ip_mptcp=0
...@@ -444,12 +443,13 @@ do_transfer() ...@@ -444,12 +443,13 @@ do_transfer()
NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \
nstat -n nstat -n
local extra_args
if [ $speed = "fast" ]; then if [ $speed = "fast" ]; then
mptcp_connect="./mptcp_connect -j" extra_args="-j"
elif [ $speed = "slow" ]; then elif [ $speed = "slow" ]; then
mptcp_connect="./mptcp_connect -r 50" extra_args="-r 50"
elif [ $speed = "least" ]; then elif [[ $speed = "speed_"* ]]; then
mptcp_connect="./mptcp_connect -r 10" extra_args="-r ${speed:6}"
fi fi
local local_addr local local_addr
...@@ -462,13 +462,13 @@ do_transfer() ...@@ -462,13 +462,13 @@ do_transfer()
if [ "$test_link_fail" -eq 2 ];then if [ "$test_link_fail" -eq 2 ];then
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${listener_ns} \ ip netns exec ${listener_ns} \
$mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
${local_addr} < "$sinfail" > "$sout" & $extra_args ${local_addr} < "$sinfail" > "$sout" &
else else
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${listener_ns} \ ip netns exec ${listener_ns} \
$mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
${local_addr} < "$sin" > "$sout" & $extra_args ${local_addr} < "$sin" > "$sout" &
fi fi
spid=$! spid=$!
...@@ -477,15 +477,15 @@ do_transfer() ...@@ -477,15 +477,15 @@ do_transfer()
if [ "$test_link_fail" -eq 0 ];then if [ "$test_link_fail" -eq 0 ];then
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${connector_ns} \ ip netns exec ${connector_ns} \
$mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
$connect_addr < "$cin" > "$cout" & $extra_args $connect_addr < "$cin" > "$cout" &
else else
( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \ ( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \
tee "$cinsent" | \ tee "$cinsent" | \
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${connector_ns} \ ip netns exec ${connector_ns} \
$mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
$connect_addr > "$cout" & $extra_args $connect_addr > "$cout" &
fi fi
cpid=$! cpid=$!
...@@ -1507,7 +1507,7 @@ add_addr_timeout_tests() ...@@ -1507,7 +1507,7 @@ add_addr_timeout_tests()
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
pm_nl_add_endpoint $ns1 10.0.3.1 flags signal pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
run_tests $ns1 $ns2 10.0.1.1 0 0 0 least run_tests $ns1 $ns2 10.0.1.1 0 0 0 speed_10
chk_join_nr "signal addresses, ADD_ADDR timeout" 2 2 2 chk_join_nr "signal addresses, ADD_ADDR timeout" 2 2 2
chk_add_nr 8 0 chk_add_nr 8 0
...@@ -1517,7 +1517,7 @@ add_addr_timeout_tests() ...@@ -1517,7 +1517,7 @@ add_addr_timeout_tests()
pm_nl_add_endpoint $ns1 10.0.12.1 flags signal pm_nl_add_endpoint $ns1 10.0.12.1 flags signal
pm_nl_add_endpoint $ns1 10.0.3.1 flags signal pm_nl_add_endpoint $ns1 10.0.3.1 flags signal
pm_nl_set_limits $ns2 2 2 pm_nl_set_limits $ns2 2 2
run_tests $ns1 $ns2 10.0.1.1 0 0 0 least run_tests $ns1 $ns2 10.0.1.1 0 0 0 speed_10
chk_join_nr "invalid address, ADD_ADDR timeout" 1 1 1 chk_join_nr "invalid address, ADD_ADDR timeout" 1 1 1
chk_add_nr 8 0 chk_add_nr 8 0
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment