forked from luck/tmp_suning_uos_patched
selftests: mptcp: add test cases for mptcp join tests with syn cookies
Also add test cases with MP_JOIN when tcp_syncookies sysctl is 2 (i.e., syncookies are always-on). While at it, also print the test number and add the test number to the pcap files that can be generated optionally. This makes it easier to match the pcap to the test case. Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fed61c4b58
commit
00587187ad
|
@ -72,6 +72,15 @@ reset()
|
|||
init
|
||||
}
|
||||
|
||||
reset_with_cookies()
|
||||
{
|
||||
reset
|
||||
|
||||
for netns in "$ns1" "$ns2";do
|
||||
ip netns exec $netns sysctl -q net.ipv4.tcp_syncookies=2
|
||||
done
|
||||
}
|
||||
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "-c" ]; then
|
||||
capture=1
|
||||
|
@ -138,7 +147,7 @@ do_transfer()
|
|||
capuser="-Z $SUDO_USER"
|
||||
fi
|
||||
|
||||
capfile="mp_join-${listener_ns}.pcap"
|
||||
capfile=$(printf "mp_join-%02u-%s.pcap" "$TEST_COUNT" "${listener_ns}")
|
||||
|
||||
echo "Capturing traffic for test $TEST_COUNT into $capfile"
|
||||
ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
|
||||
|
@ -227,7 +236,7 @@ chk_join_nr()
|
|||
local count
|
||||
local dump_stats
|
||||
|
||||
printf "%-36s %s" "$msg" "syn"
|
||||
printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn"
|
||||
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'`
|
||||
[ -z "$count" ] && count=0
|
||||
if [ "$count" != "$syn_nr" ]; then
|
||||
|
@ -354,4 +363,57 @@ ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow
|
|||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "multiple subflows and signal" 3 3 3
|
||||
|
||||
# single subflow, syncookies
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 0 1
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "single subflow with syn cookies" 1 1 1
|
||||
|
||||
# multiple subflows with syn cookies
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 2
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 0 2
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "multiple subflows with syn cookies" 2 2 2
|
||||
|
||||
# multiple subflows limited by server
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 0 2
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "subflows limited by server w cookies" 2 2 1
|
||||
|
||||
# test signal address with cookies
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 1 1
|
||||
ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "signal address with syn cookies" 1 1 1
|
||||
|
||||
# test cookie with subflow and signal
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 2
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 1 2
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "subflow and signal w cookies" 2 2 2
|
||||
|
||||
# accept and use add_addr with additional subflows
|
||||
reset_with_cookies
|
||||
ip netns exec $ns1 ./pm_nl_ctl limits 0 3
|
||||
ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
|
||||
ip netns exec $ns2 ./pm_nl_ctl limits 1 3
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
|
||||
ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
chk_join_nr "subflows and signal w. cookies" 3 3 3
|
||||
|
||||
exit $ret
|
||||
|
|
Loading…
Reference in New Issue
Block a user