Skip to content

Commit

Permalink
selftests: mptcp: join: simplify deny_join_id0_tests
Browse files Browse the repository at this point in the history
The six join id0 tests can be divided into three groups in sequence,
with two tests in each one. Both tests in one group are similar, only
different namespaces used. So a for-loop can be used to simplify these
tests.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
  • Loading branch information
geliangtang authored and Geliang Tang committed May 7, 2024
1 parent 0c9101f commit cccbfff
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2896,27 +2896,20 @@ deny_join_id0_tests()
chk_join_nr 0 0 0
fi

# signal address allow join id0 ns1
# signal address allow join id0 ns1/2
# ADD_ADDRs are not affected by allow_join_id0 value.
if reset_with_allow_join_id0 "signal address allow join id0 ns1" 1 0; then
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1
chk_add_nr 1 1
fi

# signal address allow join id0 ns2
# ADD_ADDRs are not affected by allow_join_id0 value.
if reset_with_allow_join_id0 "signal address allow join id0 ns2" 0 1; then
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1
chk_add_nr 1 1
fi
local ns enable="1 0"
for ns in "ns1" "ns2"; do
[ $ns == "ns2" ] && enable="0 1"
if reset_with_allow_join_id0 "signal address allow join id0 $ns" $enable; then
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1
chk_add_nr 1 1
fi
done

# subflow and address allow join id0 ns1
if reset_with_allow_join_id0 "subflow and address allow join id0 1" 1 0; then
Expand Down

0 comments on commit cccbfff

Please sign in to comment.