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 rm_nr_ns1="$7" 213 rm_nr_ns2="$8" 214 speed="$9" 215 216 port=$((10000+$TEST_COUNT)) 217 TEST_COUNT=$((TEST_COUNT+1)) 218 219 :> "$cout" 220 :> "$sout" 221 :> "$capout" 222 223 if [ $capture -eq 1 ]; then 224 if [ -z $SUDO_USER ] ; then 225 capuser="" 226 else 227 capuser="-Z $SUDO_USER" 228 fi 229 230 capfile=$(printf "mp_join-%02u-%s.pcap" "$TEST_COUNT" "${listener_ns}") 231 232 echo "Capturing traffic for test $TEST_COUNT into $capfile" 233 ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 & 234 cappid=$! 235 236 sleep 1 237 fi 238 239 if [ $speed = "fast" ]; then 240 mptcp_connect="./mptcp_connect -j" 241 else 242 mptcp_connect="./mptcp_connect -r" 243 fi 244 245 local local_addr 246 if is_v6 "${connect_addr}"; then 247 local_addr="::" 248 else 249 local_addr="0.0.0.0" 250 fi 251 252 ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port \ 253 -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & 254 spid=$! 255 256 sleep 1 257 258 if [ "$test_link_fail" -eq 0 ];then 259 ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" & 260 else 261 ( cat "$cin" ; sleep 2; link_failure $listener_ns ; cat "$cin" ) | tee "$cinsent" | \ 262 ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr > "$cout" & 263 fi 264 cpid=$! 265 266 if [ $rm_nr_ns1 -gt 0 ]; then 267 counter=1 268 sleep 1 269 270 while [ $counter -le $rm_nr_ns1 ] 271 do 272 ip netns exec ${listener_ns} ./pm_nl_ctl del $counter 273 sleep 1 274 let counter+=1 275 done 276 fi 277 278 if [ $rm_nr_ns2 -gt 0 ]; then 279 counter=1 280 sleep 1 281 282 while [ $counter -le $rm_nr_ns2 ] 283 do 284 ip netns exec ${connector_ns} ./pm_nl_ctl del $counter 285 sleep 1 286 let counter+=1 287 done 288 fi 289 290 wait $cpid 291 retc=$? 292 wait $spid 293 rets=$? 294 295 if [ $capture -eq 1 ]; then 296 sleep 1 297 kill $cappid 298 fi 299 300 if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then 301 echo " client exit code $retc, server $rets" 1>&2 302 echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2 303 ip netns exec ${listener_ns} ss -nita 1>&2 -o "sport = :$port" 304 echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2 305 ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port" 306 307 cat "$capout" 308 ret=1 309 return 1 310 fi 311 312 check_transfer $sin $cout "file received by client" 313 retc=$? 314 if [ "$test_link_fail" -eq 0 ];then 315 check_transfer $cin $sout "file received by server" 316 else 317 check_transfer $cinsent $sout "file received by server" 318 fi 319 rets=$? 320 321 if [ $retc -eq 0 ] && [ $rets -eq 0 ];then 322 cat "$capout" 323 return 0 324 fi 325 326 cat "$capout" 327 return 1 328} 329 330make_file() 331{ 332 name=$1 333 who=$2 334 size=$3 335 336 dd if=/dev/urandom of="$name" bs=1024 count=$size 2> /dev/null 337 echo -e "\nMPTCP_TEST_FILE_END_MARKER" >> "$name" 338 339 echo "Created $name (size $size KB) containing data sent by $who" 340} 341 342run_tests() 343{ 344 listener_ns="$1" 345 connector_ns="$2" 346 connect_addr="$3" 347 test_linkfail="${4:-0}" 348 rm_nr_ns1="${5:-0}" 349 rm_nr_ns2="${6:-0}" 350 speed="${7:-fast}" 351 lret=0 352 oldin="" 353 354 if [ "$test_linkfail" -eq 1 ];then 355 size=$((RANDOM%1024)) 356 size=$((size+1)) 357 size=$((size*128)) 358 359 oldin=$(mktemp) 360 cp "$cin" "$oldin" 361 make_file "$cin" "client" $size 362 fi 363 364 do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ 365 ${test_linkfail} ${rm_nr_ns1} ${rm_nr_ns2} ${speed} 366 lret=$? 367 368 if [ "$test_linkfail" -eq 1 ];then 369 cp "$oldin" "$cin" 370 rm -f "$oldin" 371 fi 372 373 if [ $lret -ne 0 ]; then 374 ret=$lret 375 return 376 fi 377} 378 379chk_join_nr() 380{ 381 local msg="$1" 382 local syn_nr=$2 383 local syn_ack_nr=$3 384 local ack_nr=$4 385 local count 386 local dump_stats 387 388 printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" 389 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` 390 [ -z "$count" ] && count=0 391 if [ "$count" != "$syn_nr" ]; then 392 echo "[fail] got $count JOIN[s] syn expected $syn_nr" 393 ret=1 394 dump_stats=1 395 else 396 echo -n "[ ok ]" 397 fi 398 399 echo -n " - synack" 400 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk '{print $2}'` 401 [ -z "$count" ] && count=0 402 if [ "$count" != "$syn_ack_nr" ]; then 403 echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" 404 ret=1 405 dump_stats=1 406 else 407 echo -n "[ ok ]" 408 fi 409 410 echo -n " - ack" 411 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '{print $2}'` 412 [ -z "$count" ] && count=0 413 if [ "$count" != "$ack_nr" ]; then 414 echo "[fail] got $count JOIN[s] ack expected $ack_nr" 415 ret=1 416 dump_stats=1 417 else 418 echo "[ ok ]" 419 fi 420 if [ "${dump_stats}" = 1 ]; then 421 echo Server ns stats 422 ip netns exec $ns1 nstat -as | grep MPTcp 423 echo Client ns stats 424 ip netns exec $ns2 nstat -as | grep MPTcp 425 fi 426} 427 428chk_add_nr() 429{ 430 local add_nr=$1 431 local echo_nr=$2 432 local count 433 local dump_stats 434 435 printf "%-39s %s" " " "add" 436 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` 437 [ -z "$count" ] && count=0 438 if [ "$count" != "$add_nr" ]; then 439 echo "[fail] got $count ADD_ADDR[s] expected $add_nr" 440 ret=1 441 dump_stats=1 442 else 443 echo -n "[ ok ]" 444 fi 445 446 echo -n " - echo " 447 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{print $2}'` 448 [ -z "$count" ] && count=0 449 if [ "$count" != "$echo_nr" ]; then 450 echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" 451 ret=1 452 dump_stats=1 453 else 454 echo "[ ok ]" 455 fi 456 457 if [ "${dump_stats}" = 1 ]; then 458 echo Server ns stats 459 ip netns exec $ns1 nstat -as | grep MPTcp 460 echo Client ns stats 461 ip netns exec $ns2 nstat -as | grep MPTcp 462 fi 463} 464 465chk_rm_nr() 466{ 467 local rm_addr_nr=$1 468 local rm_subflow_nr=$2 469 local count 470 local dump_stats 471 472 printf "%-39s %s" " " "rm " 473 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` 474 [ -z "$count" ] && count=0 475 if [ "$count" != "$rm_addr_nr" ]; then 476 echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" 477 ret=1 478 dump_stats=1 479 else 480 echo -n "[ ok ]" 481 fi 482 483 echo -n " - sf " 484 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'` 485 [ -z "$count" ] && count=0 486 if [ "$count" != "$rm_subflow_nr" ]; then 487 echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" 488 ret=1 489 dump_stats=1 490 else 491 echo "[ ok ]" 492 fi 493 494 if [ "${dump_stats}" = 1 ]; then 495 echo Server ns stats 496 ip netns exec $ns1 nstat -as | grep MPTcp 497 echo Client ns stats 498 ip netns exec $ns2 nstat -as | grep MPTcp 499 fi 500} 501 502sin=$(mktemp) 503sout=$(mktemp) 504cin=$(mktemp) 505cinsent=$(mktemp) 506cout=$(mktemp) 507init 508make_file "$cin" "client" 1 509make_file "$sin" "server" 1 510trap cleanup EXIT 511 512run_tests $ns1 $ns2 10.0.1.1 513chk_join_nr "no JOIN" "0" "0" "0" 514 515# subflow limted by client 516reset 517ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 518run_tests $ns1 $ns2 10.0.1.1 519chk_join_nr "single subflow, limited by client" 0 0 0 520 521# subflow limted by server 522reset 523ip netns exec $ns2 ./pm_nl_ctl limits 0 1 524ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 525run_tests $ns1 $ns2 10.0.1.1 526chk_join_nr "single subflow, limited by server" 1 1 0 527 528# subflow 529reset 530ip netns exec $ns1 ./pm_nl_ctl limits 0 1 531ip netns exec $ns2 ./pm_nl_ctl limits 0 1 532ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 533run_tests $ns1 $ns2 10.0.1.1 534chk_join_nr "single subflow" 1 1 1 535 536# multiple subflows 537reset 538ip netns exec $ns1 ./pm_nl_ctl limits 0 2 539ip netns exec $ns2 ./pm_nl_ctl limits 0 2 540ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 541ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 542run_tests $ns1 $ns2 10.0.1.1 543chk_join_nr "multiple subflows" 2 2 2 544 545# multiple subflows limited by serverf 546reset 547ip netns exec $ns1 ./pm_nl_ctl limits 0 1 548ip netns exec $ns2 ./pm_nl_ctl limits 0 2 549ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 550ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 551run_tests $ns1 $ns2 10.0.1.1 552chk_join_nr "multiple subflows, limited by server" 2 2 1 553 554# add_address, unused 555reset 556ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 557run_tests $ns1 $ns2 10.0.1.1 558chk_join_nr "unused signal address" 0 0 0 559chk_add_nr 1 1 560 561# accept and use add_addr 562reset 563ip netns exec $ns1 ./pm_nl_ctl limits 0 1 564ip netns exec $ns2 ./pm_nl_ctl limits 1 1 565ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 566run_tests $ns1 $ns2 10.0.1.1 567chk_join_nr "signal address" 1 1 1 568chk_add_nr 1 1 569 570# accept and use add_addr with an additional subflow 571# note: signal address in server ns and local addresses in client ns must 572# belong to different subnets or one of the listed local address could be 573# used for 'add_addr' subflow 574reset 575ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 576ip netns exec $ns1 ./pm_nl_ctl limits 0 2 577ip netns exec $ns2 ./pm_nl_ctl limits 1 2 578ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 579run_tests $ns1 $ns2 10.0.1.1 580chk_join_nr "subflow and signal" 2 2 2 581chk_add_nr 1 1 582 583# accept and use add_addr with additional subflows 584reset 585ip netns exec $ns1 ./pm_nl_ctl limits 0 3 586ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 587ip netns exec $ns2 ./pm_nl_ctl limits 1 3 588ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 589ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 590run_tests $ns1 $ns2 10.0.1.1 591chk_join_nr "multiple subflows and signal" 3 3 3 592chk_add_nr 1 1 593 594# accept and use add_addr with additional subflows and link loss 595reset 596ip netns exec $ns1 ./pm_nl_ctl limits 0 3 597ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 598ip netns exec $ns2 ./pm_nl_ctl limits 1 3 599ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 600ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 601run_tests $ns1 $ns2 10.0.1.1 1 602chk_join_nr "multiple flows, signal, link failure" 3 3 3 603chk_add_nr 1 1 604 605# add_addr timeout 606reset_with_add_addr_timeout 607ip netns exec $ns1 ./pm_nl_ctl limits 0 1 608ip netns exec $ns2 ./pm_nl_ctl limits 1 1 609ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 610run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow 611chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1 612chk_add_nr 4 0 613 614# single subflow, remove 615reset 616ip netns exec $ns1 ./pm_nl_ctl limits 0 1 617ip netns exec $ns2 ./pm_nl_ctl limits 0 1 618ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 619run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow 620chk_join_nr "remove single subflow" 1 1 1 621chk_rm_nr 1 1 622 623# multiple subflows, remove 624reset 625ip netns exec $ns1 ./pm_nl_ctl limits 0 2 626ip netns exec $ns2 ./pm_nl_ctl limits 0 2 627ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 628ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 629run_tests $ns1 $ns2 10.0.1.1 0 0 2 slow 630chk_join_nr "remove multiple subflows" 2 2 2 631chk_rm_nr 2 2 632 633# single address, remove 634reset 635ip netns exec $ns1 ./pm_nl_ctl limits 0 1 636ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 637ip netns exec $ns2 ./pm_nl_ctl limits 1 1 638run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow 639chk_join_nr "remove single address" 1 1 1 640chk_add_nr 1 1 641chk_rm_nr 0 0 642 643# subflow and signal, remove 644reset 645ip netns exec $ns1 ./pm_nl_ctl limits 0 2 646ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 647ip netns exec $ns2 ./pm_nl_ctl limits 1 2 648ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 649run_tests $ns1 $ns2 10.0.1.1 0 1 1 slow 650chk_join_nr "remove subflow and signal" 2 2 2 651chk_add_nr 1 1 652chk_rm_nr 1 1 653 654# subflows and signal, remove 655reset 656ip netns exec $ns1 ./pm_nl_ctl limits 0 3 657ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 658ip netns exec $ns2 ./pm_nl_ctl limits 1 3 659ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 660ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 661run_tests $ns1 $ns2 10.0.1.1 0 1 2 slow 662chk_join_nr "remove subflows and signal" 3 3 3 663chk_add_nr 1 1 664chk_rm_nr 2 2 665 666# subflow IPv6 667reset 668ip netns exec $ns1 ./pm_nl_ctl limits 0 1 669ip netns exec $ns2 ./pm_nl_ctl limits 0 1 670ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow 671run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 672chk_join_nr "single subflow IPv6" 1 1 1 673 674# add_address, unused IPv6 675reset 676ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 677run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 678chk_join_nr "unused signal address IPv6" 0 0 0 679chk_add_nr 1 1 680 681# signal address IPv6 682reset 683ip netns exec $ns1 ./pm_nl_ctl limits 0 1 684ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 685ip netns exec $ns2 ./pm_nl_ctl limits 1 1 686run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 687chk_join_nr "single address IPv6" 1 1 1 688chk_add_nr 1 1 689 690# add_addr timeout IPv6 691reset_with_add_addr_timeout 6 692ip netns exec $ns1 ./pm_nl_ctl limits 0 1 693ip netns exec $ns2 ./pm_nl_ctl limits 1 1 694ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 695run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow 696chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1 697chk_add_nr 4 0 698 699# single address IPv6, remove 700reset 701ip netns exec $ns1 ./pm_nl_ctl limits 0 1 702ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 703ip netns exec $ns2 ./pm_nl_ctl limits 1 1 704run_tests $ns1 $ns2 dead:beef:1::1 0 1 0 slow 705chk_join_nr "remove single address IPv6" 1 1 1 706chk_add_nr 1 1 707chk_rm_nr 0 0 708 709# subflow and signal IPv6, remove 710reset 711ip netns exec $ns1 ./pm_nl_ctl limits 0 2 712ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal 713ip netns exec $ns2 ./pm_nl_ctl limits 1 2 714ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow 715run_tests $ns1 $ns2 dead:beef:1::1 0 1 1 slow 716chk_join_nr "remove subflow and signal IPv6" 2 2 2 717chk_add_nr 1 1 718chk_rm_nr 1 1 719 720# single subflow, syncookies 721reset_with_cookies 722ip netns exec $ns1 ./pm_nl_ctl limits 0 1 723ip netns exec $ns2 ./pm_nl_ctl limits 0 1 724ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 725run_tests $ns1 $ns2 10.0.1.1 726chk_join_nr "single subflow with syn cookies" 1 1 1 727 728# multiple subflows with syn cookies 729reset_with_cookies 730ip netns exec $ns1 ./pm_nl_ctl limits 0 2 731ip netns exec $ns2 ./pm_nl_ctl limits 0 2 732ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 733ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 734run_tests $ns1 $ns2 10.0.1.1 735chk_join_nr "multiple subflows with syn cookies" 2 2 2 736 737# multiple subflows limited by server 738reset_with_cookies 739ip netns exec $ns1 ./pm_nl_ctl limits 0 1 740ip netns exec $ns2 ./pm_nl_ctl limits 0 2 741ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 742ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow 743run_tests $ns1 $ns2 10.0.1.1 744chk_join_nr "subflows limited by server w cookies" 2 2 1 745 746# test signal address with cookies 747reset_with_cookies 748ip netns exec $ns1 ./pm_nl_ctl limits 0 1 749ip netns exec $ns2 ./pm_nl_ctl limits 1 1 750ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 751run_tests $ns1 $ns2 10.0.1.1 752chk_join_nr "signal address with syn cookies" 1 1 1 753chk_add_nr 1 1 754 755# test cookie with subflow and signal 756reset_with_cookies 757ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 758ip netns exec $ns1 ./pm_nl_ctl limits 0 2 759ip netns exec $ns2 ./pm_nl_ctl limits 1 2 760ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 761run_tests $ns1 $ns2 10.0.1.1 762chk_join_nr "subflow and signal w cookies" 2 2 2 763chk_add_nr 1 1 764 765# accept and use add_addr with additional subflows 766reset_with_cookies 767ip netns exec $ns1 ./pm_nl_ctl limits 0 3 768ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal 769ip netns exec $ns2 ./pm_nl_ctl limits 1 3 770ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow 771ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow 772run_tests $ns1 $ns2 10.0.1.1 773chk_join_nr "subflows and signal w. cookies" 3 3 3 774chk_add_nr 1 1 775 776exit $ret 777