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