1#!/bin/sh 2#- 3# Copyright (c) 2012 Cisco Systems, Inc. 4# All rights reserved. 5# 6# This software was developed by Bjoern Zeeb under contract to 7# Cisco Systems, Inc.. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28# SUCH DAMAGE. 29# 30# 31 32# We will use the RFC5180 (and Errata) benchmarking working group prefix 33# 2001:0002::/48 for testing. 34PREFIX="2001:2:" 35 36# Set IFACE to the real interface you want to run the test on. 37: ${IFACE:=lo0} 38 39# Number of seconds to wait for peer node to synchronize for test. 40: ${WAITS:=120} 41 42# Control port we use to exchange messages between nodes to sync. tests, etc. 43: ${CTRLPORT:=6666} 44 45# Get the number of FIBs from the kernel. 46RT_NUMFIBS=`sysctl -n net.fibs` 47 48OURADDR="2001:2:ff00::1" 49PEERADDR="2001:2:ff00::2" 50PEERLINKLOCAL="" 51 52# By default all commands must succeed. Individual tests may disable this 53# temporary. 54set -e 55 56# Debug magic. 57case "${DEBUG}" in 5842) set -x ;; 59esac 60 61 62 63# 64# Helper functions. 65# 66check_rc() 67{ 68 local _rc _exp _testno _testname _msg _r 69 _rc=$1 70 _exp=$2 71 _testno=$3 72 _testname="$4" 73 _msg="$5" 74 75 _r="not ok" 76 if test ${_rc} -eq ${_exp}; then 77 _r="ok" 78 fi 79 echo "${_r} ${_testno} ${_testname} # ${_msg} ${_rc} ${_exp}" 80} 81 82print_debug() 83{ 84 local _msg 85 _msg="$*" 86 87 case ${DEBUG} in 88 ''|0) ;; 89 *) echo "DEBUG: ${_msg}" >&2 ;; 90 esac 91} 92 93die() 94{ 95 local _msg 96 _msg="$*" 97 98 echo "ERROR: ${_msg}" >&2 99 exit 1 100} 101 102# 103# Test functions. 104# 105 106# Make sure the local link-local and global addresses are reachable 107# from all FIBs. 108check_local_addr() 109{ 110 local _l i testno 111 112 print_debug "Setting up interface ${IFACE}" 113 ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up 114 _l=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'` 115 116 # Let things settle. 117 print_debug "Waiting 4 seconds for things to settle" 118 sleep 4 119 120 printf "1..%d\n" `expr 2 \* ${RT_NUMFIBS}` 121 testno=1 122 i=0 123 set +e 124 while test ${i} -lt ${RT_NUMFIBS}; do 125 print_debug "Testing FIB ${i}" 126 127 setfib -F${i} ping6 -n -c1 ${_l} > /dev/null 2>&1 128 check_rc $? 0 ${testno} "check_local_addr_${i}_l" \ 129 "FIB ${i} ${_l}" 130 testno=$((testno + 1)) 131 132 setfib -F${i} ping6 -n -c1 ${OURADDR} > /dev/null 2>&1 133 check_rc $? 0 ${testno} "check_local_addr_${i}_a" \ 134 "FIB ${i} ${OURADDR}" 135 testno=$((testno + 1)) 136 137 i=$((i + 1)) 138 done 139 set -e 140 ifconfig ${IFACE} inet6 ${OURADDR}/64 -alias 141} 142 143 144# Cloned tun(4) devices behave differently on FIB 0 vs. FIB 1..n after creation 145# (they also do in IPv4). 146check_local_tun() 147{ 148 local _l i testno IFACE _msg 149 150 IFACE=tun42 151 print_debug "Setting up interface ${IFACE}" 152 ifconfig ${IFACE} create 153 ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up 154 _l=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'` 155 156 # Let things settle. 157 print_debug "Waiting 4 seconds for things to settle" 158 sleep 4 159 160 printf "1..%d\n" `expr 2 \* ${RT_NUMFIBS}` 161 testno=1 162 _msg="" 163 i=0 164 set +e 165 while test ${i} -lt ${RT_NUMFIBS}; do 166 print_debug "Testing FIB ${i}" 167 if test ${i} -gt 0; then 168 # Flag the well known behaviour as such. 169 _msg="TODO " 170 fi 171 172 setfib -F${i} ping6 -n -c1 ${_l} > /dev/null 2>&1 173 check_rc $? 0 ${testno} "check_local_addr_${i}_l" \ 174 "${_msg}FIB ${i} ${_l}" 175 testno=$((testno + 1)) 176 177 setfib -F${i} ping6 -n -c1 ${OURADDR} > /dev/null 2>&1 178 check_rc $? 0 ${testno} "check_local_addr_${i}_a" \ 179 "${_msg}FIB ${i} ${OURADDR}" 180 testno=$((testno + 1)) 181 182 i=$((i + 1)) 183 done 184 set -e 185 ifconfig ${IFACE} inet6 ${OURADDR}/64 -alias 186 ifconfig ${IFACE} destroy 187} 188 189check_remote_up() 190{ 191 local _l i testno 192 193 print_debug "Setting up interface ${IFACE}" 194 ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up 195 _l=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'` 196 197 # Let things settle. 198 print_debug "Waiting 4 seconds for things to settle" 199 sleep 4 200 201 202 203} 204 205send_greeting() 206{ 207 local _l _greeting _keyword _fib _fibs _linklocal 208 209 print_debug "Setting up interface ${IFACE}" 210 ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up 211 _l=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'` 212 213 # Let things settle. 214 print_debug "Waiting 4 seconds for things to settle" 215 sleep 4 216 217 # Cleanup firewall and install rules to always allow NS/NA to succeed. 218 # The latter is needed to allow indvidiual less specific later rules 219 # from test cases to just disallow any IPv6 traffic on a matching FIB. 220 ipfw -f flush > /dev/null 2>&1 221 ipfw add 65000 permit ip from any to any > /dev/null 2>&1 222 ipfw add 5 permit ipv6-icmp from any to any icmp6types 135,136 fib 0 \ 223 via ${IFACE} out > /dev/null 2>&1 224 225 set +e 226 i=0 227 rc=-1 228 while test ${i} -lt ${WAITS} -a ${rc} -ne 0; do 229 print_debug "Sending greeting #${i} to peer" 230 _greeting=`echo "SETUP ${RT_NUMFIBS} ${_l}" | \ 231 nc -6 -w 1 ${PEERADDR} ${CTRLPORT}` 232 rc=$? 233 i=$((i + 1)) 234 # Might sleep longer in total but better than to DoS 235 # and not get anywhere. 236 sleep 1 237 done 238 set -e 239 240 read _keyword _fibs _linklocal <<EOI 241${_greeting} 242EOI 243 print_debug "_keyword=${_keyword}" 244 print_debug "_fibs=${_fibs}" 245 print_debug "_linklocal=${_linklocal}" 246 case ${_keyword} in 247 SETUP) ;; 248 *) die "Got invalid keyword in greeting: ${_greeting}" 249 ;; 250 esac 251 if test ${_fibs} -ne ${RT_NUMFIBS}; then 252 die "Number of FIBs not matching ours (${RT_NUMFIBS}) in" \ 253 "greeting: ${_greeting}" 254 fi 255 PEERLINKLOCAL=${_linklocal} 256 257 # Swap the zoneid to the local interface scope. 258 PEERLINKLOCAL=${PEERLINKLOCAL%%\%*}"%${IFACE}" 259 260 print_debug "Successfully exchanged greeting. Peer at ${PEERLINKLOCAL}" 261} 262 263cleanup() 264{ 265 266 # Cleanup ipfw. 267 ipfw delete 5 > /dev/null 2>&1 268 269 print_debug "Removing address from interface ${IFACE}" 270 ifconfig ${IFACE} inet6 ${OURADDR}/64 -alias 271} 272 273testtx_icmp6() 274{ 275 local _n _transfer i testno _txt _fibtxt _rc _ec _p 276 _n="$1" 277 _transfer=$2 278 279 printf "1..%d\n" `expr 2 \* ${RT_NUMFIBS}` 280 testno=1 281 set +e 282 i=0 283 while test ${i} -lt ${RT_NUMFIBS}; do 284 _txt="${_n}${i}" 285 print_debug "Testing ${_txt}" 286 _fibtxt=`echo "${_txt}" | hd -v | cut -b11-60 | tr -d ' \r\n'` 287 288 eval _rc="\${rc_${i}_l}" 289 setfib -F${i} ping6 -n -c1 -p ${_fibtxt} \ 290 ${PEERLINKLOCAL} > /dev/null 2>&1 291 _ec=$? 292 # We need to normalize the exit code of ping6. 293 case ${_ec} in 294 0) ;; 295 *) _ec=1 ;; 296 esac 297 check_rc ${_ec} ${_rc} ${testno} "${_txt}_l" \ 298 "FIB ${i} ${PEERLINKLOCAL}" 299 testno=$((testno + 1)) 300 301 # If doing multiple transfer networks, replace PEERADDR. 302 _p="${PEERADDR}" 303 case ${_transfer} in 304 1) PEERADDR=2001:2:${i}::2 ;; 305 esac 306 307 eval _rc="\${rc_${i}_a}" 308 setfib -F${i} ping6 -n -c1 -p ${_fibtxt} ${PEERADDR} \ 309 > /dev/null 2>&1 310 _ec=$? 311 # We need to normalize the exit code of ping6. 312 case ${_ec} in 313 0) ;; 314 *) _ec=1 ;; 315 esac 316 check_rc ${_ec} ${_rc} ${testno} "${_txt}_a" \ 317 "FIB ${i} ${PEERADDR}" 318 testno=$((testno + 1)) 319 320 # Restore PEERADDR. 321 PEERADDR="${_p}" 322 323 i=$((i + 1)) 324 done 325 set -e 326} 327 328nc_send_recv() 329{ 330 local _fib _loops _msg _expreply _addr _port _opts i 331 _fib=$1 332 _loops=$2 333 _msg="$3" 334 _expreply="$4" 335 _addr=$5 336 _port=$6 337 _opts="$7" 338 339 i=0 340 while test ${i} -lt ${_loops}; do 341 i=$((i + 1)) 342 case "${USE_SOSETFIB}" in 343 1) 344 _reply=`echo "${_msg}" | \ 345 nc -V ${_fib} ${_opts} ${_addr} ${_port}` 346 ;; 347 *) 348 _reply=`echo "${_msg}" | \ 349 setfib -F${_fib} nc ${_opts} ${_addr} ${_port}` 350 ;; 351 esac 352 if test "${_reply}" != "${_expreply}"; then 353 if test ${i} -lt ${_loops}; then 354 sleep 1 355 else 356 # Must let caller decide how to handle the error. 357 # die "Got invalid reply from peer." \ 358 # "Expected '${_expreply}', got '${_reply}'" 359 return 1 360 fi 361 else 362 break 363 fi 364 done 365 return 0 366} 367 368testtx_tcp_udp() 369{ 370 local _n _o _f testno i _fibtxt 371 _n="$1" 372 _o="$2" 373 _f="$3" 374 375 printf "1..%d\n" `expr 2 \* ${RT_NUMFIBS}` 376 testno=1 377 i=0 378 while test ${i} -lt ${RT_NUMFIBS}; do 379 print_debug "Testing ${_f} ${i}" 380 381 eval _rc="\${rc_${i}_l}" 382 _fibtxt="${_n}_${i}_l ${_f} ${i} ${PEERLINKLOCAL}" 383 nc_send_recv ${i} 1 "${_fibtxt}" "${_fibtxt}" ${PEERLINKLOCAL} \ 384 ${CTRLPORT} "-6 ${_o} -w1" 385 check_rc $? ${_rc} ${testno} "${_fibtxt}" 386 testno=$((testno + 1)) 387 388 eval _rc="\${rc_${i}_a}" 389 _fibtxt="${_n}_${i}_a ${_f} ${i} ${PEERADDR}" 390 nc_send_recv ${i} 1 "${_fibtxt}" "${_fibtxt}" ${PEERADDR} \ 391 ${CTRLPORT} "-6 ${_o} -w1" 392 check_rc $? ${_rc} ${testno} "${_fibtxt}" 393 testno=$((testno + 1)) 394 395 i=$((i + 1)) 396 done 397} 398 399# setfib TCP|UDP/IPv6 test on link-local and global address of peer from all FIBs. 400testtx_ulp6_connected() 401{ 402 local _fibtxt _reply _n _o _rc _fib _f _opts 403 _n=$1 404 _o="$2" 405 _fib=$3 406 407 case "${USE_SOSETFIB}" in 408 1) _f="SO_SETFIB" ;; 409 *) _f="SETFIB" ;; 410 esac 411 412 if test "${_o}" = "-i" -a "${_f}" = "SO_SETFIB"; then 413 print_debug "Skipping icmp6 tests for SO_SETFIB." 414 return 0 415 fi 416 417 # Clear the neighbor table to get deterministic runs. 418 ndp -cn > /dev/null 2>&1 419 420 case "${_o}" in 421 -i) _opts="" ;; # Use TCP for START/DONE. 422 *) _opts="${_o}" ;; 423 esac 424 425 set +e 426 # Let peer know that we are about to start. 427 _msg="START ${_n}" 428 nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \ 429 ${CTRLPORT} "-6 ${_opts} -w1" 430 case $? in 431 0) ;; 432 *) die "Got invalid reply from peer." \ 433 "Expected '${_msg}', got '${_reply}'" ;; 434 esac 435 436 case "${_o}" in 437 -i) testtx_icmp6 "${_n}" ;; 438 *) testtx_tcp_udp "${_n}" "${_o}" "${_f}" ;; 439 esac 440 441 # Let peer know that we are done with this test to move to next. 442 # This must immediately succeed. 443 _msg="DONE ${_n}" 444 nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \ 445 ${CTRLPORT} "-6 ${_opts} -w1" 446 case $? in 447 0) ;; 448 *) die "Got invalid reply from peer." \ 449 "Expected '${_msg}', got '${_reply}'" ;; 450 esac 451 set -e 452 453 print_debug "Successfully received status update '${_reply}'." 454} 455 456################################################################################ 457# 458# ping6|TCP/UDP connect link-local and global address of peer from all FIBs. 459# Default reachability test. 460# 461testtx_icmp6_connected() 462{ 463 local i 464 465 # Setup expected return values. 466 i=0 467 while test ${i} -lt ${RT_NUMFIBS}; do 468 eval rc_${i}_l=0 469 eval rc_${i}_a=0 470 i=$((i + 1)) 471 done 472 473 testtx_ulp6_connected "testtx_icmp6_connected" "-i" 0 474} 475 476testtx_tcp6_connected() 477{ 478 local i 479 480 # Setup expected return values. 481 i=0 482 while test ${i} -lt ${RT_NUMFIBS}; do 483 eval rc_${i}_l=0 484 eval rc_${i}_a=0 485 i=$((i + 1)) 486 done 487 488 testtx_ulp6_connected testtx_tcp6_connected "" 0 489} 490 491testtx_udp6_connected() 492{ 493 local i 494 495 # Setup expected return values. 496 i=0 497 while test ${i} -lt ${RT_NUMFIBS}; do 498 eval rc_${i}_l=0 499 eval rc_${i}_a=0 500 i=$((i + 1)) 501 done 502 503 testtx_ulp6_connected testtx_udp6_connected "-u" 0 504} 505 506################################################################################ 507# 508# Use ipfw to return unreach messages for all but one FIB. Rotate over all. 509# Making sure error messages are properly returned. 510# 511testtx_ulp6_connected_blackhole() 512{ 513 local fib i _n _o 514 _n="$1" 515 _o="$2" 516 517 fib=0 518 while test ${fib} -lt ${RT_NUMFIBS}; do 519 520 print_debug "${_n} ${fib}" 521 522 # Setup expected return values. 523 i=0 524 while test ${i} -lt ${RT_NUMFIBS}; do 525 ipfw delete $((100 + i)) > /dev/null 2>&1 || true 526 case ${i} in 527 ${fib}) 528 eval rc_${i}_l=0 529 eval rc_${i}_a=0 530 ;; 531 *) eval rc_${i}_l=1 532 eval rc_${i}_a=1 533 ipfw add $((100 + i)) unreach6 admin-prohib \ 534 ip6 from any to any fib ${i} via ${IFACE} \ 535 out > /dev/null 2>&1 536 ;; 537 esac 538 i=$((i + 1)) 539 done 540 541 testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} 542 case ${DEBUG} in 543 ''|0) ;; 544 *) ipfw show ;; 545 esac 546 fib=$((fib + 1)) 547 done 548 fib=0 549 while test ${fib} -lt ${RT_NUMFIBS}; do 550 ipfw delete $((100 + fib)) > /dev/null 2>&1 || true 551 fib=$((fib + 1)) 552 done 553} 554 555testtx_icmp6_connected_blackhole() 556{ 557 558 testtx_ulp6_connected_blackhole \ 559 "testtx_icmp6_connected_blackhole" "-i" 560} 561 562testtx_tcp6_connected_blackhole() 563{ 564 565 testtx_ulp6_connected_blackhole \ 566 "testtx_tcp6_connected_blackhole" "" 567} 568 569testtx_udp6_connected_blackhole() 570{ 571 572 testtx_ulp6_connected_blackhole \ 573 "testtx_udp6_connected_blackhole" "-u" 574} 575 576################################################################################ 577# 578# Setup a different transfer net on each FIB. Delete all but one connected 579# route in all FIBs (e.g. FIB 0 uses prefix 0, FIB 1 uses prefix 1 , ...). 580# 581# Need to tag NS/NA incoming to the right FIB given the default FIB does not 582# know about the prefix and thus cannot do proper source address lookups for 583# replying otherwise. Use ipfw. 584# 585testtx_ulp6_connected_transfernets() 586{ 587 local fib i _n _o _p 588 _n="$1" 589 _o="$2" 590 591 # Setup transfer networks and firewall. 592 ipfw delete 10 > /dev/null 2>&1 || true 593 fib=0 594 while test ${fib} -lt ${RT_NUMFIBS}; do 595 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 596 > /dev/null 2>&1 || true 597 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias 598 ipfw add 10 setfib ${fib} ipv6-icmp from 2001:2:${fib}::/64 \ 599 to any ip6 icmp6types 135,136 via ${IFACE} in \ 600 > /dev/null 2>&1 601 # Remove connected routes from all but matching FIB. 602 i=0 603 while test ${i} -lt ${RT_NUMFIBS}; do 604 case ${i} in 605 ${fib});; 606 *) setfib -F${i} route delete -inet6 \ 607 -net 2001:2:${fib}:: > /dev/null 2>&1 608 ;; 609 esac 610 i=$((i + 1)) 611 done 612 fib=$((fib + 1)) 613 done 614 615 # Save PEERADDR 616 _p=${PEERADDR} 617 618 # Run tests. 619 fib=0 620 while test ${fib} -lt ${RT_NUMFIBS}; do 621 PEERADDR=2001:2:${fib}::2 622 623 print_debug "${_n} ${fib}" 624 625 # Setup expected return values. 626 i=0 627 while test ${i} -lt ${RT_NUMFIBS}; do 628 eval rc_${i}_l=0 629 case ${i} in 630 ${fib}) 631 eval rc_${i}_a=0 632 ;; 633 *) eval rc_${i}_a=1 634 ;; 635 esac 636 i=$((i + 1)) 637 done 638 639 testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} 640 fib=$((fib + 1)) 641 done 642 643 # Restore PEERADDR 644 PEERADDR=${_p} 645 646 # Cleanup transfer networks and firewall. 647 fib=0 648 while test ${fib} -lt ${RT_NUMFIBS}; do 649 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias 650 fib=$((fib + 1)) 651 done 652 ipfw delete 10 > /dev/null 2>&1 653} 654 655testtx_icmp6_connected_transfernets() 656{ 657 658 testtx_ulp6_connected_transfernets \ 659 "testtx_icmp6_connected_transfernets" "-i" 660} 661 662testtx_tcp6_connected_transfernets() 663{ 664 665 testtx_ulp6_connected_transfernets \ 666 "testtx_tcp6_connected_transfernets" "" 667} 668 669testtx_udp6_connected_transfernets() 670{ 671 672 testtx_ulp6_connected_transfernets \ 673 "testtx_udp6_connected_transfernets" "-u" 674} 675 676################################################################################ 677# 678# Setup a different transfernet on each FIB. Delete all but one connected 679# route in all FIBs (e.g. FIB 0 uses prefix 0, FIB 1 uses prefix 1 , ...). 680# 681# Need to tag NS/NA incoming to the right FIB given the default FIB does not 682# know about the prefix and thus cannot do proper source address lookups for 683# replying otherwise. Use ifconfig IFACE fib. 684# 685testtx_ulp6_connected_ifconfig_transfernets() 686{ 687 local fib i _n _o _p 688 _n="$1" 689 _o="$2" 690 691 # Setup transfer networks. 692 fib=0 693 while test ${fib} -lt ${RT_NUMFIBS}; do 694 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 695 > /dev/null 2>&1 || true 696 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias 697 # Remove connected routes from all but matching FIB. 698 i=0 699 while test ${i} -lt ${RT_NUMFIBS}; do 700 case ${i} in 701 ${fib});; 702 *) setfib -F${i} route delete -inet6 \ 703 -net 2001:2:${fib}:: > /dev/null 2>&1 704 ;; 705 esac 706 i=$((i + 1)) 707 done 708 fib=$((fib + 1)) 709 done 710 711 # Save PEERADDR 712 _p=${PEERADDR} 713 714 # Run tests. 715 fib=0 716 while test ${fib} -lt ${RT_NUMFIBS}; do 717 PEERADDR=2001:2:${fib}::2 718 719 print_debug "${_n} ${fib}" 720 721 # Setup expected return values. 722 i=0 723 while test ${i} -lt ${RT_NUMFIBS}; do 724 eval rc_${i}_l=0 725 case ${i} in 726 ${fib}) 727 eval rc_${i}_a=0 728 ;; 729 *) eval rc_${i}_a=1 730 ;; 731 esac 732 i=$((i + 1)) 733 done 734 735 ifconfig ${IFACE} fib ${fib} 736 737 testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} 738 fib=$((fib + 1)) 739 done 740 741 # Restore PEERADDR 742 PEERADDR=${_p} 743 744 # Cleanup transfer networks. 745 fib=0 746 while test ${fib} -lt ${RT_NUMFIBS}; do 747 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias 748 fib=$((fib + 1)) 749 done 750 ifconfig ${IFACE} fib 0 751} 752 753testtx_icmp6_connected_ifconfig_transfernets() 754{ 755 756 testtx_ulp6_connected_ifconfig_transfernets \ 757 "testtx_icmp6_connected_ifconfig_transfernets" "-i" 758} 759 760 761testtx_tcp6_connected_ifconfig_transfernets() 762{ 763 764 testtx_ulp6_connected_ifconfig_transfernets \ 765 "testtx_tcp6_connected_ifconfig_transfernets" "" 766} 767 768testtx_udp6_connected_ifconfig_transfernets() 769{ 770 771 testtx_ulp6_connected_ifconfig_transfernets \ 772 "testtx_udp6_connected_ifconfig_transfernets" "-u" 773} 774 775################################################################################ 776# 777# Make destination reachable through the same default route in each FIB only. 778# Run standard reachability test. 779# 780testtx_ulp6_gateway() 781{ 782 local fib i _n _o _p 783 _n="$1" 784 _o="$2" 785 786 # Setup default gateway and expected error codes. 787 fib=0 788 while test ${fib} -lt ${RT_NUMFIBS}; do 789 setfib -F${fib} route delete -inet6 -net default \ 790 > /dev/null 2>&1 || true 791 setfib -F${fib} route add -inet6 -net default ${PEERADDR} \ 792 > /dev/null 2>&1 793 case "${_o}" in 794 -i) eval rc_${fib}_l=0 ;; # ICMPv6 will succeed 795 *) eval rc_${fib}_l=1 ;; 796 esac 797 eval rc_${fib}_a=0 798 fib=$((fib + 1)) 799 done 800 801 # Save PEERADDR 802 _p=${PEERADDR} 803 PEERADDR="2001:2:ff01::2" 804 805 # Run tests. 806 print_debug "${_n}" 807 testtx_ulp6_connected "${_n}" "${_o}" 0 808 809 # Restore PEERADDR 810 PEERADDR=${_p} 811 812 # Cleanup transfer networks. 813 fib=0 814 while test ${fib} -lt ${RT_NUMFIBS}; do 815 setfib -F${fib} route delete -inet6 -net default \ 816 > /dev/null 2>&1 817 fib=$((fib + 1)) 818 done 819} 820 821testtx_icmp6_gateway() 822{ 823 824 testtx_ulp6_gateway "testtx_icmp6_gateway" "-i" 825} 826 827testtx_tcp6_gateway() 828{ 829 830 testtx_ulp6_gateway "testtx_tcp6_gateway" "" 831} 832 833testtx_udp6_gateway() 834{ 835 836 testtx_ulp6_gateway "testtx_udp6_gateway" "-u" 837} 838 839################################################################################ 840# 841# Make destination reachable through a different default route in each FIB. 842# Generate a dedicated transfer network for that in each FIB. Delete all but 843# one connected route in all FIBs (e.g. FIB 0 uses prefix 0, ...). 844# 845# Have a default route present in each FIB all time. 846# 847# Need to tag NS/NA incoming to the right FIB given the default FIB does not 848# know about the prefix and thus cannot do proper source address lookups for 849# replying otherwise. Use ipfw. 850# 851# 852testtx_ulp6_transfernets_gateways() 853{ 854 local fib i _n _o _p 855 _n="$1" 856 _o="$2" 857 858 # Setup transfer networks, default routes, and firewall. 859 fib=0 860 ipfw delete 10 > /dev/null 2>&1 || true 861 while test ${fib} -lt ${RT_NUMFIBS}; do 862 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 863 > /dev/null 2>&1 || true 864 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias \ 865 > /dev/null 2>&1 866 ipfw add 10 setfib ${fib} ipv6-icmp \ 867 from 2001:2:${fib}::/64 to any ip6 icmp6types 135,136 \ 868 via ${IFACE} in > /dev/null 2>&1 869 # Remove connected routes from all but matching FIB. 870 i=0 871 while test ${i} -lt ${RT_NUMFIBS}; do 872 case ${i} in 873 ${fib});; 874 *) setfib -F${i} route delete -inet6 \ 875 -net 2001:2:${fib}:: > /dev/null 2>&1 876 ;; 877 esac 878 i=$((i + 1)) 879 done 880 # Add default route. 881 setfib -F${fib} route delete -inet6 -net default \ 882 > /dev/null 2>&1 || true 883 setfib -F${fib} route add -inet6 -net default \ 884 2001:2:${fib}::2 > /dev/null 2>&1 885 fib=$((fib + 1)) 886 done 887 888 # Save PEERADDR 889 _p=${PEERADDR} 890 PEERADDR="2001:2:ff01::2" 891 892 # Setup expected return values. 893 i=0 894 while test ${i} -lt ${RT_NUMFIBS}; do 895 case "${_o}" in 896 -i) eval rc_${i}_l=0 ;; # ICMPv6 will succeed 897 *) eval rc_${i}_l=1 ;; 898 esac 899 eval rc_${i}_a=0 900 i=$((i + 1)) 901 done 902 903 # Run tests. 904 print_debug "${_n}" 905 testtx_ulp6_connected "${_n}" "${_o}" 0 906 907 # Restore PEERADDR 908 PEERADDR=${_p} 909 910 # Cleanup default routes, transfer networks, and firewall. 911 fib=0 912 while test ${fib} -lt ${RT_NUMFIBS}; do 913 setfib -F${fib} route delete -inet6 -net default \ 914 > /dev/null 2>&1 915 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 916 > /dev/null 2>&1 917 fib=$((fib + 1)) 918 done 919 ipfw delete 10 > /dev/null 2>&1 920} 921 922testtx_icmp6_transfernets_gateways() 923{ 924 925 testtx_ulp6_transfernets_gateways \ 926 "testtx_icmp6_transfernets_gateways" "-i" 927} 928 929testtx_tcp6_transfernets_gateways() 930{ 931 932 testtx_ulp6_transfernets_gateways \ 933 "testtx_tcp6_transfernets_gateways" "" 934} 935 936testtx_udp6_transfernets_gateways() 937{ 938 939 testtx_ulp6_transfernets_gateways \ 940 "testtx_udp6_transfernets_gateways" "-u" 941} 942 943################################################################################ 944# 945# Make destination reachable through a different default route in each FIB. 946# Generate a dedicated transfer network for that in each FIB. Delete all but 947# one connected route in all FIBs (e.g. FIB 0 uses prefix 0, ...). 948# 949# Only have a default route present in 1 FIB at a time. 950# 951# Need to tag NS/NA incoming to the right FIB given the default FIB does not 952# know about the prefix and thus cannot do proper source address lookups for 953# replying otherwise. Use ipfw. 954# 955testtx_ulp6_transfernets_gateway() 956{ 957 local fib i _n _o _p 958 _n="$1" 959 _o="$2" 960 961 # Setup transfer networks, default routes, and firewall. 962 fib=0 963 ipfw delete 10 > /dev/null 2>&1 || true 964 while test ${fib} -lt ${RT_NUMFIBS}; do 965 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 966 > /dev/null 2>&1 || true 967 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias \ 968 > /dev/null 2>&1 969 ipfw add 10 setfib ${fib} ipv6-icmp \ 970 from 2001:2:${fib}::/64 to any ip6 icmp6types 135,136 \ 971 via ${IFACE} in > /dev/null 2>&1 972 # Remove connected routes from all but matching FIB. 973 i=0 974 while test ${i} -lt ${RT_NUMFIBS}; do 975 case ${i} in 976 ${fib});; 977 *) setfib -F${i} route delete -inet6 \ 978 -net 2001:2:${fib}:: > /dev/null 2>&1 979 ;; 980 esac 981 i=$((i + 1)) 982 done 983 fib=$((fib + 1)) 984 done 985 986 # Save PEERADDR 987 _p=${PEERADDR} 988 PEERADDR="2001:2:ff01::2" 989 990 # Run tests. 991 fib=0 992 while test ${fib} -lt ${RT_NUMFIBS}; do 993 994 print_debug "${_n} ${fib}" 995 996 # Setup expected return values. 997 i=0 998 while test ${i} -lt ${RT_NUMFIBS}; do 999 case "${_o}" in 1000 -i) eval rc_${i}_l=0 ;; # ICMPv6 will succeed 1001 *) eval rc_${i}_l=1 ;; 1002 esac 1003 case ${i} in 1004 ${fib}) 1005 eval rc_${i}_a=0 1006 ;; 1007 *) eval rc_${i}_a=1 1008 ;; 1009 esac 1010 i=$((i + 1)) 1011 done 1012 1013 # Add default route. 1014 setfib -F${fib} route delete -inet6 -net default \ 1015 > /dev/null 2>&1 || true 1016 setfib -F${fib} route add -inet6 -net default \ 1017 2001:2:${fib}::2 > /dev/null 2>&1 1018 1019 testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} 1020 1021 # Delete default route again. 1022 setfib -F${fib} route delete -inet6 -net default \ 1023 > /dev/null 2>&1 1024 fib=$((fib + 1)) 1025 done 1026 1027 # Restore PEERADDR 1028 PEERADDR=${_p} 1029 1030 # Cleanup default routes, transfer networks, and firewall. 1031 fib=0 1032 while test ${fib} -lt ${RT_NUMFIBS}; do 1033 setfib -F${fib} route delete -inet6 -net default \ 1034 > /dev/null 2>&1 1035 ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ 1036 > /dev/null 2>&1 1037 fib=$((fib + 1)) 1038 done 1039 ipfw delete 10 > /dev/null 2>&1 1040} 1041 1042testtx_icmp6_transfernets_gateway() 1043{ 1044 1045 testtx_ulp6_transfernets_gateway \ 1046 "testtx_icmp6_transfernets_gateway" "-i" 1047} 1048 1049 1050testtx_tcp6_transfernets_gateway() 1051{ 1052 1053 testtx_ulp6_transfernets_gateway \ 1054 "testtx_tcp6_transfernets_gateway" "" 1055} 1056 1057testtx_udp6_transfernets_gateway() 1058{ 1059 1060 testtx_ulp6_transfernets_gateway \ 1061 "testtx_udp6_transfernets_gateway" "-u" 1062} 1063 1064 1065################################################################################ 1066# 1067# RX tests (Remotely originated connections). The FIB tests happens on peer. 1068# 1069# # For IPFW, IFCONFIG 1070# # For each FIB 1071# # Send OOB well known to work START, wait for reflect 1072# # Send probe, wait for reply with FIB# or RST/ICMP6 unreach 1073# # (in case of ICMP6 use magic like ipfw count and OOB reply) 1074# # Send OOB well known to work DONE, wait for reflect 1075# # Compare real with expected results. 1076# 1077testrx_results() 1078{ 1079 local _r _n _fib i count _instances _transfer _o 1080 _fib="$1" 1081 _n="$2" 1082 _r="$3" 1083 _instances=$4 1084 _transfer=$5 1085 _o="$6" 1086 1087 print_debug "testrx_results ${_fib} ${_n} ${_r} ${_instances}" 1088 1089 # Trim "RESULT " 1090 _r=${_r#* } 1091 1092 echo "1..${RT_NUMFIBS}" 1093 while read i count; do 1094 if test ${_instances} -gt 1; then 1095 if test ${count} -gt 0; then 1096 echo "ok ${i} ${_n}result_${i} #" \ 1097 "FIB ${i} ${count} (tested)" 1098 else 1099 echo "not ok ${i} ${_n}result_${i} #" \ 1100 "FIB ${i} ${count} (tested)" 1101 fi 1102 else 1103 case ${i} in 1104 ${_fib}) 1105 if test ${count} -gt 0; then 1106 echo "ok ${i} ${_n}result_${i} #" \ 1107 "FIB ${i} ${count} (tested)" 1108 else 1109 echo "not ok ${i} ${_n}result_${i} #" \ 1110 "FIB ${i} ${count} (tested)" 1111 fi 1112 ;; 1113 *) if test ${count} -eq 0; then 1114 echo "ok ${i} ${_n}result_${i} #" \ 1115 "FIB ${i} ${count}" 1116 else 1117 echo "not ok ${i} ${_n}result_${i} #" \ 1118 "FIB ${i} ${count}" 1119 fi 1120 ;; 1121 esac 1122 fi 1123 i=$((i + 1)) 1124 done <<EOI 1125`echo "${_r}" | tr ',' '\n'` 1126EOI 1127 1128} 1129 1130testrx_tcp_udp() 1131{ 1132 local _n _o _f testno i _fibtxt _instances _res _port _transfer _p 1133 _n="$1" 1134 _o="$2" 1135 _f="$3" 1136 _instances=$4 1137 _transfer=$5 1138 1139 # Unused so far. 1140 : ${_instances:=1} 1141 1142 printf "1..%d\n" `expr 2 \* ${RT_NUMFIBS}` 1143 testno=1 1144 i=0 1145 while test ${i} -lt ${RT_NUMFIBS}; do 1146 print_debug "Testing ${_f} ${i}" 1147 1148 # We are expecting the FIB number (only) to be returned. 1149 eval _rc="\${rc_${i}_l}" 1150 _fibtxt="${_n}_${i}_l ${_f} ${i} ${PEERLINKLOCAL}" 1151 if test ${_instances} -gt 1; then 1152 _res="FIB ${i}" 1153 _port=$((CTRLPORT + 1000 + i)) 1154 else 1155 _res="${_fibtxt}" 1156 _port=${CTRLPORT} 1157 fi 1158 nc_send_recv ${i} 1 "${_fibtxt}" "${_res}" ${PEERLINKLOCAL} \ 1159 ${_port} "-6 ${_o} -w1" 1160 check_rc $? ${_rc} ${testno} "${_fibtxt}" "${_reply}" 1161 testno=$((testno + 1)) 1162 1163 # If doing multiple transfer networks, replace PEERADDR. 1164 _p="${PEERADDR}" 1165 case ${_transfer} in 1166 1) PEERADDR=2001:2:${i}::2 ;; 1167 esac 1168 1169 eval _rc="\${rc_${i}_a}" 1170 _fibtxt="${_n}_${i}_a ${_f} ${i} ${PEERADDR}" 1171 if test ${_instances} -gt 1; then 1172 _res="FIB ${i}" 1173 _port=$((CTRLPORT + 1000 + i)) 1174 else 1175 _res="${_fibtxt}" 1176 _port=${CTRLPORT} 1177 fi 1178 nc_send_recv ${i} 1 "${_fibtxt}" "${_res}" ${PEERADDR} \ 1179 ${_port} "-6 ${_o} -w1" 1180 check_rc $? ${_rc} ${testno} "${_fibtxt}" "${_reply}" 1181 testno=$((testno + 1)) 1182 1183 # Restore PEERADDR. 1184 PEERADDR="${_p}" 1185 1186 i=$((i + 1)) 1187 done 1188} 1189 1190 1191testrx_setup_transfer_networks() 1192{ 1193 local i 1194 1195 i=0 1196 while test ${i} -lt ${RT_NUMFIBS}; do 1197 ifconfig ${IFACE} inet6 2001:2:${i}::1/64 -alias \ 1198 > /dev/null 2>&1 || true 1199 ifconfig ${IFACE} inet6 2001:2:${i}::1/64 alias 1200 i=$((i + 1)) 1201 done 1202} 1203 1204testrx_cleanup_transfer_networks() 1205{ 1206 local i 1207 1208 i=0 1209 while test ${i} -lt ${RT_NUMFIBS}; do 1210 ifconfig ${IFACE} inet6 2001:2:${i}::1/64 -alias \ 1211 > /dev/null 2>&1 1212 i=$((i + 1)) 1213 done 1214} 1215 1216 1217testrx_run_test() 1218{ 1219 local _n _t _fib _o _txt _msg i _reply _instances _destructive _transfer 1220 _n="$1" 1221 _t="$2" 1222 _fib=$3 1223 _o="$4" 1224 _instances=$5 1225 _detsructive=$6 1226 _transfer=$7 1227 1228 # Netcat options (for UDP basically). 1229 case "${_o}" in 1230 -i) _opts="" ;; # Use TCP for START/DONE. 1231 *) _opts="${_o}" ;; 1232 esac 1233 1234 # Combined test case base name. 1235 case ${USE_SOSETFIB} in 1236 0) _f="setfib" ;; 1237 1) _f="so_setfib" ;; 1238 *) die "Unexpected value for SO_SETFIB: ${SO_SETFIB}" ;; 1239 esac 1240 _txt="${_n}_${_f}_${_t}_${_fib}_${_instances}_${_detsructive}_${_transfer}" 1241 1242 print_debug "Starting test '${_txt}' (for ${_instances} instances)." 1243 1244 case ${_transfer} in 1245 1) testrx_setup_transfer_networks ;; 1246 esac 1247 1248 # Let the other side a chance to get ready as well. 1249 sleep 1 1250 1251 set +e 1252 # Let peer know that we are about to start. 1253 _msg="START ${_txt}" 1254 nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \ 1255 ${CTRLPORT} "-6 ${_opts} -w1" 1256 case $? in 1257 0) ;; 1258 *) die "Got invalid reply from peer." \ 1259 "Expected '${_msg}', got '${_reply}'" ;; 1260 esac 1261 1262 # Let the other side a chance to get ready as well. 1263 sleep 1 1264 1265 # Send probe. 1266 case "${_o}" in 1267 -i) testtx_icmp6 "${_txt}_" ${_transfer} ;; 1268 *) testrx_tcp_udp "${_txt}" "${_o}" "${_fib}" ${_instances} \ 1269 ${_transfer} ;; 1270 esac 1271 1272 # Let peer know that we are done with this test to move to next. 1273 # This must immediately succeed. 1274 _msg="DONE ${_txt}" 1275 nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \ 1276 ${CTRLPORT} "-6 ${_opts} -w1" 1277 case $? in 1278 0) ;; 1279 *) die "Got invalid reply from peer." \ 1280 "Expected '${_msg}', got '${_reply}'" ;; 1281 esac 1282 1283 # Collect and validate the results. Always use TCP. 1284 sleep 1 1285 set +e 1286 nc_send_recv ${_fib} 1 "RESULT REQUEST" "" ${PEERADDR} \ 1287 ${CTRLPORT} "-6 -w1" 1288 case "${_reply}" in 1289 RESULT\ *) testrx_results ${_fib} "${_txt}_" "${_reply}" ${_instances} \ 1290 ${_transfer} "${_o}" 1291 ;; 1292 *) die "Got invalid reply from peer." \ 1293 "Expected 'RESULT ...', got '${_reply}'" ;; 1294 esac 1295 set -e 1296 1297 case ${_transfer} in 1298 1) testrx_cleanup_transfer_networks ;; 1299 esac 1300 1301 print_debug "Successfully received status update '${_reply}'." 1302} 1303 1304testrx_main_setup_rc() 1305{ 1306 local _n _t _fib _o _instances _destructive _transfer i 1307 _n="$1" 1308 _t="$2" 1309 _fib=$3 1310 _o="$4" 1311 _instances=$5 1312 _destructive=$6 1313 _transfer=$7 1314 1315 # Setup expected return values. 1316 if test ${_destructive} -eq 0; then 1317 i=0 1318 while test ${i} -lt ${RT_NUMFIBS}; do 1319 eval rc_${i}_l=0 1320 eval rc_${i}_a=0 1321 i=$((i + 1)) 1322 done 1323 else 1324 i=0 1325 while test ${i} -lt ${RT_NUMFIBS}; do 1326 eval rc_${i}_l=0 1327 case ${i} in 1328 ${_fib}) eval rc_${i}_a=0 ;; 1329 *) # ICMP6 cannot be distinguished and will 1330 # always work in single transfer network. 1331 case "${_o}" in 1332 -i) case ${_transfer} in 1333 0) eval rc_${i}_a=0 ;; 1334 1) eval rc_${i}_a=1 ;; 1335 esac 1336 ;; 1337 *) if test ${_instances} -eq 1 -a \ 1338 ${_transfer} -eq 0; then 1339 eval rc_${i}_a=0 1340 else 1341 eval rc_${i}_a=1 1342 fi 1343 ;; 1344 esac 1345 ;; 1346 esac 1347 i=$((i + 1)) 1348 done 1349 fi 1350 1351 print_debug "${_n}_${t}_${_fib} ${_instances} ${_destructive}" \ 1352 "${_transfer}" 1353 testrx_run_test "${_n}" "${t}" ${_fib} "${_o}" ${_instances} \ 1354 ${_destructive} ${_transfer} 1355} 1356 1357testrx_main() 1358{ 1359 local _n _o s t fib _instances _destructive _transfer 1360 _n="$1" 1361 _o="$2" 1362 _instances=$3 1363 1364 : ${_instances:=1} 1365 1366 print_debug "${_n}" 1367 for _transfer in 1 0; do 1368 for _destructive in 0 1; do 1369 for t in ipfw ifconfig; do 1370 1371 print_debug "${_n}_${t}" 1372 fib=0 1373 while test ${fib} -lt ${RT_NUMFIBS}; do 1374 1375 testrx_main_setup_rc "${_n}" "${t}" \ 1376 ${fib} "${_o}" ${_instances} \ 1377 ${_destructive} ${_transfer} 1378 1379 fib=$((fib + 1)) 1380 done 1381 done 1382 done 1383 done 1384} 1385 1386################################################################################ 1387# 1388# 1389# 1390 1391testrx_icmp6_same_addr_one_fib_a_time() 1392{ 1393 1394 testrx_main \ 1395 "testrx_icmp6_same_addr_one_fib_a_time" "-i" 1396} 1397 1398testrx_tcp6_same_addr_one_fib_a_time() 1399{ 1400 1401 testrx_main \ 1402 "testrx_tcp6_same_addr_one_fib_a_time" "" 1403} 1404 1405 1406testrx_udp6_same_addr_one_fib_a_time() 1407{ 1408 1409 testrx_main \ 1410 "testrx_udp6_same_addr_one_fib_a_time" "-u" 1411} 1412 1413 1414################################################################################ 1415 1416testrx_tcp6_same_addr_all_fibs_a_time() 1417{ 1418 1419 testrx_main \ 1420 "testrx_tcp6_same_addr_all_fibs_a_time" "" ${RT_NUMFIBS} 1421} 1422 1423testrx_udp6_same_addr_all_fibs_a_time() 1424{ 1425 1426 testrx_main \ 1427 "testrx_udp6_same_addr_all_fibs_a_time" "-u" ${RT_NUMFIBS} 1428} 1429 1430 1431################################################################################ 1432# 1433# Prereqs. 1434# 1435if test `sysctl -n security.jail.jailed` -eq 0; then 1436 kldload ipfw > /dev/null 2>&1 || kldstat -v | grep -q ipfw 1437 1438 # Reduce the time we wait in case of no reply to 2s. 1439 sysctl net.inet.tcp.keepinit=2000 > /dev/null 2>&1 1440fi 1441ipfw -f flush > /dev/null 2>&1 || die "please load ipfw in base system" 1442ipfw add 65000 permit ip from any to any > /dev/null 2>&1 1443 1444################################################################################ 1445# 1446# Run tests. 1447# 1448 1449# 64 cases at 16 FIBs. 1450check_local_addr 1451check_local_tun 1452 1453send_greeting 1454 1455# Initiator testing. 1456for uso in 0 1; do 1457 1458 USE_SOSETFIB=${uso} 1459 1460 # Only run ICMP6 tests for the first loop. 1461 # 160 cases at 16 FIBs. 1462 test ${uso} -ne 0 || testtx_icmp6_connected && sleep 1 1463 testtx_tcp6_connected && sleep 1 1464 testtx_udp6_connected && sleep 1 1465 1466 # 2560 cases at 16 FIBs. 1467 test ${uso} -ne 0 || testtx_icmp6_connected_blackhole && sleep 1 1468 testtx_tcp6_connected_blackhole && sleep 1 1469 testtx_udp6_connected_blackhole && sleep 1 1470 1471 # 2560 cases at 16 FIBs. 1472 test ${uso} -ne 0 || testtx_icmp6_connected_transfernets && sleep 1 1473 testtx_tcp6_connected_transfernets && sleep 1 1474 testtx_udp6_connected_transfernets && sleep 1 1475 1476 # 2560 cases at 16 FIBs. 1477 test ${uso} -ne 0 || \ 1478 testtx_icmp6_connected_ifconfig_transfernets && sleep 1 1479 testtx_tcp6_connected_ifconfig_transfernets && sleep 1 1480 testtx_udp6_connected_ifconfig_transfernets && sleep 1 1481 1482 # 160 cases at 16 FIBs. 1483 test ${uso} -ne 0 || testtx_icmp6_gateway && sleep 1 1484 testtx_tcp6_gateway && sleep 1 1485 testtx_udp6_gateway && sleep 1 1486 1487 # 160 cases at 16 FIBs. 1488 test ${uso} -ne 0 || testtx_icmp6_transfernets_gateways && sleep 1 1489 testtx_tcp6_transfernets_gateways && sleep 1 1490 testtx_udp6_transfernets_gateways && sleep 1 1491 1492 # 2560 cases at 16 FIBs. 1493 test ${uso} -ne 0 || testtx_icmp6_transfernets_gateway && sleep 1 1494 testtx_tcp6_transfernets_gateway && sleep 1 1495 testtx_udp6_transfernets_gateway && sleep 1 1496done 1497 1498# Receiver testing. 1499for uso in 0 1; do 1500 1501 USE_SOSETFIB=${uso} 1502 1503 # Only expect ICMP6 tests for the first loop. 1504 # 6144 cases at 16 FIBs. 1505 test ${uso} -ne 0 || testrx_icmp6_same_addr_one_fib_a_time && sleep 1 1506 # 12288 cases at 16 FIBs. 1507 testrx_tcp6_same_addr_one_fib_a_time && sleep 1 1508 # 12288 cases at 16 FIBs. 1509 testrx_udp6_same_addr_one_fib_a_time && sleep 1 1510 1511 # 12288 cases at 16 FIBs. 1512 testrx_tcp6_same_addr_all_fibs_a_time && sleep 1 1513 # 12288 cases at 16 FIBs. 1514 testrx_udp6_same_addr_all_fibs_a_time && sleep 1 1515 1516done 1517 1518cleanup 1519 1520# end 1521