1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4ret=0 5sin="" 6sout="" 7cin="" 8cinsent="" 9cout="" 10ksft_skip=4 11timeout=30 12mptcp_connect="" 13capture=0 14 15TEST_COUNT=0 16 17# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || 18# (ip6 && (ip6[74] & 0xf0) == 0x30)'" 19CBPF_MPTCP_SUBOPTION_ADD_ADDR="14, 20 48 0 0 0, 21 84 0 0 240, 22 21 0 3 64, 23 48 0 0 54, 24 84 0 0 240, 25 21 6 7 48, 26 48 0 0 0, 27 84 0 0 240, 28 21 0 4 96, 29 48 0 0 74, 30 84 0 0 240, 31 21 0 1 48, 32 6 0 0 65535, 33 6 0 0 0" 34 35init() 36{ 37 capout=$(mktemp) 38 39 rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) 40 41 ns1="ns1-$rndh" 42 ns2="ns2-$rndh" 43 44 for netns in "$ns1" "$ns2";do 45 ip netns add $netns || exit $ksft_skip 46 ip -net $netns link set lo up 47 ip netns exec $netns sysctl -q net.mptcp.enabled=1 48 ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 49 ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 50 done 51 52 # ns1 ns2 53 # ns1eth1 ns2eth1 54 # ns1eth2 ns2eth2 55 # ns1eth3 ns2eth3 56 # ns1eth4 ns2eth4 57 58 for i in `seq 1 4`; do 59 ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2" 60 ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i 61 ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad 62 ip -net "$ns1" link set ns1eth$i up 63 64 ip -net "$ns2" addr add 10.0.$i.2/24 dev ns2eth$i 65 ip -net "$ns2" addr add dead:beef:$i::2/64 dev ns2eth$i nodad 66 ip -net "$ns2" link set ns2eth$i up 67 68 # let $ns2 reach any $ns1 address from any interface 69 ip -net "$ns2" route add default via 10.0.$i.1 dev ns2eth$i metric 10$i 70 done 71} 72 73cleanup_partial() 74{ 75 rm -f "$capout" 76 77 for netns in "$ns1" "$ns2"; do 78 ip netns del $netns 79 done 80} 81 82cleanup() 83{ 84 rm -f "$cin" "$cout" 85 rm -f "$sin" "$sout" "$cinsent" 86 cleanup_partial 87} 88 89reset() 90{ 91 cleanup_partial 92 init 93} 94 95reset_with_cookies() 96{ 97 reset 98 99 for netns in "$ns1" "$ns2";do 100 ip netns exec $netns sysctl -q net.ipv4.tcp_syncookies=2 101 done 102} 103 104reset_with_add_addr_timeout() 105{ 106 local ip="${1:-4}" 107 local tables 108 109 tables="iptables" 110 if [ $ip -eq 6 ]; then 111 tables="ip6tables" 112 fi 113 114 reset 115 116 ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1 117 ip netns exec $ns2 $tables -A OUTPUT -p tcp \ 118 -m tcp --tcp-option 30 \ 119 -m bpf --bytecode \ 120 "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \ 121 -j DROP 122} 123 124for arg in "$@"; do 125 if [ "$arg" = "-c" ]; then 126 capture=1 127 fi 128done 129 130ip -Version > /dev/null 2>&1 131if [ $? -ne 0 ];then 132 echo "SKIP: Could not run test without ip tool" 133 exit $ksft_skip 134fi 135 136iptables -V > /dev/null 2>&1 137if [ $? -ne 0 ];then 138 echo "SKIP: Could not run all tests without iptables tool" 139 exit $ksft_skip 140fi 141 142ip6tables -V > /dev/null 2>&1 143if [ $? -ne 0 ];then 144 echo "SKIP: Could not run all tests without ip6tables tool" 145 exit $ksft_skip 146fi 147 148print_file_err() 149{ 150 ls -l "$1" 1>&2 151 echo "Trailing bytes are: " 152 tail -c 27 "$1" 153} 154 155check_transfer() 156{ 157 in=$1 158 out=$2 159 what=$3 160 161 cmp "$in" "$out" > /dev/null 2>&1 162 if [ $? -ne 0 ] ;then 163 echo "[ FAIL ] $what does not match (in, out):" 164 print_file_err "$in" 165 print_file_err "$out" 166 ret=1 167 168 return 1 169 fi 170 171 return 0 172} 173 174do_ping() 175{ 176 listener_ns="$1" 177 connector_ns="$2" 178 connect_addr="$3" 179 180 ip netns exec ${connector_ns} ping -q -c 1 $connect_addr >/dev/null 181 if [ $? -ne 0 ] ; then 182 echo "$listener_ns -> $connect_addr connectivity [ FAIL ]" 1>&2 183 ret=1 184 fi 185} 186 187link_failure() 188{ 189 ns="$1" 190 191 l=$((RANDOM%4)) 192 l=$((l+1)) 193 194 veth="ns1eth$l" 195 ip -net "$ns" link set "$veth" down 196} 197 198# $1: IP address 199is_v6() 200{ 201 [ -z "${1##*:*}" ] 202} 203 204do_transfer() 205{ 206 listener_ns="$1" 207 connector_ns="$2" 208 cl_proto="$3" 209 srv_proto="$4" 210 connect_addr="$5" 211 test_link_fail="$6" 212 addr_nr_ns1="$7" 213 addr_nr_ns2="$8" 214 speed="$9" 215 bkup="${10}" 216 217 port=$((10000+$TEST_COUNT)) 218 TEST_COUNT=$((TEST_COUNT+1)) 219 220 :> "$cout" 221 :> "$sout" 222 :> "$capout" 223 224 if [ $capture -eq 1 ]; then 225 if [ -z $SUDO_USER ] ; then 226 capuser="" 227 else 228 capuser="-Z $SUDO_USER" 229 fi 230 231 capfile=$(printf "mp_join-%02u-%s.pcap" "$TEST_COUNT" "${listener_ns}") 232 233 echo "Capturing traffic for test $TEST_COUNT into $capfile" 234 ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 & 235 cappid=$! 236 237 sleep 1 238 fi 239 240 if [ $speed = "fast" ]; then 241 mptcp_connect="./mptcp_connect -j" 242 else 243 mptcp_connect="./mptcp_connect -r" 244 fi 245 246 local local_addr 247 if is_v6 "${connect_addr}"; then 248 local_addr="::" 249 else 250 local_addr="0.0.0.0" 251 fi 252 253 ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port \ 254 -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & 255 spid=$! 256 257 sleep 1 258 259 if [ "$test_link_fail" -eq 0 ];then 260 ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" & 261 else 262 ( cat "$cin" ; sleep 2; link_failure $listener_ns ; cat "$cin" ) | tee "$cinsent" | \ 263 ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr > "$cout" & 264 fi 265 cpid=$! 266 267 if [ $addr_nr_ns1 -gt 0 ]; then 268 let add_nr_ns1=addr_nr_ns1 269 counter=2 270 sleep 1 271 while [ $add_nr_ns1 -gt 0 ]; do 272 local addr 273 if is_v6 "${connect_addr}"; then 274 addr="dead:beef:$counter::1" 275 else 276 addr="10.0.$counter.1" 277 fi 278 ip netns exec $ns1 ./pm_nl_ctl add $addr flags signal 279 let counter+=1 280 let add_nr_ns1-=1 281 done 282 sleep 1 283 elif [ $addr_nr_ns1 -lt 0 ]; then 284 let rm_nr_ns1=-addr_nr_ns1 285 if [ $rm_nr_ns1 -lt 8 ]; then 286 counter=1 287 sleep 1 288 289 while [ $counter -le $rm_nr_ns1 ] 290 do 291 ip netns exec ${listener_ns} ./pm_nl_ctl del $counter 292 sleep 1 293 let counter+=1 294 done 295 else 296 sleep 1 297 ip netns exec ${listener_ns} ./pm_nl_ctl flush 298 fi 299 fi 300 301 if [ $addr_nr_ns2 -gt 0 ]; then 302 let add_nr_ns2=addr_nr_ns2 303 counter=3 304 sleep 1 305 while [ $add_nr_ns2 -gt 0 ]; do 306 local addr 307 if is_v6 "${connect_addr}"; then 308 addr="dead:beef:$counter::2" 309 else 310 addr="10.0.$counter.2" 311 fi 312 ip netns exec $ns2 ./pm_nl_ctl add $addr flags subflow 313 let counter+=1 314 let add_nr_ns2-=1 315 done 316 sleep 1 317 elif [ $addr_nr_ns2 -lt 0 ]; then 318 let rm_nr_ns2=-addr_nr_ns2 319 if [ $rm_nr_ns2 -lt 8 ]; then 320 counter=1 321 sleep 1 322 323 while [ $counter -le $rm_nr_ns2 ] 324 do 325 ip netns exec ${connector_ns} ./pm_nl_ctl del $counter 326 sleep 1 327 let counter+=1 328 done 329 else 330 sleep 1 331 ip netns exec ${connector_ns} ./pm_nl_ctl flush 332 fi 333 fi 334 335 if [ ! -z $bkup ]; then 336 sleep 1 337 for netns in "$ns1" "$ns2"; do 338 dump=(`ip netns exec $netns ./pm_nl_ctl dump`) 339 if [ ${#dump[@]} -gt 0 ]; then 340 addr=${dump[${#dump[@]} - 1]} 341 backup="ip netns exec $netns ./pm_nl_ctl set $addr flags $bkup" 342 $backup 343 fi 344 done 345 fi 346 347 wait $cpid 348 retc=$? 349 wait $spid 350 rets=$? 351 352 if [ $capture -eq 1 ]; then 353 sleep 1 354 kill $cappid 355 fi 356 357 if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then 358 echo " client exit code $retc, server $rets" 1>&2 359 echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2 360 ip netns exec ${listener_ns} ss -nita 1>&2 -o "sport = :$port" 361 echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2 362 ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port" 363 364 cat "$capout" 365 ret=1 366 return 1 367 fi 368 369 check_transfer $sin $cout "file received by client" 370 retc=$? 371 if [ "$test_link_fail" -eq 0 ];then 372 check_transfer $cin $sout "file received by server" 373 else 374 check_transfer $cinsent $sout "file received by server" 375 fi 376 rets=$? 377 378 if [ $retc -eq 0 ] && [ $rets -eq 0 ];then 379 cat "$capout" 380 return 0 381 fi 382 383 cat "$capout" 384 return 1 385} 386 387make_file() 388{ 389 name=$1 390 who=$2 391 size=$3 392 393 dd if=/dev/urandom of="$name" bs=1024 count=$size 2> /dev/null 394 echo -e "\nMPTCP_TEST_FILE_END_MARKER" >> "$name" 395 396 echo "Created $name (size $size KB) containing data sent by $who" 397} 398 399run_tests() 400{ 401 listener_ns="$1" 402 connector_ns="$2" 403 connect_addr="$3" 404 test_linkfail="${4:-0}" 405 addr_nr_ns1="${5:-0}" 406 addr_nr_ns2="${6:-0}" 407 speed="${7:-fast}" 408 bkup="${8:-""}" 409 lret=0 410 oldin="" 411 412 if [ "$test_linkfail" -eq 1 ];then 413 size=$((RANDOM%1024)) 414 size=$((size+1)) 415 size=$((size*128)) 416 417 oldin=$(mktemp) 418 cp "$cin" "$oldin" 419 make_file "$cin" "client" $size 420 fi 421 422 do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ 423 ${test_linkfail} ${addr_nr_ns1} ${addr_nr_ns2} ${speed} ${bkup} 424 lret=$? 425 426 if [ "$test_linkfail" -eq 1 ];then 427 cp "$oldin" "$cin" 428 rm -f "$oldin" 429 fi 430 431 if [ $lret -ne 0 ]; then 432 ret=$lret 433 return 434 fi 435} 436 437chk_join_nr() 438{ 439 local msg="$1" 440 local syn_nr=$2 441 local syn_ack_nr=$3 442 local ack_nr=$4 443 local count 444 local dump_stats 445 446 printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" 447 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` 448 [ -z "$count" ] && count=0 449 if [ "$count" != "$syn_nr" ]; then 450 echo "[fail] got $count JOIN[s] syn expected $syn_nr" 451 ret=1 452 dump_stats=1 453 else 454 echo -n "[ ok ]" 455 fi 456 457 echo -n " - synack" 458 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk '{print $2}'` 459 [ -z "$count" ] && count=0 460 if [ "$count" != "$syn_ack_nr" ]; then 461 echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" 462 ret=1 463 dump_stats=1 464 else 465 echo -n "[ ok ]" 466 fi 467 468 echo -n " - ack" 469 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '{print $2}'` 470 [ -z "$count" ] && count=0 471 if [ "$count" != "$ack_nr" ]; then 472 echo "[fail] got $count JOIN[s] ack expected $ack_nr" 473 ret=1 474 dump_stats=1 475 else 476 echo "[ ok ]" 477 fi 478 if [ "${dump_stats}" = 1 ]; then 479 echo Server ns stats 480 ip netns exec $ns1 nstat -as | grep MPTcp 481 echo Client ns stats 482 ip netns exec $ns2 nstat -as | grep MPTcp 483 fi 484} 485 486chk_add_nr() 487{ 488 local add_nr=$1 489 local echo_nr=$2 490 local port_nr=${3:-0} 491 local syn_nr=${4:-$port_nr} 492 local syn_ack_nr=${5:-$port_nr} 493 local ack_nr=${6:-$port_nr} 494 local mis_syn_nr=${7:-0} 495 local mis_ack_nr=${8:-0} 496 local count 497 local dump_stats 498 499 printf "%-39s %s" " " "add" 500 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` 501 [ -z "$count" ] && count=0 502 if [ "$count" != "$add_nr" ]; then 503 echo "[fail] got $count ADD_ADDR[s] expected $add_nr" 504 ret=1 505 dump_stats=1 506 else 507 echo -n "[ ok ]" 508 fi 509 510 echo -n " - echo " 511 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{print $2}'` 512 [ -z "$count" ] && count=0 513 if [ "$count" != "$echo_nr" ]; then 514 echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" 515 ret=1 516 dump_stats=1 517 else 518 echo -n "[ ok ]" 519 fi 520 521 if [ $port_nr -gt 0 ]; then 522 echo -n " - pt " 523 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{print $2}'` 524 [ -z "$count" ] && count=0 525 if [ "$count" != "$port_nr" ]; then 526 echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_nr" 527 ret=1 528 dump_stats=1 529 else 530 echo "[ ok ]" 531 fi 532 533 printf "%-39s %s" " " "syn" 534 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | 535 awk '{print $2}'` 536 [ -z "$count" ] && count=0 537 if [ "$count" != "$syn_nr" ]; then 538 echo "[fail] got $count JOIN[s] syn with a different \ 539 port-number expected $syn_nr" 540 ret=1 541 dump_stats=1 542 else 543 echo -n "[ ok ]" 544 fi 545 546 echo -n " - synack" 547 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinPortSynAckRx | 548 awk '{print $2}'` 549 [ -z "$count" ] && count=0 550 if [ "$count" != "$syn_ack_nr" ]; then 551 echo "[fail] got $count JOIN[s] synack with a different \ 552 port-number expected $syn_ack_nr" 553 ret=1 554 dump_stats=1 555 else 556 echo -n "[ ok ]" 557 fi 558 559 echo -n " - ack" 560 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortAckRx | 561 awk '{print $2}'` 562 [ -z "$count" ] && count=0 563 if [ "$count" != "$ack_nr" ]; then 564 echo "[fail] got $count JOIN[s] ack with a different \ 565 port-number expected $ack_nr" 566 ret=1 567 dump_stats=1 568 else 569 echo "[ ok ]" 570 fi 571 572 printf "%-39s %s" " " "syn" 573 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | 574 awk '{print $2}'` 575 [ -z "$count" ] && count=0 576 if [ "$count" != "$mis_syn_nr" ]; then 577 echo "[fail] got $count JOIN[s] syn with a mismatched \ 578 port-number expected $mis_syn_nr" 579 ret=1 580 dump_stats=1 581 else 582 echo -n "[ ok ]" 583 fi 584 585 echo -n " - ack " 586 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortAckRx | 587 awk '{print $2}'` 588 [ -z "$count" ] && count=0 589 if [ "$count" != "$mis_ack_nr" ]; then 590 echo "[fail] got $count JOIN[s] ack with a mismatched \ 591 port-number expected $mis_ack_nr" 592 ret=1 593 dump_stats=1 594 else 595 echo "[ ok ]" 596 fi 597 else 598 echo "" 599 fi 600 601 if [ "${dump_stats}" = 1 ]; then 602 echo Server ns stats 603 ip netns exec $ns1 nstat -as | grep MPTcp 604 echo Client ns stats 605 ip netns exec $ns2 nstat -as | grep MPTcp 606 fi 607} 608 609chk_rm_nr() 610{ 611 local rm_addr_nr=$1 612 local rm_subflow_nr=$2 613 local count 614 local dump_stats 615 616 printf "%-39s %s" " " "rm " 617 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` 618 [ -z "$count" ] && count=0 619 if [ "$count" != "$rm_addr_nr" ]; then 620 echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" 621 ret=1 622 dump_stats=1 623 else 624 echo -n "[ ok ]" 625 fi 626 627 echo -n " - sf " 628 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'` 629 [ -z "$count" ] && count=0 630 if [ "$count" != "$rm_subflow_nr" ]; then 631 echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" 632 ret=1 633 dump_stats=1 634 else 635 echo "[ ok ]" 636 fi 637 638 if [ "${dump_stats}" = 1 ]; then 639 echo Server ns stats 640 ip netns exec $ns1 nstat -as | grep MPTcp 641 echo Client ns stats 642 ip netns exec $ns2 nstat -as | grep MPTcp 643 fi 644} 645 646chk_prio_nr() 647{ 648 local mp_prio_nr_tx=$1 649 local mp_prio_nr_rx=$2 650 local count 651 local dump_stats 652 653 printf "%-39s %s" " " "ptx" 654 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}'` 655 [ -z "$count" ] && count=0 656 if [ "$count" != "$mp_prio_nr_tx" ]; then 657 echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx" 658 ret=1 659 dump_stats=1 660 else 661 echo -n "[ ok ]" 662 fi 663 664 echo -n " - prx " 665 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}'` 666 [ -z "$count" ] && count=0 667 if [ "$count" != "$mp_prio_nr_rx" ]; then 668 echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx" 669 ret=1 670 dump_stats=1 671 else 672 echo "[ ok ]" 673 fi 674 675 if [ "${dump_stats}" = 1 ]; then 676 echo Server ns stats 677 ip netns exec $ns1 nstat -as | grep MPTcp 678 echo Client ns stats 679 ip netns exec $ns2 nstat -as | grep MPTcp 680 fi 681} 682 683subflows_tests() 684{ 685 reset 686 run_tests $ns1 $ns2 10.0.1.1 687 chk_join_nr "no JOIN" "0" "0" "0" 688 689 # subflow limited by client 690 reset 691 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 692 run_tests $ns1 $ns2 10.0.1.1 693 chk_join_nr "single subflow, limited by client" 0 0 0 694 695 # subflow limited by server 696 reset 697 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 698 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 699 run_tests $ns1 $ns2 10.0.1.1 700 chk_join_nr "single subflow, limited by server" 1 1 0 701 702 # subflow 703 reset 704 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 705 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 706 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 707 run_tests $ns1 $ns2 10.0.1.1 708 chk_join_nr "single subflow" 1 1 1 709 710 # multiple subflows 711 reset 712 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 713 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 714 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 715 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 716 run_tests $ns1 $ns2 10.0.1.1 717 chk_join_nr "multiple subflows" 2 2 2 718 719 # multiple subflows limited by serverf 720 reset 721 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 722 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 723 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 724 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 725 run_tests $ns1 $ns2 10.0.1.1 726 chk_join_nr "multiple subflows, limited by server" 2 2 1 727} 728 729signal_address_tests() 730{ 731 # add_address, unused 732 reset 733 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 734 run_tests $ns1 $ns2 10.0.1.1 735 chk_join_nr "unused signal address" 0 0 0 736 chk_add_nr 1 1 737 738 # accept and use add_addr 739 reset 740 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 741 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 742 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 743 run_tests $ns1 $ns2 10.0.1.1 744 chk_join_nr "signal address" 1 1 1 745 chk_add_nr 1 1 746 747 # accept and use add_addr with an additional subflow 748 # note: signal address in server ns and local addresses in client ns must 749 # belong to different subnets or one of the listed local address could be 750 # used for 'add_addr' subflow 751 reset 752 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 753 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 754 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 755 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 756 run_tests $ns1 $ns2 10.0.1.1 757 chk_join_nr "subflow and signal" 2 2 2 758 chk_add_nr 1 1 759 760 # accept and use add_addr with additional subflows 761 reset 762 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 763 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 764 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 765 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 766 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 767 run_tests $ns1 $ns2 10.0.1.1 768 chk_join_nr "multiple subflows and signal" 3 3 3 769 chk_add_nr 1 1 770} 771 772link_failure_tests() 773{ 774 # accept and use add_addr with additional subflows and link loss 775 reset 776 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 777 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 778 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 779 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 780 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 781 run_tests $ns1 $ns2 10.0.1.1 1 782 chk_join_nr "multiple flows, signal, link failure" 3 3 3 783 chk_add_nr 1 1 784} 785 786add_addr_timeout_tests() 787{ 788 # add_addr timeout 789 reset_with_add_addr_timeout 790 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 791 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 792 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 793 run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow 794 chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1 795 chk_add_nr 4 0 796 797 # add_addr timeout IPv6 798 reset_with_add_addr_timeout 6 799 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 800 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 801 ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 802 run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 803 chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1 804 chk_add_nr 4 0 805} 806 807remove_tests() 808{ 809 # single subflow, remove 810 reset 811 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 812 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 813 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 814 run_tests $ns1 $ns2 10.0.1.1 0 0 -1 slow 815 chk_join_nr "remove single subflow" 1 1 1 816 chk_rm_nr 1 1 817 818 # multiple subflows, remove 819 reset 820 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 821 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 822 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 823 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 824 run_tests $ns1 $ns2 10.0.1.1 0 0 -2 slow 825 chk_join_nr "remove multiple subflows" 2 2 2 826 chk_rm_nr 2 2 827 828 # single address, remove 829 reset 830 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 831 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 832 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 833 run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow 834 chk_join_nr "remove single address" 1 1 1 835 chk_add_nr 1 1 836 chk_rm_nr 0 0 837 838 # subflow and signal, remove 839 reset 840 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 841 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 842 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 843 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 844 run_tests $ns1 $ns2 10.0.1.1 0 -1 -1 slow 845 chk_join_nr "remove subflow and signal" 2 2 2 846 chk_add_nr 1 1 847 chk_rm_nr 1 1 848 849 # subflows and signal, remove 850 reset 851 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 852 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 853 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 854 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 855 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 856 run_tests $ns1 $ns2 10.0.1.1 0 -1 -2 slow 857 chk_join_nr "remove subflows and signal" 3 3 3 858 chk_add_nr 1 1 859 chk_rm_nr 2 2 860 861 # subflows and signal, flush 862 reset 863 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 864 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 865 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 866 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 867 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 868 run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow 869 chk_join_nr "flush subflows and signal" 3 3 3 870 chk_add_nr 1 1 871 chk_rm_nr 2 2 872} 873 874add_tests() 875{ 876 # add single subflow 877 reset 878 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 879 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 880 run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow 881 chk_join_nr "add single subflow" 1 1 1 882 883 # add signal address 884 reset 885 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 886 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 887 run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow 888 chk_join_nr "add signal address" 1 1 1 889 chk_add_nr 1 1 890 891 # add multiple subflows 892 reset 893 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 894 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 895 run_tests $ns1 $ns2 10.0.1.1 0 0 2 slow 896 chk_join_nr "add multiple subflows" 2 2 2 897 898 # add multiple subflows IPv6 899 reset 900 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 901 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 902 run_tests $ns1 $ns2 dead:beef:1::1 0 0 2 slow 903 chk_join_nr "add multiple subflows IPv6" 2 2 2 904 905 # add multiple addresses IPv6 906 reset 907 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 908 ip netns exec $ns2 ./pm_nl_ctl limits 2 2 909 run_tests $ns1 $ns2 dead:beef:1::1 0 2 0 slow 910 chk_join_nr "add multiple addresses IPv6" 2 2 2 911 chk_add_nr 2 2 912} 913 914ipv6_tests() 915{ 916 # subflow IPv6 917 reset 918 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 919 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 920 ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow 921 run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 922 chk_join_nr "single subflow IPv6" 1 1 1 923 924 # add_address, unused IPv6 925 reset 926 ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 927 run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 928 chk_join_nr "unused signal address IPv6" 0 0 0 929 chk_add_nr 1 1 930 931 # signal address IPv6 932 reset 933 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 934 ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 935 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 936 run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 937 chk_join_nr "single address IPv6" 1 1 1 938 chk_add_nr 1 1 939 940 # single address IPv6, remove 941 reset 942 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 943 ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 944 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 945 run_tests $ns1 $ns2 dead:beef:1::1 0 -1 0 slow 946 chk_join_nr "remove single address IPv6" 1 1 1 947 chk_add_nr 1 1 948 chk_rm_nr 0 0 949 950 # subflow and signal IPv6, remove 951 reset 952 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 953 ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 954 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 955 ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow 956 run_tests $ns1 $ns2 dead:beef:1::1 0 -1 -1 slow 957 chk_join_nr "remove subflow and signal IPv6" 2 2 2 958 chk_add_nr 1 1 959 chk_rm_nr 1 1 960} 961 962v4mapped_tests() 963{ 964 # subflow IPv4-mapped to IPv4-mapped 965 reset 966 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 967 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 968 ip netns exec $ns2 ./pm_nl_ctl add "::ffff:10.0.3.2" flags subflow 969 run_tests $ns1 $ns2 "::ffff:10.0.1.1" 970 chk_join_nr "single subflow IPv4-mapped" 1 1 1 971 972 # signal address IPv4-mapped with IPv4-mapped sk 973 reset 974 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 975 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 976 ip netns exec $ns1 ./pm_nl_ctl add "::ffff:10.0.2.1" flags signal 977 run_tests $ns1 $ns2 "::ffff:10.0.1.1" 978 chk_join_nr "signal address IPv4-mapped" 1 1 1 979 chk_add_nr 1 1 980 981 # subflow v4-map-v6 982 reset 983 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 984 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 985 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 986 run_tests $ns1 $ns2 "::ffff:10.0.1.1" 987 chk_join_nr "single subflow v4-map-v6" 1 1 1 988 989 # signal address v4-map-v6 990 reset 991 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 992 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 993 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 994 run_tests $ns1 $ns2 "::ffff:10.0.1.1" 995 chk_join_nr "signal address v4-map-v6" 1 1 1 996 chk_add_nr 1 1 997 998 # subflow v6-map-v4 999 reset 1000 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1001 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1002 ip netns exec $ns2 ./pm_nl_ctl add "::ffff:10.0.3.2" flags subflow 1003 run_tests $ns1 $ns2 10.0.1.1 1004 chk_join_nr "single subflow v6-map-v4" 1 1 1 1005 1006 # signal address v6-map-v4 1007 reset 1008 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1009 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 1010 ip netns exec $ns1 ./pm_nl_ctl add "::ffff:10.0.2.1" flags signal 1011 run_tests $ns1 $ns2 10.0.1.1 1012 chk_join_nr "signal address v6-map-v4" 1 1 1 1013 chk_add_nr 1 1 1014 1015 # no subflow IPv6 to v4 address 1016 reset 1017 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1018 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1019 ip netns exec $ns2 ./pm_nl_ctl add dead:beef:2::2 flags subflow 1020 run_tests $ns1 $ns2 10.0.1.1 1021 chk_join_nr "no JOIN with diff families v4-v6" 0 0 0 1022 1023 # no subflow IPv6 to v4 address even if v6 has a valid v4 at the end 1024 reset 1025 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1026 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1027 ip netns exec $ns2 ./pm_nl_ctl add dead:beef:2::10.0.3.2 flags subflow 1028 run_tests $ns1 $ns2 10.0.1.1 1029 chk_join_nr "no JOIN with diff families v4-v6-2" 0 0 0 1030 1031 # no subflow IPv4 to v6 address, no need to slow down too then 1032 reset 1033 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1034 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1035 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1036 run_tests $ns1 $ns2 dead:beef:1::1 1037 chk_join_nr "no JOIN with diff families v6-v4" 0 0 0 1038} 1039 1040backup_tests() 1041{ 1042 # single subflow, backup 1043 reset 1044 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1045 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1046 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow,backup 1047 run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow nobackup 1048 chk_join_nr "single subflow, backup" 1 1 1 1049 chk_prio_nr 0 1 1050 1051 # single address, backup 1052 reset 1053 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1054 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 1055 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 1056 run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow backup 1057 chk_join_nr "single address, backup" 1 1 1 1058 chk_add_nr 1 1 1059 chk_prio_nr 1 0 1060} 1061 1062add_addr_ports_tests() 1063{ 1064 # signal address with port 1065 reset 1066 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1067 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 1068 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1069 run_tests $ns1 $ns2 10.0.1.1 1070 chk_join_nr "signal address with port" 1 1 1 1071 chk_add_nr 1 1 1 1072 1073 # subflow and signal with port 1074 reset 1075 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1076 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 1077 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 1078 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1079 run_tests $ns1 $ns2 10.0.1.1 1080 chk_join_nr "subflow and signal with port" 2 2 2 1081 chk_add_nr 1 1 1 1082 1083 # single address with port, remove 1084 reset 1085 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1086 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1087 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 1088 run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow 1089 chk_join_nr "remove single address with port" 1 1 1 1090 chk_add_nr 1 1 1 1091 chk_rm_nr 0 0 1092 1093 # subflow and signal with port, remove 1094 reset 1095 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 1096 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1097 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 1098 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1099 run_tests $ns1 $ns2 10.0.1.1 0 -1 -1 slow 1100 chk_join_nr "remove subflow and signal with port" 2 2 2 1101 chk_add_nr 1 1 1 1102 chk_rm_nr 1 1 1103 1104 # subflows and signal with port, flush 1105 reset 1106 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 1107 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1108 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 1109 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1110 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 1111 run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow 1112 chk_join_nr "flush subflows and signal with port" 3 3 3 1113 chk_add_nr 1 1 1114 chk_rm_nr 2 2 1115 1116 # multiple addresses with port 1117 reset 1118 ip netns exec $ns1 ./pm_nl_ctl limits 2 2 1119 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1120 ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal port 10100 1121 ip netns exec $ns2 ./pm_nl_ctl limits 2 2 1122 run_tests $ns1 $ns2 10.0.1.1 1123 chk_join_nr "multiple addresses with port" 2 2 2 1124 chk_add_nr 2 2 2 1125 1126 # multiple addresses with ports 1127 reset 1128 ip netns exec $ns1 ./pm_nl_ctl limits 2 2 1129 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 1130 ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal port 10101 1131 ip netns exec $ns2 ./pm_nl_ctl limits 2 2 1132 run_tests $ns1 $ns2 10.0.1.1 1133 chk_join_nr "multiple addresses with ports" 2 2 2 1134 chk_add_nr 2 2 2 1135} 1136 1137syncookies_tests() 1138{ 1139 # single subflow, syncookies 1140 reset_with_cookies 1141 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1142 ip netns exec $ns2 ./pm_nl_ctl limits 0 1 1143 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1144 run_tests $ns1 $ns2 10.0.1.1 1145 chk_join_nr "single subflow with syn cookies" 1 1 1 1146 1147 # multiple subflows with syn cookies 1148 reset_with_cookies 1149 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 1150 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 1151 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1152 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 1153 run_tests $ns1 $ns2 10.0.1.1 1154 chk_join_nr "multiple subflows with syn cookies" 2 2 2 1155 1156 # multiple subflows limited by server 1157 reset_with_cookies 1158 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1159 ip netns exec $ns2 ./pm_nl_ctl limits 0 2 1160 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1161 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 1162 run_tests $ns1 $ns2 10.0.1.1 1163 chk_join_nr "subflows limited by server w cookies" 2 2 1 1164 1165 # test signal address with cookies 1166 reset_with_cookies 1167 ip netns exec $ns1 ./pm_nl_ctl limits 0 1 1168 ip netns exec $ns2 ./pm_nl_ctl limits 1 1 1169 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 1170 run_tests $ns1 $ns2 10.0.1.1 1171 chk_join_nr "signal address with syn cookies" 1 1 1 1172 chk_add_nr 1 1 1173 1174 # test cookie with subflow and signal 1175 reset_with_cookies 1176 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 1177 ip netns exec $ns1 ./pm_nl_ctl limits 0 2 1178 ip netns exec $ns2 ./pm_nl_ctl limits 1 2 1179 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1180 run_tests $ns1 $ns2 10.0.1.1 1181 chk_join_nr "subflow and signal w cookies" 2 2 2 1182 chk_add_nr 1 1 1183 1184 # accept and use add_addr with additional subflows 1185 reset_with_cookies 1186 ip netns exec $ns1 ./pm_nl_ctl limits 0 3 1187 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 1188 ip netns exec $ns2 ./pm_nl_ctl limits 1 3 1189 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 1190 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 1191 run_tests $ns1 $ns2 10.0.1.1 1192 chk_join_nr "subflows and signal w. cookies" 3 3 3 1193 chk_add_nr 1 1 1194} 1195 1196all_tests() 1197{ 1198 subflows_tests 1199 signal_address_tests 1200 link_failure_tests 1201 add_addr_timeout_tests 1202 remove_tests 1203 add_tests 1204 ipv6_tests 1205 v4mapped_tests 1206 backup_tests 1207 add_addr_ports_tests 1208 syncookies_tests 1209} 1210 1211usage() 1212{ 1213 echo "mptcp_join usage:" 1214 echo " -f subflows_tests" 1215 echo " -s signal_address_tests" 1216 echo " -l link_failure_tests" 1217 echo " -t add_addr_timeout_tests" 1218 echo " -r remove_tests" 1219 echo " -a add_tests" 1220 echo " -6 ipv6_tests" 1221 echo " -4 v4mapped_tests" 1222 echo " -b backup_tests" 1223 echo " -p add_addr_ports_tests" 1224 echo " -c syncookies_tests" 1225 echo " -h help" 1226} 1227 1228sin=$(mktemp) 1229sout=$(mktemp) 1230cin=$(mktemp) 1231cinsent=$(mktemp) 1232cout=$(mktemp) 1233init 1234make_file "$cin" "client" 1 1235make_file "$sin" "server" 1 1236trap cleanup EXIT 1237 1238if [ -z $1 ]; then 1239 all_tests 1240 exit $ret 1241fi 1242 1243while getopts 'fsltra64bpch' opt; do 1244 case $opt in 1245 f) 1246 subflows_tests 1247 ;; 1248 s) 1249 signal_address_tests 1250 ;; 1251 l) 1252 link_failure_tests 1253 ;; 1254 t) 1255 add_addr_timeout_tests 1256 ;; 1257 r) 1258 remove_tests 1259 ;; 1260 a) 1261 add_tests 1262 ;; 1263 6) 1264 ipv6_tests 1265 ;; 1266 4) 1267 v4mapped_tests 1268 ;; 1269 b) 1270 backup_tests 1271 ;; 1272 p) 1273 add_addr_ports_tests 1274 ;; 1275 c) 1276 syncookies_tests 1277 ;; 1278 h | *) 1279 usage 1280 ;; 1281 esac 1282done 1283 1284exit $ret 1285