selftests: mptcp: join: change capture/checksum as bool

commit 8c6f6b4bb5 upstream.

To maintain consistency with other scripts, this patch changes vars
'capture' and 'checksum' as bool vars in mptcp_join.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-7-b6c8a10396bd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 5afca7e996 ("selftests: mptcp: join: test for prohibited MPC to port-based endp")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Geliang Tang 2024-10-18 17:57:37 +02:00 committed by Greg Kroah-Hartman
parent 229dfdc36f
commit d46b96f0a4

View File

@ -30,11 +30,11 @@ iptables="iptables"
ip6tables="ip6tables" ip6tables="ip6tables"
timeout_poll=30 timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1)) timeout_test=$((timeout_poll * 2 + 1))
capture=0 capture=false
checksum=0 checksum=false
ip_mptcp=0 ip_mptcp=0
check_invert=0 check_invert=0
validate_checksum=0 validate_checksum=false
init=0 init=0
evts_ns1="" evts_ns1=""
evts_ns2="" evts_ns2=""
@ -99,7 +99,7 @@ init_partial()
ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0
ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0
if [ $checksum -eq 1 ]; then if $checksum; then
ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1 ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1
fi fi
done done
@ -386,7 +386,7 @@ reset_with_checksum()
ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable
ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable
validate_checksum=1 validate_checksum=true
} }
reset_with_allow_join_id0() reset_with_allow_join_id0()
@ -419,7 +419,7 @@ reset_with_allow_join_id0()
setup_fail_rules() setup_fail_rules()
{ {
check_invert=1 check_invert=1
validate_checksum=1 validate_checksum=true
local i="$1" local i="$1"
local ip="${2:-4}" local ip="${2:-4}"
local tables local tables
@ -1024,7 +1024,7 @@ do_transfer()
:> "$sout" :> "$sout"
:> "$capout" :> "$capout"
if [ $capture -eq 1 ]; then if $capture; then
local capuser local capuser
if [ -z $SUDO_USER ] ; then if [ -z $SUDO_USER ] ; then
capuser="" capuser=""
@ -1125,7 +1125,7 @@ do_transfer()
wait $spid wait $spid
local rets=$? local rets=$?
if [ $capture -eq 1 ]; then if $capture; then
sleep 1 sleep 1
kill $cappid kill $cappid
fi fi
@ -1514,7 +1514,7 @@ chk_join_nr()
else else
print_ok print_ok
fi fi
if [ $validate_checksum -eq 1 ]; then if $validate_checksum; then
chk_csum_nr $csum_ns1 $csum_ns2 chk_csum_nr $csum_ns1 $csum_ns2
chk_fail_nr $fail_nr $fail_nr chk_fail_nr $fail_nr $fail_nr
chk_rst_nr $rst_nr $rst_nr chk_rst_nr $rst_nr $rst_nr
@ -3960,10 +3960,10 @@ while getopts "${all_tests_args}cCih" opt; do
tests+=("${all_tests[${opt}]}") tests+=("${all_tests[${opt}]}")
;; ;;
c) c)
capture=1 capture=true
;; ;;
C) C)
checksum=1 checksum=true
;; ;;
i) i)
ip_mptcp=1 ip_mptcp=1