Merge branch 'mptcp-selftest-fine-tuning-and-cleanup'
Mat Martineau says: ==================== mptcp: Selftest fine-tuning and cleanup Patch 1 adjusts the mptcp selftest timeout to account for slow machines running debug builds. Patch 2 simplifies one test function. Patches 3-6 do some cleanup, like deleting unused variables and avoiding extra work when only printing usage information. Patch 7 improves the checksum tests by utilizing existing checksum MIBs. ==================== Link: https://lore.kernel.org/r/20220218030311.367536-1-mathew.j.martineau@linux.intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -432,6 +432,8 @@ do_transfer()
|
|||||||
local stat_ackrx_last_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableACKRX")
|
local stat_ackrx_last_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableACKRX")
|
||||||
local stat_cookietx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent")
|
local stat_cookietx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent")
|
||||||
local stat_cookierx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv")
|
local stat_cookierx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv")
|
||||||
|
local stat_csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr")
|
||||||
|
local stat_csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr")
|
||||||
|
|
||||||
timeout ${timeout_test} \
|
timeout ${timeout_test} \
|
||||||
ip netns exec ${listener_ns} \
|
ip netns exec ${listener_ns} \
|
||||||
@@ -524,6 +526,23 @@ do_transfer()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $checksum; then
|
||||||
|
local csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr")
|
||||||
|
local csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr")
|
||||||
|
|
||||||
|
local csum_err_s_nr=$((csum_err_s - stat_csum_err_s))
|
||||||
|
if [ $csum_err_s_nr -gt 0 ]; then
|
||||||
|
printf "[ FAIL ]\nserver got $csum_err_s_nr data checksum error[s]"
|
||||||
|
rets=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local csum_err_c_nr=$((csum_err_c - stat_csum_err_c))
|
||||||
|
if [ $csum_err_c_nr -gt 0 ]; then
|
||||||
|
printf "[ FAIL ]\nclient got $csum_err_c_nr data checksum error[s]"
|
||||||
|
retc=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then
|
if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then
|
||||||
printf "[ OK ]"
|
printf "[ OK ]"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ capture=0
|
|||||||
checksum=0
|
checksum=0
|
||||||
ip_mptcp=0
|
ip_mptcp=0
|
||||||
do_all_tests=1
|
do_all_tests=1
|
||||||
|
init=0
|
||||||
|
|
||||||
TEST_COUNT=0
|
TEST_COUNT=0
|
||||||
|
|
||||||
@@ -38,11 +39,11 @@ CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
|
|||||||
6 0 0 65535,
|
6 0 0 65535,
|
||||||
6 0 0 0"
|
6 0 0 0"
|
||||||
|
|
||||||
init()
|
init_partial()
|
||||||
{
|
{
|
||||||
capout=$(mktemp)
|
capout=$(mktemp)
|
||||||
|
|
||||||
rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
|
rndh=$(mktemp -u XXXXXX)
|
||||||
|
|
||||||
ns1="ns1-$rndh"
|
ns1="ns1-$rndh"
|
||||||
ns2="ns2-$rndh"
|
ns2="ns2-$rndh"
|
||||||
@@ -98,6 +99,41 @@ cleanup_partial()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_tools()
|
||||||
|
{
|
||||||
|
if ! ip -Version &> /dev/null; then
|
||||||
|
echo "SKIP: Could not run test without ip tool"
|
||||||
|
exit $ksft_skip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! iptables -V &> /dev/null; then
|
||||||
|
echo "SKIP: Could not run all tests without iptables tool"
|
||||||
|
exit $ksft_skip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! ip6tables -V &> /dev/null; then
|
||||||
|
echo "SKIP: Could not run all tests without ip6tables tool"
|
||||||
|
exit $ksft_skip
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
init=1
|
||||||
|
|
||||||
|
check_tools
|
||||||
|
|
||||||
|
sin=$(mktemp)
|
||||||
|
sout=$(mktemp)
|
||||||
|
cin=$(mktemp)
|
||||||
|
cinsent=$(mktemp)
|
||||||
|
cout=$(mktemp)
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
make_file "$cin" "client" 1
|
||||||
|
make_file "$sin" "server" 1
|
||||||
|
}
|
||||||
|
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
rm -f "$cin" "$cout" "$sinfail"
|
rm -f "$cin" "$cout" "$sinfail"
|
||||||
@@ -107,8 +143,13 @@ cleanup()
|
|||||||
|
|
||||||
reset()
|
reset()
|
||||||
{
|
{
|
||||||
cleanup_partial
|
if [ "${init}" != "1" ]; then
|
||||||
init
|
init
|
||||||
|
else
|
||||||
|
cleanup_partial
|
||||||
|
fi
|
||||||
|
|
||||||
|
init_partial
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_with_cookies()
|
reset_with_cookies()
|
||||||
@@ -162,24 +203,6 @@ reset_with_allow_join_id0()
|
|||||||
ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable
|
ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable
|
||||||
}
|
}
|
||||||
|
|
||||||
ip -Version > /dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
echo "SKIP: Could not run test without ip tool"
|
|
||||||
exit $ksft_skip
|
|
||||||
fi
|
|
||||||
|
|
||||||
iptables -V > /dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
echo "SKIP: Could not run all tests without iptables tool"
|
|
||||||
exit $ksft_skip
|
|
||||||
fi
|
|
||||||
|
|
||||||
ip6tables -V > /dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
echo "SKIP: Could not run all tests without ip6tables tool"
|
|
||||||
exit $ksft_skip
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_file_err()
|
print_file_err()
|
||||||
{
|
{
|
||||||
ls -l "$1" 1>&2
|
ls -l "$1" 1>&2
|
||||||
@@ -240,16 +263,6 @@ is_v6()
|
|||||||
[ -z "${1##*:*}" ]
|
[ -z "${1##*:*}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
is_addr()
|
|
||||||
{
|
|
||||||
[ -z "${1##*[.:]*}" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
is_number()
|
|
||||||
{
|
|
||||||
[[ $1 == ?(-)+([0-9]) ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: ns, $2: port
|
# $1: ns, $2: port
|
||||||
wait_local_port_listen()
|
wait_local_port_listen()
|
||||||
{
|
{
|
||||||
@@ -379,16 +392,13 @@ pm_nl_show_endpoints()
|
|||||||
pm_nl_change_endpoint()
|
pm_nl_change_endpoint()
|
||||||
{
|
{
|
||||||
local ns=$1
|
local ns=$1
|
||||||
local flags=$2
|
local id=$2
|
||||||
local id=$3
|
local flags=$3
|
||||||
local addr=$4
|
|
||||||
local port=""
|
|
||||||
|
|
||||||
if [ $ip_mptcp -eq 1 ]; then
|
if [ $ip_mptcp -eq 1 ]; then
|
||||||
ip -n $ns mptcp endpoint change id $id ${flags//","/" "}
|
ip -n $ns mptcp endpoint change id $id ${flags//","/" "}
|
||||||
else
|
else
|
||||||
if [ $5 -ne 0 ]; then port="port $5"; fi
|
ip netns exec $ns ./pm_nl_ctl set id $id flags $flags
|
||||||
ip netns exec $ns ./pm_nl_ctl set $addr flags $flags $port
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,24 +601,16 @@ do_transfer()
|
|||||||
for netns in "$ns1" "$ns2"; do
|
for netns in "$ns1" "$ns2"; do
|
||||||
pm_nl_show_endpoints $netns | while read line; do
|
pm_nl_show_endpoints $netns | while read line; do
|
||||||
local arr=($line)
|
local arr=($line)
|
||||||
local addr
|
local nr=0
|
||||||
local port=0
|
|
||||||
local id
|
local id
|
||||||
|
|
||||||
for i in ${arr[@]}; do
|
for i in ${arr[@]}; do
|
||||||
if is_addr $i; then
|
if [ $i = "id" ]; then
|
||||||
addr=$i
|
id=${arr[$nr+1]}
|
||||||
elif is_number $i; then
|
|
||||||
# The minimum expected port number is 10000
|
|
||||||
if [ $i -gt 10000 ]; then
|
|
||||||
port=$i
|
|
||||||
# The maximum id number is 255
|
|
||||||
elif [ $i -lt 255 ]; then
|
|
||||||
id=$i
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
let nr+=1
|
||||||
done
|
done
|
||||||
pm_nl_change_endpoint $netns $sflags $id $addr $port
|
pm_nl_change_endpoint $netns $id $sflags
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -686,8 +688,6 @@ run_tests()
|
|||||||
addr_nr_ns2="${6:-0}"
|
addr_nr_ns2="${6:-0}"
|
||||||
speed="${7:-fast}"
|
speed="${7:-fast}"
|
||||||
sflags="${8:-""}"
|
sflags="${8:-""}"
|
||||||
lret=0
|
|
||||||
oldin=""
|
|
||||||
|
|
||||||
# create the input file for the failure test when
|
# create the input file for the failure test when
|
||||||
# the first failure test run
|
# the first failure test run
|
||||||
@@ -715,7 +715,6 @@ run_tests()
|
|||||||
|
|
||||||
do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
|
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}
|
||||||
lret=$?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_stats()
|
dump_stats()
|
||||||
@@ -2098,8 +2097,14 @@ all_tests()
|
|||||||
fullmesh_tests
|
fullmesh_tests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# [$1: error message]
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
|
if [ -n "${1}" ]; then
|
||||||
|
echo "${1}"
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "mptcp_join usage:"
|
echo "mptcp_join usage:"
|
||||||
echo " -f subflows_tests"
|
echo " -f subflows_tests"
|
||||||
echo " -e subflows_error_tests"
|
echo " -e subflows_error_tests"
|
||||||
@@ -2120,17 +2125,9 @@ usage()
|
|||||||
echo " -C enable data checksum"
|
echo " -C enable data checksum"
|
||||||
echo " -i use ip mptcp"
|
echo " -i use ip mptcp"
|
||||||
echo " -h help"
|
echo " -h help"
|
||||||
}
|
|
||||||
|
|
||||||
sin=$(mktemp)
|
exit ${ret}
|
||||||
sout=$(mktemp)
|
}
|
||||||
cin=$(mktemp)
|
|
||||||
cinsent=$(mktemp)
|
|
||||||
cout=$(mktemp)
|
|
||||||
init
|
|
||||||
make_file "$cin" "client" 1
|
|
||||||
make_file "$sin" "server" 1
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
# check for "capture/checksum" args before launching tests
|
# check for "capture/checksum" args before launching tests
|
||||||
@@ -2208,9 +2205,12 @@ while getopts 'fesltra64bpkdmchCSi' opt; do
|
|||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
;;
|
;;
|
||||||
h | *)
|
h)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
usage "Unknown option: -${opt}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
timeout=600
|
timeout=1200
|
||||||
|
|||||||
Reference in New Issue
Block a user