Lines Matching +full:rx +full:- +full:eq

2 # SPDX-License-Identifier: GPL-2.0
46 declare -A all_tests
47 declare -a only_tests_ids
48 declare -a only_tests_names
49 declare -A failed_tests
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
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
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"
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
229 local msg="${1:-"Feature not supported"}"
250 if [ "${#only_tests_ids[@]}" -eq 0 ] && [ "${#only_tests_names[@]}" -eq 0 ]; then
256 if [ "$((MPTCP_LIB_TEST_COUNTER+1))" -eq "${i}" ]; then
271 if [ ${last_test_failed} -eq 1 ]; then
273 elif [ ${last_test_skipped} -eq 1 ]; then
275 elif [ ${last_test_ignored} -ne 1 ]; then
319 if ! nstat -asz "${counter}" | grep -wq "${counter}"; then
332 ip netns exec $netns sysctl -q net.ipv4.tcp_syncookies=2
339 local ip="${2:-4}"
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
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
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
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 \
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
471 local chain="${4:-INPUT}"
474 -A "${chain}" \
475 -s "${src}" \
476 -p tcp \
477 -j "${target}"; then
490 if [ ${#} -gt 0 ]; then
495 if [ ${last_test_failed} -eq 0 ]; then
508 done | sort -n
520 if [ -n "$bytes" ]; then
523 out_size=$(wc -c $out | awk '{print $1}')
524 if [ $out_size -ne $bytes ]; then
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
559 if ! ip netns exec ${connector_ns} ping -q -c 1 $connect_addr >/dev/null; then
560 fail_test "$listener_ns -> $connect_addr connectivity"
568 if [ -z "$FAILING_LINKS" ]; then
576 ip -net "$ns" link set "$veth" down
683 while [ -n "$1" ]; do
696 if [ -z "${id}" ]; then
697 fail_test "bad test - missing endpoint id"
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
729 if [ $addr_nr_ns1 -gt 0 ]; then
733 while [ $add_nr_ns1 -gt 0 ]; do
742 add_nr_ns1=$((add_nr_ns1 - 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
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
794 add_nr_ns2=$((add_nr_ns2 - 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
825 elif [ $rm_nr_ns2 -eq 8 ]; then
827 elif [ $rm_nr_ns2 -eq 9 ]; then
838 if [ -n "${sflags}" ]; then
844 pm_nl_show_endpoints $netns | while read -r line; do
871 if [ -z "$count" ]; then
883 if [ -n "${cestab_ns1}" ]; then
886 if [ -n "${cestab_ns2}" ]; then
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 &
926 echo "$((10000 + MPTCP_LIB_TEST_COUNTER - 1))"
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
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"
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
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
1047 if [ "$test_linkfail" -gt 1 ];then
1053 if [ "$test_linkfail" -eq 0 ];then
1060 [ $retc -eq 0 ] && [ $rets -eq 0 ]
1081 local test_linkfail=${test_linkfail:-0}
1085 if [ "$test_linkfail" -gt 2 ]; then
1088 if [ -z "$cinfail" ]; then
1094 elif [ "$test_linkfail" -ne 0 ] && [ -z "$cinfail" ]; then
1107 if [ "$test_linkfail" -gt 2 ]; then
1110 if [ -z "$sinfail" ]; then
1114 elif [ "$test_linkfail" -eq 2 ] && [ -z "$sinfail" ]; then
1129 ip netns exec $ns1 nstat -as | grep Tcp
1131 ip netns exec $ns2 nstat -as | grep Tcp
1136 local csum_ns1=${1:-0}
1137 local csum_ns2=${2:-0}
1154 if [ -n "$count" ] && [ "$count" != "$csum_ns1" ]; then
1157 if [ -z "$count" ]; then
1159 elif { [ "$count" != $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 0 ]; } ||
1160 { [ "$count" -lt $csum_ns1 ] && [ $allow_multi_errors_ns1 -eq 1 ]; }; then
1168 if [ -n "$count" ] && [ "$count" != "$csum_ns2" ]; then
1171 if [ -z "$count" ]; then
1173 elif { [ "$count" != $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 0 ]; } ||
1174 { [ "$count" -lt $csum_ns2 ] && [ $allow_multi_errors_ns2 -eq 1 ]; }; then
1187 local ns_invert=${3:-""}
1192 local rx="client"
1201 rx="server"
1204 if [[ "${fail_tx}" = "-"* ]]; then
1208 if [[ "${fail_rx}" = "-"* ]]; then
1215 if [ -n "$count" ] && [ "$count" != "$fail_tx" ]; then
1218 if [ -z "$count" ]; then
1220 elif { [ "$count" != "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } ||
1221 { [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then
1227 print_check "fail rx ${rx}"
1229 if [ -n "$count" ] && [ "$count" != "$fail_rx" ]; then
1230 extra_msg+=" rx=$count"
1232 if [ -z "$count" ]; then
1234 elif { [ "$count" != "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } ||
1235 { [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then
1236 fail_test "got $count MP_FAIL[s] RX expected $fail_rx"
1253 local rx="server"
1259 rx="client"
1264 if [ -z "$count" ]; then
1272 print_check "fast close rx ${rx}"
1274 if [ -z "$count" ]; then
1277 fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx"
1287 local ns_invert=${3:-""}
1292 local rx="client"
1298 rx="server"
1303 if [ -z "$count" ]; then
1306 elif { [ $rst_tx -ne 0 ] && [ $count -lt $rst_tx ]; } ||
1307 { [ $rst_tx -eq 0 ] && [ $count -ne 0 ]; }; then
1313 print_check "reset rx ${rx}"
1315 if [ -z "$count" ]; then
1318 elif { [ $rst_rx -ne 0 ] && [ $count -lt $rst_rx ]; } ||
1319 { [ $rst_rx -eq 0 ] && [ $count -ne 0 ]; }; then
1320 fail_test "got $count MP_RST[s] RX expected $rst_rx"
1334 if [ -z "$count" ]; then
1342 print_check "infi rx server"
1344 if [ -z "$count" ]; then
1347 fail_test "got $count infinite map[s] RX expected $infi_rx"
1355 local syn_tx=${join_syn_tx:-0}
1356 local create=${join_create_err:-0}
1357 local bind=${join_bind_err:-0}
1358 local connect=${join_connect_err:-0}
1363 if [ -z "$count" ]; then
1372 if [ -z "$count" ]; then
1381 if [ -z "$count" ]; then
1390 if [ -z "$count" ]; then
1406 local csum_ns1=${join_csum_ns1:-0}
1407 local csum_ns2=${join_csum_ns2:-0}
1408 local fail_nr=${join_fail_nr:-0}
1409 local rst_nr=${join_rst_nr:-0}
1410 local infi_nr=${join_infi_nr:-0}
1411 local corrupted_pkts=${join_corrupted_pkts:-0}
1416 if [ "${corrupted_pkts}" -gt 0 ]; then
1421 if [ -z "$count" ]; then
1425 print_check "syn rx"
1426 fail_test "got $count JOIN[s] syn rx expected $syn_nr"
1429 with_cookie=$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies)
1431 if [ -z "$count" ]; then
1437 if [ "$with_cookie" != 2 ] || [ "$count" -le "$syn_ack_nr" ] || [ "$count" -gt "$syn_nr" ]; then
1439 print_check "synack rx"
1440 fail_test "got $count JOIN[s] synack rx expected $syn_ack_nr"
1445 if [ -z "$count" ]; then
1449 print_check "ack rx"
1450 fail_test "got $count JOIN[s] ack rx expected $ack_nr"
1453 print_results "join Rx" ${rc}
1455 join_syn_tx="${join_syn_tx:-${syn_nr}}" \
1468 # - as these tests do - we can have a quite high number of
1470 # sleep duration/ MPTCP-level RTX interval.
1485 if [ -z "$stale_nr" ] || [ -z "$recover_nr" ]; then
1487 elif [ $stale_nr -lt $stale_min ] ||
1488 { [ $stale_max -gt 0 ] && [ $stale_nr -gt $stale_max ]; } ||
1489 [ $((stale_nr - recover_nr)) -ne $stale_delta ]; then
1492 " stale-recover delta $stale_delta"
1500 ip netns exec $ns ip -s link show
1501 ip netns exec $ns nstat -as | grep MPTcp
1509 local port_nr=${3:-0}
1510 local ns_invert=${4:-""}
1519 local rx=""
1527 rx=" server"
1530 timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout)
1532 print_check "add addr rx${rx}"
1534 if [ -z "$count" ]; then
1538 elif [ "$count" != "$add_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -lt "$add_nr" ]; }; then
1544 print_check "add addr echo rx${tx}"
1546 if [ -z "$count" ]; then
1554 if [ $port_nr -gt 0 ]; then
1555 print_check "add addr rx with port${rx}"
1557 if [ -z "$count" ]; then
1560 fail_test "got $count ADD_ADDR[s] with a port-number expected $port_nr"
1565 print_check "syn rx port${tx}"
1567 if [ -z "$count" ]; then
1571 port-number expected $syn_nr"
1576 print_check "synack rx port${rx}"
1578 if [ -z "$count" ]; then
1582 port-number expected $syn_ack_nr"
1587 print_check "ack rx port${tx}"
1589 if [ -z "$count" ]; then
1593 port-number expected $ack_nr"
1598 print_check "syn rx port mismatch${tx}"
1600 if [ -z "$count" ]; then
1604 port-number expected $mis_syn_nr"
1609 print_check "ack rx port mismatch${tx}"
1611 if [ -z "$count" ]; then
1615 port-number expected $mis_ack_nr"
1629 timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout)
1633 if [ -z "$count" ]; then
1637 …elif [ "$count" != "$add_tx_nr" ] && { [ "$timeout" -gt 1 ] || [ "$count" -lt "$add_tx_nr" ]; }; t…
1645 if [ -z "$count" ]; then
1668 while [ -n "$1" ]; do
1681 print_check "rm addr rx ${addr}"
1683 if [ -z "$count" ]; then
1693 if [ -z "$count" ]; then
1695 elif [ -n "$simult" ]; then
1707 if [ $count -ge "$rm_subflow_nr" ] && \
1708 [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
1728 if [ -z "$count" ]; then
1747 if [ -z "$count" ]; then
1755 print_check "mp_prio rx client"
1757 if [ -z "$count" ]; then
1760 fail_test "got $count MP_PRIO[s] RX expected $mp_prio_nr_rx"
1767 if [ -z "$count" ]; then
1777 if [ -z "$count" ]; then
1796 cnt1=$(ss -N $ns1 -tOni | grep -c token)
1797 cnt2=$(ss -N $ns2 -tOni | grep -c token)
1806 ss -N $ns1 -tOni
1807 ss -N $ns1 -tOni | grep token
1808 ip -n $ns1 mptcp endpoint
1824 cnt1=$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1")
1825 cnt2=$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2")
1827 [ -z "$cnt1" ] && cnt1=0
1828 [ -z "$cnt2" ] && cnt2=0
1838 ss -N $ns1 -inmHM
1839 ss -N $ns2 -inmHM
1853 if [ -n "$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value $info $info)" ]; then
1861 cnt1=$(ss -N $ns1 -ti state established state syn-sent state syn-recv |
1862 grep -c tcp-ulp-mptcp)
1863 cnt2=$(ss -N $ns2 -ti state established state syn-sent state syn-recv |
1864 grep -c tcp-ulp-mptcp)
1874 ss -N $ns1 -ti
1875 ss -N $ns2 -ti
1888 tx_total=$(stat --format=%s $out)
1893 if [ $tx_rate -lt $((expected_rate - tolerance)) ] || \
1894 [ $tx_rate -gt $((expected_rate + tolerance)) ]; then
1907 while [ $time -lt $timeout_ms ]; do
1923 ip netns exec $ns sysctl -q net.mptcp.pm_type=1
2155 ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
2181 # active backup and link switch-over.
2209 chk_stale_nr $ns2 1 -1 1
2255 chk_stale_nr $ns2 1 -1 2
2318 addr_nr_ns2=-1 speed=slow \
2332 addr_nr_ns2=-2 speed=slow \
2344 addr_nr_ns1=-1 speed=slow \
2358 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2373 addr_nr_ns1=-1 addr_nr_ns2=-2 speed=10 \
2388 addr_nr_ns1=-3 speed=10 \
2404 addr_nr_ns1=-3 speed=10 \
2420 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2435 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2455 addr_nr_ns1=-8 addr_nr_ns2=-8 speed=slow \
2470 addr_nr_ns1=-8 speed=slow \
2484 addr_nr_ns2=-9 speed=slow \
2496 addr_nr_ns1=-9 speed=slow \
2597 addr_nr_ns1=-1 speed=slow \
2610 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2620 # subflow IPv4-mapped to IPv4-mapped
2621 if reset "single subflow IPv4-mapped"; then
2629 # signal address IPv4-mapped with IPv4-mapped sk
2630 if reset "signal address IPv4-mapped"; then
2639 # subflow v4-map-v6
2640 if reset "single subflow v4-map-v6"; then
2648 # signal address v4-map-v6
2649 if reset "signal address v4-map-v6"; then
2658 # subflow v6-map-v4
2659 if reset "single subflow v6-map-v4"; then
2667 # signal address v6-map-v4
2668 if reset "signal address v6-map-v4"; then
2678 if reset "no JOIN with diff families v4-v6"; then
2687 if reset "no JOIN with diff families v4-v6-2"; then
2696 if reset "no JOIN with diff families v6-v4"; then
2823 # 10.0.2.2 (non-backup) -> 10.0.1.1 (backup)
2825 # 10.0.1.2 (backup) -> 10.0.2.1 (non-backup)
2827 ip -net "$ns2" route add 10.0.2.1 via 10.0.1.1 dev ns2eth1 # force this path
2900 if [ -z "$count" ]; then
2903 fail_test "got ${count} MPC attempt[s] on port-based endpoint, expected ${attempts}"
2939 addr_nr_ns1=-1 speed=slow \
2958 addr_nr_ns1=-1 addr_nr_ns2=-1 speed=slow \
2972 addr_nr_ns1=-8 addr_nr_ns2=-2 speed=slow \
3001 if reset "port-based signal endpoint must not accept mpc"; then
3010 ./mptcp_connect -t ${timeout_poll} -p $port -s MPTCP 10.0.2.1 >/dev/null 2>&1
3164 # 1 non-fullmesh addr in ns1, added during the connection.
3177 # 1 non-fullmesh addr in ns1, added before the connection,
3193 # 1 non-fullmesh addr in ns1, added before the connection,
3206 # 1 non-fullmesh addr in ns1, added before the connection,
3294 tc -n $ns2 -j -s action show action pedit index 100 | \
3309 chk_fail_nr 1 -1 invert
3315 tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms
3376 local t=${3:-1}
3382 [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=4
3383 [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=6
3403 if [ ${rc} -eq 2 ]; then
3405 elif [ ${rc} -eq 0 ]; then
3407 elif [ ${rc} -eq 1 ]; then
3488 count=$(grep -cw "type:${evt}" "${evts}")
3565 addr_nr_ns2=-1 speed=slow \
3733 if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT &&
3757 chk_subflow_nr "after re-add id 2" 2
3765 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
3781 chk_subflow_nr "after re-add id 0 ($i)" 3
3808 # remove and re-add
3809 if reset_with_events "delete re-add signal" &&
3836 chk_subflow_nr "after re-add" 3
3846 chk_subflow_nr "after re-add ID 0" 3
3851 chk_subflow_nr "after re-delete ID 0" 2
3856 chk_subflow_nr "after re-re-add ID 0" 3
3882 # flush and re-add
3883 if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT &&
3901 ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
3918 if [ -n "${1}" ]; then
3927 echo " -${key} ${all_tests[${key}]}"
3930 echo " -c capture pcap files"
3931 echo " -C enable data checksum"
3932 echo " -i use ip mptcp"
3933 echo " -h help"
3995 usage "Unknown option: -${opt}"
4000 shift $((OPTIND - 1))
4003 if [[ "${arg}" =~ ^[0-9]+$ ]]; then
4010 if [ ${#tests[@]} -eq 0 ]; then
4020 if [ ${ret} -ne 0 ]; then
4024 echo -e "\t- ${i}: ${failed_tests[${i}]}"