Commit 0e2b4584 authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski

selftests: mptcp: join: simplify checksum_tests

The four checksum tests are similar, only one line is different. So
a for-loop can be used to simplify these tests.
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240902-net-next-mptcp-mib-mpjtx-misc-v1-10-d3e0f3773b90@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 08eecd7e
...@@ -363,7 +363,7 @@ reset_with_checksum() ...@@ -363,7 +363,7 @@ reset_with_checksum()
local ns1_enable=$1 local ns1_enable=$1
local ns2_enable=$2 local ns2_enable=$2
reset "checksum test ${1} ${2}" || return 1 reset "checksum test ${ns1_enable} ${ns2_enable}" || return 1
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
...@@ -3032,37 +3032,16 @@ syncookies_tests() ...@@ -3032,37 +3032,16 @@ syncookies_tests()
checksum_tests() checksum_tests()
{ {
# checksum test 0 0 local checksum_enable
if reset_with_checksum 0 0; then for checksum_enable in "0 0" "1 1" "0 1" "1 0"; do
pm_nl_set_limits $ns1 0 1 # checksum test 0 0, 1 1, 0 1, 1 0
pm_nl_set_limits $ns2 0 1 if reset_with_checksum ${checksum_enable}; then
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 1 1
if reset_with_checksum 1 1; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 0 1
if reset_with_checksum 0 1; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0
fi
# checksum test 1 0
if reset_with_checksum 1 0; then
pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1 pm_nl_set_limits $ns2 0 1
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
fi fi
done
} }
deny_join_id0_tests() deny_join_id0_tests()
......
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