Lines Matching +full:2 +full:- +full:1

2 # SPDX-License-Identifier: GPL-2.0
32 timeout_test=$((timeout_poll * 2 + 1))
44 last_test_ignored=1
46 declare -A all_tests
47 declare -a only_tests_ids
48 declare -a only_tests_names
49 declare -A failed_tests
90 21 0 1 48,
102 ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
104 ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1
118 for i in $(seq 1 4); do
120 ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i
121 ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad
122 ip -net "$ns1" link set ns1eth$i up
124 ip -net "$ns2" addr add 10.0.$i.2/24 dev ns2eth$i
125 ip -net "$ns2" addr add dead:beef:$i::2/64 dev ns2eth$i nodad
126 ip -net "$ns2" link set ns2eth$i up
129 ip -net "$ns2" route add default via 10.0.$i.1 dev ns2eth$i metric 10$i
130 ip -net "$ns2" route add default via dead:beef:$i::1 dev ns2eth$i metric 10$i
137 for i in $(seq 1 4); do
138 tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1ms
139 tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1ms
145 rm -f "$capout"
151 init=1
168 make_file "$cin" "client" 1 >/dev/null
169 make_file "$sin" "server" 1 >/dev/null
174 rm -f "$cin" "$cout" "$sinfail"
175 rm -f "$sin" "$sout" "$cinsent" "$cinfail"
176 rm -f "$tmpfile"
177 rm -rf $evts_ns1 $evts_ns2
178 rm -f "$err"
184 printf "%-${nr_blank}s%-36s" " " "${*}"
190 [ -z "${1}" ] && return
210 # $1: check name; $2: rc
213 local check="${1}"
214 local rc=${2}
226 # [ $1: fail msg ]
229 local msg="${1:-"Feature not supported"}"
236 last_test_skipped=1
244 return 1
250 if [ "${#only_tests_ids[@]}" -eq 0 ] && [ "${#only_tests_names[@]}" -eq 0 ]; then
251 return 1
256 if [ "$((MPTCP_LIB_TEST_COUNTER+1))" -eq "${i}" ]; then
257 return 1
262 return 1
271 if [ ${last_test_failed} -eq 1 ]; then
273 elif [ ${last_test_skipped} -eq 1 ]; then
275 elif [ ${last_test_ignored} -ne 1 ]; then
284 # $1: test name
289 TEST_NAME="${1}"
294 MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
295 last_test_ignored=1
296 return 1
301 if [ "${init}" != "1" ]; then
312 # $1: test name ; $2: counter to check
315 reset "${1}" || return 1
317 local counter="${2}"
319 if ! nstat -asz "${counter}" | grep -wq "${counter}"; then
321 return 1
325 # $1: test name
328 reset "${1}" || return 1
332 ip netns exec $netns sysctl -q net.ipv4.tcp_syncookies=2
336 # $1: test name
339 local ip="${2:-4}"
342 reset "${1}" || return 1
345 if [ $ip -eq 6 ]; then
349 ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
351 if ! ip netns exec $ns2 $tables -A OUTPUT -p tcp \
352 -m tcp --tcp-option 30 \
353 -m bpf --bytecode \
355 -j DROP; then
357 return 1
361 # $1: test name
364 local ns1_enable=$1
365 local ns2_enable=$2
367 reset "checksum test ${ns1_enable} ${ns2_enable}" || return 1
369 ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=$ns1_enable
370 ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=$ns2_enable
377 local ns1_enable=$2
380 reset "${1}" || return 1
382 ip netns exec $ns1 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns1_enable
383 ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable
388 # This rule inverts a 8-bit word at byte offset 148 for the 2nd TCP ACK packets
404 check_invert=1
406 local i="$1"
407 local ip="${2:-4}"
411 if [ $ip -eq 6 ]; then
416 -t mangle \
417 -A OUTPUT \
418 -o ns2eth$i \
419 -p tcp \
420 -m length --length 150:9999 \
421 -m statistic --mode nth --packet 1 --every 99999 \
422 -j MARK --set-mark 42 || return ${KSFT_SKIP}
424 tc -n $ns2 qdisc add dev ns2eth$i clsact || return ${KSFT_SKIP}
425 tc -n $ns2 filter add dev ns2eth$i egress \
435 reset_check_counter "${1}" "MPTcpExtInfiniteMapTx" || return 1
438 ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=1
439 ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=1
444 if [ ${rc} -eq ${KSFT_SKIP} ]; then
446 return 1
458 reset "${1}" || return 1
465 reset "${1}" || return 1
468 local ns="${!1}"
469 local src="${2}"
471 local chain="${4:-INPUT}"
474 -A "${chain}" \
475 -s "${src}" \
476 -p tcp \
477 -j "${target}"; then
479 return 1
483 # $1: err msg
490 if [ ${#} -gt 0 ]; then
495 if [ ${last_test_failed} -eq 0 ]; then
498 last_test_failed=1
508 done | sort -n
513 local in=$1
514 local out=$2
520 if [ -n "$bytes" ]; then
523 out_size=$(wc -c $out | awk '{print $1}')
524 if [ $out_size -ne $bytes ]; then
526 return 1
529 # note: BusyBox's "cmp" command doesn't support --bytes
531 head --bytes="$bytes" "$in" > "$tmpfile"
533 head --bytes="$bytes" "$out" > "$tmpfile"
537 cmp -l "$in" "$out" | while read -r i a b; do
539 if [ $check_invert -eq 0 ] || [ $sum -ne $((0xff)) ]; then
544 return 1
555 local listener_ns="$1"
556 local connector_ns="$2"
559 if ! ip netns exec ${connector_ns} ping -q -c 1 $connect_addr >/dev/null; then
560 fail_test "$listener_ns -> $connect_addr connectivity"
566 local ns="$1"
568 if [ -z "$FAILING_LINKS" ]; then
570 FAILING_LINKS=$((l+1))
576 ip -net "$ns" link set "$veth" down
582 mptcp_lib_get_counter "${1}" "MPTcpExtRmAddr"
585 # $1: ns, $2: old rm_addr counter in $ns
588 local ns="${1}"
589 local old_cnt="${2}"
602 mptcp_lib_get_counter "${1}" "MPTcpExtRmSubflow"
605 # $1: ns, $2: old rm_sf counter in $ns
608 local ns="${1}"
609 local old_cnt="${2}"
622 local ns="${1}"
675 local msg="$1"
676 local ns=$2
683 while [ -n "$1" ]; do
684 case "${1}" in
686 eval "${1}"="${2}"
696 if [ -z "${id}" ]; then
697 fail_test "bad test - missing endpoint id"
708 local listener_ns="$1"
709 local connector_ns="$2"
712 local addr_nr_ns1=${addr_nr_ns1:-0}
713 local addr_nr_ns2=${addr_nr_ns2:-0}
714 local sflags=${sflags:-""}
715 local fullmesh=${fullmesh:-""}
718 if [ -n "${fullmesh}" ]; then
726 sleep 1
729 if [ $addr_nr_ns1 -gt 0 ]; then
730 local counter=2
733 while [ $add_nr_ns1 -gt 0 ]; do
736 addr="dead:beef:$counter::1"
738 addr="10.0.$counter.1"
741 counter=$((counter + 1))
742 add_nr_ns1=$((add_nr_ns1 - 1))
743 id=$((id + 1))
745 elif [ $addr_nr_ns1 -lt 0 ]; then
746 local rm_nr_ns1=$((-addr_nr_ns1))
747 if [ $rm_nr_ns1 -lt 8 ]; then
750 pm_nl_show_endpoints ${listener_ns} | while read -r line; do
758 if [ $counter -eq $rm_nr_ns1 ]; then
761 id=${arr[$nr+1]}
765 counter=$((counter + 1))
767 nr=$((nr + 1))
770 elif [ $rm_nr_ns1 -eq 8 ]; then
772 elif [ $rm_nr_ns1 -eq 9 ]; then
779 [ $addr_nr_ns1 -gt 0 ] && [ $addr_nr_ns2 -lt 0 ] && sleep 1
781 if [ $addr_nr_ns2 -gt 0 ]; then
785 while [ $add_nr_ns2 -gt 0 ]; do
788 addr="dead:beef:$counter::2"
790 addr="10.0.$counter.2"
793 counter=$((counter + 1))
794 add_nr_ns2=$((add_nr_ns2 - 1))
795 id=$((id + 1))
797 elif [ $addr_nr_ns2 -lt 0 ]; then
798 local rm_nr_ns2=$((-addr_nr_ns2))
799 if [ $rm_nr_ns2 -lt 8 ]; then
802 pm_nl_show_endpoints ${connector_ns} | while read -r line; do
810 if [ $counter -eq $rm_nr_ns2 ]; then
816 id=${arr[$nr+1]}
820 counter=$((counter + 1))
822 nr=$((nr + 1))
825 elif [ $rm_nr_ns2 -eq 8 ]; then
827 elif [ $rm_nr_ns2 -eq 9 ]; then
830 addr="dead:beef:1::2"
838 if [ -n "${sflags}" ]; then
839 sleep 1
844 pm_nl_show_endpoints $netns | while read -r line; do
853 id=${arr[$nr+1]}
855 nr=$((nr + 1))
865 local ns=$1
866 local cestab=$2
871 if [ -z "$count" ]; then
880 # $1 namespace 1, $2 namespace 2
883 if [ -n "${cestab_ns1}" ]; then
884 chk_cestab_nr ${1} ${cestab_ns1}
886 if [ -n "${cestab_ns2}" ]; then
887 chk_cestab_nr ${2} ${cestab_ns2}
893 local ns="$1"
899 if [ -z $SUDO_USER ]; then
902 capuser="-Z $SUDO_USER"
905 capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "$ns")
908 ip netns exec "$ns" tcpdump -i any -s 65535 -B 32768 $capuser -w "$capfile" > "$capout" 2>&1 &
911 sleep 1
918 sleep 1
926 echo "$((10000 + MPTCP_LIB_TEST_COUNTER - 1))"
931 local listener_ns="$1"
932 local connector_ns="$2"
938 local FAILING_LINKS=${FAILING_LINKS:-""}
939 local fastclose=${fastclose:-""}
940 local speed=${speed:-"fast"}
949 nstat -n
951 nstat -n
955 extra_args="-j"
957 extra_args="-r 50"
958 elif [ $speed -gt 0 ]; then
959 extra_args="-r ${speed}"
965 if [ -n "${fastclose}" ]; then
966 if [ ${test_linkfail} -le 1 ]; then
968 return 1
976 extra_cl_args="-f ${test_linkfail}"
977 extra_srv_args="-f -1"
979 extra_srv_args="-f ${test_linkfail}"
980 extra_cl_args="-f -1"
983 return 1
988 if [ "$test_linkfail" -gt 1 ];then
991 ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
996 ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
1004 if [ "$test_linkfail" -eq 0 ];then
1007 ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
1009 elif [ "$test_linkfail" -eq 1 ] || [ "$test_linkfail" -eq 2 ];then
1010 ( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \
1014 ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
1020 ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
1040 if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
1042 echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2
1043 ip netns exec ${listener_ns} ss -Menita 1>&2 -o "sport = :$port"
1045 echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2
1046 ip netns exec ${connector_ns} ss -Menita 1>&2 -o "dport = :$port"
1049 return 1
1052 if [ "$test_linkfail" -gt 1 ];then
1058 if [ "$test_linkfail" -eq 0 ];then
1065 [ $retc -eq 0 ] && [ $rets -eq 0 ]
1070 local name=$1
1071 local who=$2
1081 local listener_ns="$1"
1082 local connector_ns="$2"
1086 local test_linkfail=${test_linkfail:-0}
1088 # The values above 2 are reused to make test files
1090 if [ "$test_linkfail" -gt 2 ]; then
1093 if [ -z "$cinfail" ]; then
1099 elif [ "$test_linkfail" -ne 0 ] && [ -z "$cinfail" ]; then
1103 size=$((RANDOM%2))
1104 size=$((size+1))
1112 if [ "$test_linkfail" -gt 2 ]; then
1115 if [ -z "$sinfail" ]; then
1119 elif [ "$test_linkfail" -eq 2 ] && [ -z "$sinfail" ]; then
1121 size=$((size+1))
1134 ip netns exec $ns1 nstat -as | grep Tcp
1136 ip netns exec $ns2 nstat -as | grep Tcp
1141 local csum_ns1=${1:-0}
1142 local csum_ns2=${2:-0}
1149 allow_multi_errors_ns1=1
1150 csum_ns1=${csum_ns1:1}
1153 allow_multi_errors_ns2=1
1154 csum_ns2=${csum_ns2:1}
1159 if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then
1162 if [ -z "$count" ]; then
1164 elif { [ "$count" != $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 0 ]; } ||
1165 { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; then
1173 if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then
1176 if [ -z "$count" ]; then
1178 elif { [ "$count" != $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 0 ]; } ||
1179 { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; then
1190 local fail_tx=$1
1191 local fail_rx=$2
1192 local ns_invert=${3:-""}
1209 if [[ "${fail_tx}" = "-"* ]]; then
1210 allow_tx_lost=1
1211 fail_tx=${fail_tx:1}
1213 if [[ "${fail_rx}" = "-"* ]]; then
1214 allow_rx_lost=1
1215 fail_rx=${fail_rx:1}
1220 if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then
1223 if [ -z "$count" ]; then
1225 elif { [ "$count" != "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } ||
1226 { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then
1234 if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then
1237 if [ -z "$count" ]; then
1239 elif { [ "$count" != "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } ||
1240 { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then
1251 local fclose_tx=$1
1252 local fclose_rx=$2
1269 if [ -z "$count" ]; then
1279 if [ -z "$count" ]; then
1290 local rst_tx=$1
1291 local rst_rx=$2
1292 local ns_invert=${3:-""}
1308 if [ -z "$count" ]; then
1311 elif { [ $rst_tx -ne 0 ] && [ $count -lt $rst_tx ]; } ||
1312 { [ $rst_tx -eq 0 ] && [ $count -ne 0 ]; }; then
1320 if [ -z "$count" ]; then
1323 elif { [ $rst_rx -ne 0 ] && [ $count -lt $rst_rx ]; } ||
1324 { [ $rst_rx -eq 0 ] && [ $count -ne 0 ]; }; then
1333 local infi_tx=$1
1334 local infi_rx=$2
1339 if [ -z "$count" ]; then
1349 if [ -z "$count" ]; then
1360 local syn_tx=${join_syn_tx:-0}
1361 local create=${join_create_err:-0}
1362 local bind=${join_bind_err:-0}
1363 local connect=${join_connect_err:-0}
1368 if [ -z "$count" ]; then
1377 if [ -z "$count" ]; then
1386 if [ -z "$count" ]; then
1395 if [ -z "$count" ]; then
1408 local syn_nr=$1
1409 local syn_ack_nr=$2
1411 local csum_ns1=${join_csum_ns1:-0}
1412 local csum_ns2=${join_csum_ns2:-0}
1413 local fail_nr=${join_fail_nr:-0}
1414 local rst_nr=${join_rst_nr:-0}
1415 local infi_nr=${join_infi_nr:-0}
1416 local corrupted_pkts=${join_corrupted_pkts:-0}
1421 if [ "${corrupted_pkts}" -gt 0 ]; then
1426 if [ -z "$count" ]; then
1434 with_cookie=$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies)
1436 if [ -z "$count" ]; then
1442 if [ "$with_cookie" != 2 ] || [ "$count" -le "$syn_ack_nr" ] || [ "$count" -gt "$syn_nr" ]; then
1450 if [ -z "$count" ]; then
1460 join_syn_tx="${join_syn_tx:-${syn_nr}}" \
1473 # - as these tests do - we can have a quite high number of
1475 # sleep duration/ MPTCP-level RTX interval.
1478 local ns=$1
1479 local stale_min=$2
1490 if [ -z "$stale_nr" ] || [ -z "$recover_nr" ]; then
1492 elif [ $stale_nr -lt $stale_min ] ||
1493 { [ $stale_max -gt 0 ] && [ $stale_nr -gt $stale_max ]; } ||
1494 [ $((stale_nr - recover_nr)) -ne $stale_delta ]; then
1497 " stale-recover delta $stale_delta"
1498 dump_stats=1
1503 if [ "${dump_stats}" = 1 ]; then
1505 ip netns exec $ns ip -s link show
1506 ip netns exec $ns nstat -as | grep MPTcp
1512 local add_nr=$1
1513 local echo_nr=$2
1514 local port_nr=${3:-0}
1515 local ns_invert=${4:-""}
1535 timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout)
1539 if [ -z "$count" ]; then
1543 elif [ "$count" != "$add_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -lt "$add_nr" ]; }; then
1551 if [ -z "$count" ]; then
1559 if [ $port_nr -gt 0 ]; then
1562 if [ -z "$count" ]; then
1565 fail_test "got $count ADD_ADDR[s] with a port-number expected $port_nr"
1572 if [ -z "$count" ]; then
1576 port-number expected $syn_nr"
1583 if [ -z "$count" ]; then
1587 port-number expected $syn_ack_nr"
1594 if [ -z "$count" ]; then
1598 port-number expected $ack_nr"
1605 if [ -z "$count" ]; then
1609 port-number expected $mis_syn_nr"
1616 if [ -z "$count" ]; then
1620 port-number expected $mis_ack_nr"
1629 local add_tx_nr=$1
1630 local echo_tx_nr=$2
1634 timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout)
1638 if [ -z "$count" ]; then
1642 …elif [ "$count" != "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -lt "$add_tx_nr" ]; }; t…
1650 if [ -z "$count" ]; then
1661 local rm_addr_nr=$1
1662 local rm_subflow_nr=$2
1672 shift 2
1673 while [ -n "$1" ]; do
1674 [ "$1" = "invert" ] && invert=true
1675 [ "$1" = "simult" ] && simult=true
1688 if [ -z "$count" ]; then
1698 if [ -z "$count" ]; then
1700 elif [ -n "$simult" ]; then
1709 suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
1712 if [ $count -ge "$rm_subflow_nr" ] && \
1713 [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
1716 fail_test "got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr:$((rm_subflow_nr*2))]"
1729 local rm_addr_tx_nr=$1
1733 if [ -z "$count" ]; then
1744 local mp_prio_nr_tx=$1
1745 local mp_prio_nr_rx=$2
1752 if [ -z "$count" ]; then
1762 if [ -z "$count" ]; then
1772 if [ -z "$count" ]; then
1782 if [ -z "$count" ]; then
1793 local msg="$1"
1794 local subflow_nr=$2
1801 cnt1=$(ss -N $ns1 -tOni | grep -c token)
1802 cnt2=$(ss -N $ns2 -tOni | grep -c token)
1805 dump_stats=1
1810 if [ "${dump_stats}" = 1 ]; then
1811 ss -N $ns1 -tOni
1812 ss -N $ns1 -tOni | grep token
1813 ip -n $ns1 mptcp endpoint
1819 local info1=$1
1820 local exp1=$2
1829 cnt1=$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1")
1830 cnt2=$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2")
1832 [ -z "$cnt1" ] && cnt1=0
1833 [ -z "$cnt2" ] && cnt2=0
1837 dump_stats=1
1842 if [ "$dump_stats" = 1 ]; then
1843 ss -N $ns1 -inmHM
1844 ss -N $ns2 -inmHM
1848 # $1: subflows in ns1 ; $2: subflows in ns2
1858 if [ -n "$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value $info $info)" ]; then
1859 chk_mptcp_info $info $1 $info $2
1863 print_check "$info $1:$2"
1866 cnt1=$(ss -N $ns1 -ti state established state syn-sent state syn-recv |
1867 grep -c tcp-ulp-mptcp)
1868 cnt2=$(ss -N $ns2 -ti state established state syn-sent state syn-recv |
1869 grep -c tcp-ulp-mptcp)
1871 if [ "$1" != "$cnt1" ] || [ "$2" != "$cnt2" ]; then
1872 fail_test "got subflows $cnt1:$cnt2 expected $1:$2"
1873 dump_stats=1
1878 if [ "$dump_stats" = 1 ]; then
1879 ss -N $ns1 -ti
1880 ss -N $ns2 -ti
1886 local ns=$1
1887 local link=$2
1893 tx_total=$(stat --format=%s $out)
1898 if [ $tx_rate -lt $((expected_rate - tolerance)) ] || \
1899 [ $tx_rate -gt $((expected_rate + tolerance)) ]; then
1910 local ns=$1
1912 while [ $time -lt $timeout_ms ]; do
1917 [ "$cnt" = 1 ] && return 1
1921 return 1
1926 local ns=$1
1928 ip netns exec $ns sysctl -q net.mptcp.pm_type=1
1950 pm_nl_set_limits $ns2 0 1
1953 chk_join_nr 1 1 0
1958 pm_nl_set_limits $ns1 0 1
1959 pm_nl_set_limits $ns2 0 1
1962 chk_join_nr 1 1 1
1967 pm_nl_set_limits $ns1 0 2
1968 pm_nl_set_limits $ns2 0 2
1972 chk_join_nr 2 2 2
1977 pm_nl_set_limits $ns1 0 1
1978 pm_nl_set_limits $ns2 0 2
1982 chk_join_nr 2 2 1
1987 pm_nl_set_limits $ns1 0 1
1988 pm_nl_set_limits $ns2 0 1
1991 chk_join_nr 1 1 1
2000 pm_nl_set_limits $ns1 0 1
2001 pm_nl_set_limits $ns2 0 1
2006 join_bind_err=1 \
2013 pm_nl_set_limits $ns1 0 2
2014 pm_nl_set_limits $ns2 0 2
2019 join_syn_tx=2 \
2020 chk_join_nr 1 1 1
2026 pm_nl_set_limits $ns1 0 2
2027 pm_nl_set_limits $ns2 0 2
2032 join_syn_tx=2 \
2033 chk_join_nr 1 1 1
2041 pm_nl_set_limits $ns1 0 1
2042 pm_nl_set_limits $ns2 0 1
2054 join_syn_tx=2 \
2055 chk_join_nr 1 1 1
2066 chk_add_tx_nr 1 1
2067 chk_add_nr 1 1
2072 pm_nl_set_limits $ns1 0 1
2073 pm_nl_set_limits $ns2 1 1
2076 chk_join_nr 1 1 1
2077 chk_add_nr 1 1
2086 pm_nl_set_limits $ns1 0 2
2087 pm_nl_set_limits $ns2 1 2
2090 chk_join_nr 2 2 2
2091 chk_add_nr 1 1
2098 pm_nl_set_limits $ns1 0 2
2099 pm_nl_set_limits $ns2 0 2
2102 chk_join_nr 1 1 1
2103 chk_add_nr 1 1 0 invert # only initiated by ns2
2113 pm_nl_set_limits $ns2 1 3
2118 chk_add_nr 1 1
2142 chk_join_nr 1 1 1
2160 ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
2167 chk_join_nr 3 3 2
2186 # active backup and link switch-over.
2191 pm_nl_set_limits $ns2 1 3
2194 test_linkfail=1 \
2197 chk_add_nr 1 1
2198 chk_stale_nr $ns2 1 5 1
2207 pm_nl_set_limits $ns2 1 3
2210 test_linkfail=2 \
2213 chk_add_nr 1 1
2214 chk_stale_nr $ns2 1 -1 1
2217 # 2 subflows plus 1 backup subflow with a lossy link, backup
2221 pm_nl_set_limits $ns1 0 2
2223 pm_nl_set_limits $ns2 1 2
2225 FAILING_LINKS="1" test_linkfail=1 \
2227 chk_join_nr 2 2 2
2228 chk_add_nr 1 1
2232 # 2 lossy links after half transfer, backup will get half of
2236 pm_nl_set_limits $ns1 0 2
2238 pm_nl_set_limits $ns2 1 2
2240 FAILING_LINKS="1 2" test_linkfail=1 \
2242 chk_join_nr 2 2 2
2243 chk_add_nr 1 1
2244 chk_stale_nr $ns2 2 4 2
2252 pm_nl_set_limits $ns1 0 2
2254 pm_nl_set_limits $ns2 1 3
2256 FAILING_LINKS="1 2" test_linkfail=2 \
2258 chk_join_nr 2 2 2
2259 chk_add_nr 1 1
2260 chk_stale_nr $ns2 1 -1 2
2269 pm_nl_set_limits $ns1 0 1
2270 pm_nl_set_limits $ns2 1 1
2274 chk_join_nr 1 1 1
2281 pm_nl_set_limits $ns1 0 1
2282 pm_nl_set_limits $ns2 1 1
2283 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2285 run_tests $ns1 $ns2 dead:beef:1::1
2286 chk_join_nr 1 1 1
2292 pm_nl_set_limits $ns1 2 2
2295 pm_nl_set_limits $ns2 2 2
2298 chk_join_nr 2 2 2
2304 pm_nl_set_limits $ns1 2 2
2307 pm_nl_set_limits $ns2 2 2
2310 join_syn_tx=2 \
2311 chk_join_nr 1 1 1
2320 pm_nl_set_limits $ns1 0 1
2321 pm_nl_set_limits $ns2 0 1
2323 addr_nr_ns2=-1 speed=slow \
2325 chk_join_nr 1 1 1
2326 chk_rm_tx_nr 1
2327 chk_rm_nr 1 1
2333 pm_nl_set_limits $ns1 0 2
2334 pm_nl_set_limits $ns2 0 2
2337 addr_nr_ns2=-2 speed=slow \
2339 chk_join_nr 2 2 2
2340 chk_rm_nr 2 2
2346 pm_nl_set_limits $ns1 0 1
2348 pm_nl_set_limits $ns2 1 1
2349 addr_nr_ns1=-1 speed=slow \
2351 chk_join_nr 1 1 1
2352 chk_add_nr 1 1
2353 chk_rm_nr 1 1 invert
2359 pm_nl_set_limits $ns1 0 2
2361 pm_nl_set_limits $ns2 1 2
2363 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2365 chk_join_nr 2 2 2
2366 chk_add_nr 1 1
2367 chk_rm_nr 1 1
2375 pm_nl_set_limits $ns2 1 3
2378 addr_nr_ns1=-1 addr_nr_ns2=-2 speed=10 \
2381 chk_add_nr 1 1
2382 chk_rm_nr 2 2
2393 addr_nr_ns1=-3 speed=10 \
2408 pm_nl_set_limits $ns2 2 2
2409 addr_nr_ns1=-3 speed=10 \
2411 join_syn_tx=2 join_connect_err=1 \
2412 chk_join_nr 1 1 1
2414 chk_rm_nr 3 1 invert
2422 pm_nl_set_limits $ns2 1 3
2425 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2428 chk_add_nr 1 1
2429 chk_rm_nr 1 3 invert simult
2440 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2460 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2475 addr_nr_ns1=-8 speed=slow \
2478 chk_join_nr 1 1 1
2480 chk_rm_nr 3 1 invert
2486 pm_nl_set_limits $ns1 0 1
2487 pm_nl_set_limits $ns2 0 1
2489 addr_nr_ns2=-9 speed=slow \
2491 chk_join_nr 1 1 1
2492 chk_rm_nr 1 1
2498 pm_nl_set_limits $ns1 0 1
2500 pm_nl_set_limits $ns2 1 1
2501 addr_nr_ns1=-9 speed=slow \
2503 chk_join_nr 1 1 1
2504 chk_add_nr 1 1
2505 chk_rm_nr 1 1 invert
2514 pm_nl_set_limits $ns1 0 1
2515 pm_nl_set_limits $ns2 0 1
2516 addr_nr_ns2=1 speed=slow cestab_ns2=1 \
2518 chk_join_nr 1 1 1
2524 pm_nl_set_limits $ns1 0 1
2525 pm_nl_set_limits $ns2 1 1
2526 addr_nr_ns1=1 speed=slow cestab_ns1=1 \
2528 chk_join_nr 1 1 1
2529 chk_add_nr 1 1
2535 pm_nl_set_limits $ns1 0 2
2536 pm_nl_set_limits $ns2 0 2
2537 addr_nr_ns2=2 speed=slow cestab_ns2=1 \
2539 chk_join_nr 2 2 2
2545 pm_nl_set_limits $ns1 0 2
2546 pm_nl_set_limits $ns2 0 2
2547 addr_nr_ns2=2 speed=slow cestab_ns2=1 \
2548 run_tests $ns1 $ns2 dead:beef:1::1
2549 chk_join_nr 2 2 2
2555 pm_nl_set_limits $ns1 0 2
2556 pm_nl_set_limits $ns2 2 2
2557 addr_nr_ns1=2 speed=slow cestab_ns1=1 \
2558 run_tests $ns1 $ns2 dead:beef:1::1
2559 chk_join_nr 2 2 2
2560 chk_add_nr 2 2
2569 pm_nl_set_limits $ns1 0 1
2570 pm_nl_set_limits $ns2 0 1
2571 pm_nl_add_endpoint $ns2 dead:beef:3::2 dev ns2eth3 flags subflow
2573 run_tests $ns1 $ns2 dead:beef:1::1
2574 chk_join_nr 1 1 1
2579 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2581 run_tests $ns1 $ns2 dead:beef:1::1
2583 chk_add_nr 1 1
2588 pm_nl_set_limits $ns1 0 1
2589 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2590 pm_nl_set_limits $ns2 1 1
2592 run_tests $ns1 $ns2 dead:beef:1::1
2593 chk_join_nr 1 1 1
2594 chk_add_nr 1 1
2599 pm_nl_set_limits $ns1 0 1
2600 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2601 pm_nl_set_limits $ns2 1 1
2602 addr_nr_ns1=-1 speed=slow \
2603 run_tests $ns1 $ns2 dead:beef:1::1
2604 chk_join_nr 1 1 1
2605 chk_add_nr 1 1
2606 chk_rm_nr 1 1 invert
2611 pm_nl_set_limits $ns1 0 2
2612 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2613 pm_nl_set_limits $ns2 1 2
2614 pm_nl_add_endpoint $ns2 dead:beef:3::2 dev ns2eth3 flags subflow
2615 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2616 run_tests $ns1 $ns2 dead:beef:1::1
2617 chk_join_nr 2 2 2
2618 chk_add_nr 1 1
2619 chk_rm_nr 1 1
2625 # subflow IPv4-mapped to IPv4-mapped
2626 if reset "single subflow IPv4-mapped"; then
2627 pm_nl_set_limits $ns1 0 1
2628 pm_nl_set_limits $ns2 0 1
2631 chk_join_nr 1 1 1
2634 # signal address IPv4-mapped with IPv4-mapped sk
2635 if reset "signal address IPv4-mapped"; then
2636 pm_nl_set_limits $ns1 0 1
2637 pm_nl_set_limits $ns2 1 1
2640 chk_join_nr 1 1 1
2641 chk_add_nr 1 1
2644 # subflow v4-map-v6
2645 if reset "single subflow v4-map-v6"; then
2646 pm_nl_set_limits $ns1 0 1
2647 pm_nl_set_limits $ns2 0 1
2650 chk_join_nr 1 1 1
2653 # signal address v4-map-v6
2654 if reset "signal address v4-map-v6"; then
2655 pm_nl_set_limits $ns1 0 1
2656 pm_nl_set_limits $ns2 1 1
2659 chk_join_nr 1 1 1
2660 chk_add_nr 1 1
2663 # subflow v6-map-v4
2664 if reset "single subflow v6-map-v4"; then
2665 pm_nl_set_limits $ns1 0 1
2666 pm_nl_set_limits $ns2 0 1
2669 chk_join_nr 1 1 1
2672 # signal address v6-map-v4
2673 if reset "signal address v6-map-v4"; then
2674 pm_nl_set_limits $ns1 0 1
2675 pm_nl_set_limits $ns2 1 1
2678 chk_join_nr 1 1 1
2679 chk_add_nr 1 1
2683 if reset "no JOIN with diff families v4-v6"; then
2684 pm_nl_set_limits $ns1 0 1
2685 pm_nl_set_limits $ns2 0 1
2686 pm_nl_add_endpoint $ns2 dead:beef:2::2 flags subflow
2692 if reset "no JOIN with diff families v4-v6-2"; then
2693 pm_nl_set_limits $ns1 0 1
2694 pm_nl_set_limits $ns2 0 1
2695 pm_nl_add_endpoint $ns2 dead:beef:2::10.0.3.2 flags subflow
2701 if reset "no JOIN with diff families v6-v4"; then
2702 pm_nl_set_limits $ns1 0 1
2703 pm_nl_set_limits $ns2 0 1
2705 run_tests $ns1 $ns2 dead:beef:1::1
2714 pm_nl_set_limits $ns1 0 1
2715 pm_nl_set_limits $ns2 1 1
2716 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2725 pm_nl_set_limits $ns1 0 1
2726 pm_nl_set_limits $ns2 1 1
2729 run_tests $ns1 $ns2 dead:beef:2::1
2730 chk_join_nr 1 1 1
2734 if reset "simult IPv4 and IPv6 subflows, fullmesh 1x1" &&
2737 pm_nl_set_limits $ns2 1 4
2738 pm_nl_add_endpoint $ns2 dead:beef:2::2 flags subflow,fullmesh
2741 run_tests $ns1 $ns2 dead:beef:2::1
2742 chk_join_nr 1 1 1
2747 if reset "simult IPv4 and IPv6 subflows, fullmesh 2x2" &&
2750 pm_nl_set_limits $ns2 2 4
2752 pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
2753 fullmesh=1 speed=slow \
2754 run_tests $ns1 $ns2 dead:beef:1::1
2764 pm_nl_set_limits $ns1 0 1
2765 pm_nl_set_limits $ns2 0 1
2769 chk_join_nr 1 1 1
2770 chk_prio_nr 0 1 1 0
2776 pm_nl_set_limits $ns1 0 1
2778 pm_nl_set_limits $ns2 1 1
2781 chk_join_nr 1 1 1
2782 chk_add_nr 1 1
2783 chk_prio_nr 1 0 0 1
2789 pm_nl_set_limits $ns1 0 1
2791 pm_nl_set_limits $ns2 1 1
2794 chk_join_nr 1 1 1
2795 chk_add_nr 1 1
2796 chk_prio_nr 1 1 0 0
2802 pm_nl_set_limits $ns1 0 1
2804 pm_nl_set_limits $ns2 1 1
2807 chk_join_nr 1 1 1
2808 chk_add_nr 1 1
2809 chk_prio_nr 1 0 0 1
2818 chk_prio_nr 0 1 0 0
2823 pm_nl_set_limits $ns1 0 2
2824 pm_nl_set_limits $ns2 1 2
2828 # 10.0.2.2 (non-backup) -> 10.0.1.1 (backup)
2830 # 10.0.1.2 (backup) -> 10.0.2.1 (non-backup)
2832 ip -net "$ns2" route add 10.0.2.1 via 10.0.1.1 dev ns2eth1 # force this path
2836 chk_join_nr 2 2 2
2837 chk_prio_nr 1 1 1 1
2846 chk_prio_nr 0 1 0 0
2856 chk_prio_nr 1 1 0 0
2862 local e_type=$2
2891 local retl=$1
2892 local attempts=$2
2905 if [ -z "$count" ]; then
2908 fail_test "got ${count} MPC attempt[s] on port-based endpoint, expected ${attempts}"
2919 pm_nl_set_limits $ns1 0 1
2920 pm_nl_set_limits $ns2 1 1
2923 chk_join_nr 1 1 1
2924 chk_add_nr 1 1 1
2930 pm_nl_set_limits $ns1 0 2
2931 pm_nl_set_limits $ns2 1 2
2934 chk_join_nr 2 2 2
2935 chk_add_nr 1 1 1
2941 pm_nl_set_limits $ns1 0 1
2943 pm_nl_set_limits $ns2 1 1
2944 addr_nr_ns1=-1 speed=slow \
2946 chk_join_nr 1 1 1
2947 chk_add_nr 1 1 1
2948 chk_rm_nr 1 1 invert
2959 pm_nl_set_limits $ns1 0 2
2961 pm_nl_set_limits $ns2 1 2
2963 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2965 chk_join_nr 2 2 2
2966 chk_add_nr 1 1 1
2967 chk_rm_nr 1 1
2974 pm_nl_set_limits $ns2 1 3
2977 addr_nr_ns1=-8 addr_nr_ns2=-2 speed=slow \
2980 chk_add_nr 1 1
2981 chk_rm_nr 1 3 invert simult
2986 pm_nl_set_limits $ns1 2 2
2989 pm_nl_set_limits $ns2 2 2
2991 chk_join_nr 2 2 2
2992 chk_add_nr 2 2 2
2997 pm_nl_set_limits $ns1 2 2
3000 pm_nl_set_limits $ns2 2 2
3002 chk_join_nr 2 2 2
3003 chk_add_nr 2 2 2
3006 if reset "port-based signal endpoint must not accept mpc"; then
3014 timeout 1 ip netns exec ${ns2} \
3015 ./mptcp_connect -t ${timeout_poll} -p $port -s MPTCP 10.0.2.1 >/dev/null 2>&1
3019 chk_mpc_endp_attempt ${retl} 1
3027 pm_nl_set_limits $ns1 0 1
3028 pm_nl_set_limits $ns2 0 1
3031 chk_join_nr 1 1 1
3036 pm_nl_set_limits $ns1 0 2
3037 pm_nl_set_limits $ns2 0 2
3041 chk_join_nr 2 2 2
3046 pm_nl_set_limits $ns1 0 1
3047 pm_nl_set_limits $ns2 0 2
3051 chk_join_nr 2 1 1
3056 pm_nl_set_limits $ns1 0 1
3057 pm_nl_set_limits $ns2 1 1
3060 chk_join_nr 1 1 1
3061 chk_add_nr 1 1
3067 pm_nl_set_limits $ns1 0 2
3068 pm_nl_set_limits $ns2 1 2
3071 chk_join_nr 2 2 2
3072 chk_add_nr 1 1
3079 pm_nl_set_limits $ns2 1 3
3084 chk_add_nr 1 1
3091 for checksum_enable in "0 0" "1 1" "0 1" "1 0"; do
3092 # checksum test 0 0, 1 1, 0 1, 1 0
3094 pm_nl_set_limits $ns1 0 1
3095 pm_nl_set_limits $ns2 0 1
3105 if reset_with_allow_join_id0 "single subflow allow join id0 ns1" 1 0; then
3106 pm_nl_set_limits $ns1 1 1
3107 pm_nl_set_limits $ns2 1 1
3110 chk_join_nr 1 1 1
3114 if reset_with_allow_join_id0 "single subflow allow join id0 ns2" 0 1; then
3115 pm_nl_set_limits $ns1 1 1
3116 pm_nl_set_limits $ns2 1 1
3124 if reset_with_allow_join_id0 "signal address allow join id0 ns1" 1 0; then
3125 pm_nl_set_limits $ns1 1 1
3126 pm_nl_set_limits $ns2 1 1
3129 chk_join_nr 1 1 1
3130 chk_add_nr 1 1
3135 if reset_with_allow_join_id0 "signal address allow join id0 ns2" 0 1; then
3136 pm_nl_set_limits $ns1 1 1
3137 pm_nl_set_limits $ns2 1 1
3140 chk_join_nr 1 1 1
3141 chk_add_nr 1 1
3145 if reset_with_allow_join_id0 "subflow and address allow join id0 1" 1 0; then
3146 pm_nl_set_limits $ns1 2 2
3147 pm_nl_set_limits $ns2 2 2
3151 chk_join_nr 2 2 2
3155 if reset_with_allow_join_id0 "subflow and address allow join id0 2" 0 1; then
3156 pm_nl_set_limits $ns1 2 2
3157 pm_nl_set_limits $ns2 2 2
3161 chk_join_nr 1 1 1
3167 # fullmesh 1
3168 # 2 fullmesh addrs in ns2, added before the connection,
3169 # 1 non-fullmesh addr in ns1, added during the connection.
3170 if reset "fullmesh test 2x1"; then
3172 pm_nl_set_limits $ns2 1 4
3175 addr_nr_ns1=1 speed=slow \
3178 chk_add_nr 1 1
3181 # fullmesh 2
3182 # 1 non-fullmesh addr in ns1, added before the connection,
3183 # 1 fullmesh addr in ns2, added during the connection.
3184 if reset "fullmesh test 1x1"; then
3185 pm_nl_set_limits $ns1 1 3
3186 pm_nl_set_limits $ns2 1 3
3191 fullmesh=1 speed=slow \
3194 chk_add_nr 1 1
3198 # 1 non-fullmesh addr in ns1, added before the connection,
3199 # 2 fullmesh addrs in ns2, added during the connection.
3200 if reset "fullmesh test 1x2"; then
3201 pm_nl_set_limits $ns1 2 5
3202 pm_nl_set_limits $ns2 1 5
3204 fullmesh=2 speed=slow \
3207 chk_add_nr 1 1
3211 # 1 non-fullmesh addr in ns1, added before the connection,
3212 # 2 fullmesh addrs in ns2, added during the connection,
3214 if reset "fullmesh test 1x2, limited"; then
3215 pm_nl_set_limits $ns1 2 4
3216 pm_nl_set_limits $ns2 1 4
3218 fullmesh=2 speed=slow \
3221 chk_add_nr 1 1
3230 addr_nr_ns2=1 sflags=fullmesh speed=slow \
3232 chk_join_nr 2 2 2
3233 chk_rm_nr 0 1
3242 fullmesh=1 sflags=nofullmesh speed=slow \
3244 chk_join_nr 2 2 2
3245 chk_rm_nr 0 1
3254 addr_nr_ns2=1 sflags=backup,fullmesh speed=slow \
3256 chk_join_nr 2 2 2
3257 chk_prio_nr 0 1 1 0
3258 chk_rm_nr 0 1
3269 chk_join_nr 2 2 2
3270 chk_prio_nr 0 1 1 0
3271 chk_rm_nr 0 1
3278 MPTCP_LIB_SUBTEST_FLAKY=1
3282 chk_fclose_nr 1 1
3283 chk_rst_nr 1 1 invert
3287 MPTCP_LIB_SUBTEST_FLAKY=1
3290 join_rst_nr=1 \
3292 chk_fclose_nr 1 1 invert
3293 chk_rst_nr 1 1
3299 tc -n $ns2 -j -s action show action pedit index 100 | \
3306 if reset_with_fail "Infinite map" 1; then
3307 MPTCP_LIB_SUBTEST_FLAKY=1
3310 join_csum_ns1=+1 join_csum_ns2=+0 \
3311 join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \
3314 chk_fail_nr 1 -1 invert
3318 if reset_with_fail "MP_FAIL MP_RST" 2; then
3319 MPTCP_LIB_SUBTEST_FLAKY=1
3320 tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms
3321 pm_nl_set_limits $ns1 0 1
3322 pm_nl_set_limits $ns2 0 1
3326 join_csum_ns1=1 join_csum_ns2=0 \
3327 join_fail_nr=1 join_rst_nr=1 join_infi_nr=0 \
3329 chk_join_nr 1 1 1
3333 # $1: ns ; $2: addr ; $3: id
3339 [ "$1" == "$ns2" ] && evts=$evts_ns2
3342 ip netns exec $1 ./pm_nl_ctl ann $2 token $tk id $3
3343 sleep 1
3346 # $1: ns ; $2: id
3353 [ "$1" == "$ns2" ] && evts=$evts_ns2
3356 cnt=$(rm_addr_count ${1})
3357 ip netns exec $1 ./pm_nl_ctl rem token $tk id $2
3358 wait_rm_addr $1 "${cnt}"
3361 # $1: ns ; $2: addr ; $3: id
3367 [ "$1" == "$ns2" ] && evts=$evts_ns2
3372 ip netns exec $1 ./pm_nl_ctl csf lip $2 lid $3 \
3374 sleep 1
3377 # $1: ns ; $2: addr $3: event type
3381 local t=${3:-1}
3386 [ "$1" == "$ns2" ] && evts=$evts_ns2
3387 [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=4
3388 [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=6
3390 da=$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t $2)
3391 dp=$(mptcp_lib_evts_get_info dport "$evts" $t $2)
3392 sp=$(mptcp_lib_evts_get_info sport "$evts" $t $2)
3394 cnt=$(rm_sf_count ${1})
3395 ip netns exec $1 ./pm_nl_ctl dsf lip $2 lport $sp \
3397 wait_rm_sf $1 "${cnt}"
3402 local cmd="$1"
3403 local expected="$2"
3408 if [ ${rc} -eq 2 ]; then
3410 elif [ ${rc} -eq 0 ]; then
3412 elif [ ${rc} -eq 1 ]; then
3417 # $1: ns
3423 [ "$1" == "$ns2" ] && evts=$evts_ns2
3426 ip netns exec $1 ./pm_nl_ctl dump token $tk
3429 # $1: ns ; $2: id
3435 [ "$1" == "$ns2" ] && evts=$evts_ns2
3438 ip netns exec $1 ./pm_nl_ctl get $2 token $tk
3443 local ns="${1}"
3444 local exp="${2}"
3458 local ns="${1}"
3459 local id="${2}"
3471 # $1: ns ; $2: event type ; $3: count
3474 local ns=${1}
3475 local evt_name="${2}"
3493 count=$(grep -cw "type:${evt}" "${evts}")
3507 pm_nl_set_limits $ns1 0 2
3508 pm_nl_set_limits $ns2 0 2
3519 pm_nl_set_limits $ns1 0 2
3520 pm_nl_set_limits $ns2 0 2
3524 chk_add_nr 1 0
3531 pm_nl_set_limits $ns1 1 1
3532 pm_nl_set_limits $ns2 1 1
3535 chk_join_nr 1 1 0
3542 pm_nl_set_limits $ns1 1 1
3543 pm_nl_set_limits $ns2 1 1
3553 pm_nl_set_limits $ns1 1 1
3554 pm_nl_set_limits $ns2 1 1
3558 chk_join_nr 1 1 0
3567 pm_nl_set_limits $ns1 0 1
3568 pm_nl_set_limits $ns2 0 1
3570 addr_nr_ns2=-1 speed=slow \
3580 pm_nl_set_limits $ns2 2 2
3582 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3587 chk_join_nr 2 2 2
3588 chk_add_nr 2 2
3589 chk_mptcp_info subflows 2 subflows 2
3591 chk_mptcp_info add_addr_signal 2 add_addr_accepted 2
3602 chk_rm_nr 1 1 invert
3604 chk_subflows_total 1 1
3613 pm_nl_set_limits $ns1 0 1
3615 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3619 chk_join_nr 1 1 1
3620 chk_mptcp_info subflows 1 subflows 1
3621 chk_subflows_total 2 2
3630 chk_rm_nr 0 1
3632 chk_subflows_total 1 1
3641 pm_nl_set_limits $ns1 0 1
3643 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3647 chk_subflows_total 1 1
3651 chk_join_nr 1 1 1
3652 chk_mptcp_info subflows 1 subflows 1
3653 chk_subflows_total 2 2
3662 pm_nl_set_limits $ns1 0 1
3664 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3668 chk_join_nr 1 1 1
3669 chk_mptcp_info subflows 1 subflows 1
3670 chk_subflows_total 2 2
3674 chk_rm_nr 0 1
3676 chk_mptcp_info subflows 1 subflows 1
3677 chk_subflows_total 1 1
3686 pm_nl_set_limits $ns2 1 1
3688 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3692 chk_join_nr 1 1 1
3693 chk_add_nr 1 1
3694 chk_mptcp_info subflows 1 subflows 1
3695 chk_subflows_total 2 2
3696 chk_mptcp_info add_addr_signal 1 add_addr_accepted 1
3700 chk_rm_nr 1 0 invert
3702 chk_mptcp_info subflows 1 subflows 1
3703 chk_subflows_total 1 1
3715 pm_nl_set_limits $ns1 2 2
3716 pm_nl_set_limits $ns2 2 2
3719 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3724 $ns2 10.0.2.2 id 1 flags implicit
3725 chk_mptcp_info subflows 1 subflows 1
3726 chk_mptcp_info add_addr_signal 1 add_addr_accepted 1
3728 pm_nl_add_endpoint $ns2 10.0.2.2 id 33 2>/dev/null
3730 $ns2 10.0.2.2 id 1 flags implicit
3734 $ns2 10.0.2.2 id 1 flags signal
3738 if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT &&
3743 pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow
3744 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
3746 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3751 $ns2 10.0.2.2 id 2 flags subflow dev ns2eth2
3752 chk_subflow_nr "before delete id 2" 2
3753 chk_mptcp_info subflows 1 subflows 1
3755 pm_nl_del_endpoint $ns2 2 10.0.2.2
3757 chk_subflow_nr "after delete id 2" 1
3760 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
3762 chk_subflow_nr "after re-add id 2" 2
3763 chk_mptcp_info subflows 1 subflows 1
3767 chk_subflow_nr "after new reject" 2
3768 chk_mptcp_info subflows 1 subflows 1
3770 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
3775 chk_mptcp_info subflows 2 subflows 2
3779 pm_nl_del_endpoint $ns2 1 10.0.1.2
3781 chk_subflow_nr "after delete id 0 ($i)" 2
3782 chk_mptcp_info subflows 2 subflows 2 # only decr for additional sf
3784 pm_nl_add_endpoint $ns2 10.0.1.2 id 1 dev ns2eth1 flags subflow
3786 chk_subflow_nr "after re-add id 0 ($i)" 3
3793 chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1
3794 chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1
3795 chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
3801 chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1
3802 chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
3813 # remove and re-add
3814 if reset_with_events "delete re-add signal" &&
3818 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
3820 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
3823 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3828 $ns1 10.0.2.1 id 1 flags signal
3829 chk_subflow_nr "before delete" 2
3830 chk_mptcp_info subflows 1 subflows 1
3832 pm_nl_del_endpoint $ns1 1 10.0.2.1
3833 pm_nl_del_endpoint $ns1 2 224.0.0.1
3835 chk_subflow_nr "after delete" 1
3838 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
3839 pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
3841 chk_subflow_nr "after re-add" 3
3842 chk_mptcp_info subflows 2 subflows 2
3846 chk_subflow_nr "after delete ID 0" 2
3847 chk_mptcp_info subflows 2 subflows 2
3851 chk_subflow_nr "after re-add ID 0" 3
3856 chk_subflow_nr "after re-delete ID 0" 2
3857 chk_mptcp_info subflows 2 subflows 2
3861 chk_subflow_nr "after re-re-add ID 0" 3
3866 chk_evt_nr ns1 MPTCP_LIB_EVENT_LISTENER_CREATED 1
3867 chk_evt_nr ns1 MPTCP_LIB_EVENT_CREATED 1
3868 chk_evt_nr ns1 MPTCP_LIB_EVENT_ESTABLISHED 1
3874 chk_evt_nr ns2 MPTCP_LIB_EVENT_CREATED 1
3875 chk_evt_nr ns2 MPTCP_LIB_EVENT_ESTABLISHED 1
3881 join_connect_err=1 \
3887 # flush and re-add
3888 if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT &&
3890 pm_nl_set_limits $ns1 0 2
3891 pm_nl_set_limits $ns2 1 2
3893 pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
3896 run_tests $ns1 $ns2 10.0.1.1 & } 2>/dev/null
3900 chk_subflow_nr "before flush" 1
3906 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
3909 pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
3913 join_syn_tx=3 join_connect_err=1 \
3914 chk_join_nr 2 2 2
3915 chk_add_nr 2 2
3916 chk_rm_nr 1 0 invert
3920 # [$1: error message]
3923 if [ -n "${1}" ]; then
3924 echo "${1}"
3932 echo " -${key} ${all_tests[${key}]}"
3935 echo " -c capture pcap files"
3936 echo " -C enable data checksum"
3937 echo " -i use ip mptcp"
3938 echo " -h help"
4000 usage "Unknown option: -${opt}"
4005 shift $((OPTIND - 1))
4008 if [[ "${arg}" =~ ^[0-9]+$ ]]; then
4015 if [ ${#tests[@]} -eq 0 ]; then
4025 if [ ${ret} -ne 0 ]; then
4029 echo -e "\t- ${i}: ${failed_tests[${i}]}"