Date: Mon, 5 Mar 2012 19:13:18 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r232566 - in stable/9/tools/test: . netfibs Message-ID: <201203051913.q25JDI8j000595@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Mon Mar 5 19:13:18 2012 New Revision: 232566 URL: http://svn.freebsd.org/changeset/base/232566 Log: MFC r231858: Add regression tests scripts for multi-IP FIBs exercising the send, receive and forward path tagging packets with both the ifconfig fib option or using ipfw, running ICMP6, TCP/v6 and UDP/v6 tests and testing both setfib(2) as well as the SO_SETFIB socket option. At 16 FIBs a total of over 64k return codes/replies/stati are checked, sometimes multiple times (in different ways, e.g. the reflected request as well as ipfw counter values). The scripts need two or three machines to run and are thus not added to the tools/regression framework but only to tools/test. MFC r232114: Update scripts to work around two sh(1) bugs found in stable/8: 1) _x=$((_x + 1)) does not work while x=$((x + 1)) does. 2) Parameter Expansion, esp. "${x%%bar}" does not work if quoted. Correct typos and improve some details forwarding.sh already had in initiator, esp. related to ipfw accepting if the default is deny. Add an extra stat call to the "delay" function in addition to the touch which together is still a lot faster than sleep 1 but seems to help a lot more to mitigate the unrelated kernel race seen. Sponsored by: Cisco Systems, Inc. Added: stable/9/tools/test/netfibs/ - copied from r231858, head/tools/test/netfibs/ Modified: stable/9/tools/test/README stable/9/tools/test/netfibs/README stable/9/tools/test/netfibs/forwarding.sh stable/9/tools/test/netfibs/initiator.sh stable/9/tools/test/netfibs/reflector.sh Directory Properties: stable/9/tools/test/ (props changed) Modified: stable/9/tools/test/README ============================================================================== --- stable/9/tools/test/README Mon Mar 5 19:10:58 2012 (r232565) +++ stable/9/tools/test/README Mon Mar 5 19:13:18 2012 (r232566) @@ -10,5 +10,6 @@ Please make a subdir per program, and ad devrandom Programs to test /dev/*random. dtrace DTrace test suite malloc A program to test and benchmark malloc(). +netfibs Programs to test multi-FIB network stacks. posixshm A program to test POSIX shared memory. testfloat Programs to test floating-point implementations Modified: stable/9/tools/test/netfibs/README ============================================================================== --- head/tools/test/netfibs/README Fri Feb 17 04:26:24 2012 (r231858) +++ stable/9/tools/test/netfibs/README Mon Mar 5 19:13:18 2012 (r232566) @@ -35,7 +35,7 @@ initiator.sh and reflector.sh output. A special value of 42 will enable sh(1) xtrace printing. The output format is modeled after Test::Harness Perl as used in - tools/regression/ but not always complaint following the test case name. + tools/regression/ but not always compliant following the test case name. NOTE: at the time of writing reflector.sh can trigger kernel races unrelated to multi-FIB test leading to a panic(9). "delay" calls Modified: stable/9/tools/test/netfibs/forwarding.sh ============================================================================== --- head/tools/test/netfibs/forwarding.sh Fri Feb 17 04:26:24 2012 (r231858) +++ stable/9/tools/test/netfibs/forwarding.sh Mon Mar 5 19:13:18 2012 (r232566) @@ -222,36 +222,36 @@ _reachability_check() reachability_check() { - local _i _rc + local _i rc # Try to reach all control addresses on other nodes. # We need to loop for a while as we cannot expect all to be up # the very same moment. i=1 - _rc=42 - while test ${_rc} -ne 0 -a ${i} -le ${WAITS}; do + rc=42 + while test ${rc} -ne 0 -a ${i} -le ${WAITS}; do print_debug "${i}/${WAITS} trying to ping6 control addresses." - _rc=0 + rc=0 set +e case ${node} in left) _reachability_check ${MIDDLELEFTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) _reachability_check ${MIDDLERIGHTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) _reachability_check ${RIGHTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) ;; middle) _reachability_check ${LEFTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) _reachability_check ${RIGHTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) ;; right) _reachability_check ${MIDDLERIGHTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) _reachability_check ${MIDDLELEFTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) _reachability_check ${LEFTADDR} - _rc=$((_rc + $?)) + rc=$((rc + $?)) ;; esac set -e @@ -390,14 +390,14 @@ test_icmp6() test_ulp_reflect_one() { - local _txt _opts _port _fib + local _txt _opts port fib _txt="$1" _opts="$2" - _port=$3 - _fib=$4 + port=$3 + fib=$4 - print_debug "./reflect -p $((_port + 1 + _fib)) -t ${_txt}" "${_opts}" - ./reflect -p $((_port + 1 + _fib)) -t ${_txt} ${_opts} + print_debug "./reflect -p $((port + 1 + fib)) -t ${_txt}" "${_opts}" + ./reflect -p $((port + 1 + fib)) -t ${_txt} ${_opts} print_debug "reflect '${_txt}' terminated without error." } @@ -463,19 +463,19 @@ nc_send_recv() test_ulp() { - local _maxfibs _msg _addr _port _fib i _txt testno _rc _reply - _maxfibs=$1 + local maxfibs _msg _addr port fib i _txt testno _rc _reply + maxfibs=$1 _msg="$2" _addr=$3 - _port=$4 - _fib=$5 + port=$4 + fib=$5 - printf "1..%d\n" $((${_maxfibs} * 2)) + printf "1..%d\n" $((${maxfibs} * 2)) testno=1 i=0 - while test ${i} -lt ${_maxfibs}; do + while test ${i} -lt ${maxfibs}; do - if test ${i} -eq $((${_maxfibs} - 1)); then + if test ${i} -eq $((${maxfibs} - 1)); then # Last one; signal DONE. _txt="DONE ${_msg}_${i}" else @@ -485,18 +485,18 @@ test_ulp() eval _rc="\${rc_${i}}" # Test TCP. - nc_send_recv ${_maxfibs} "${_txt}" "${_txt}" ${_addr} \ - $((${_port} + 1 + _fib)) "" + nc_send_recv ${maxfibs} "${_txt}" "${_txt}" ${_addr} \ + $((${port} + 1 + fib)) "" check_rc $? ${_rc} ${testno} "${_msg}_${i}_tcp" \ - "[${_addr}]:$((${_port} + 1 + _fib)) ${_reply}" + "[${_addr}]:$((${port} + 1 + fib)) ${_reply}" testno=$((testno + 1)) sleep 1 # Test UDP. - nc_send_recv ${_maxfibs} "${_txt}" "${_txt}" ${_addr} \ - $((${_port} + 1 + _fib)) "-u" + nc_send_recv ${maxfibs} "${_txt}" "${_txt}" ${_addr} \ + $((${port} + 1 + fib)) "-u" check_rc $? ${_rc} ${testno} "${_msg}_${i}_udp" \ - "[${_addr}]:$((${_port} + 1 + _fib)) ${_reply}" + "[${_addr}]:$((${port} + 1 + fib)) ${_reply}" sleep 1 i=$((i + 1)) @@ -506,18 +506,18 @@ test_ulp() setup_ipfw_count() { - local i _port _maxfib _p _fib _ofib - _port=$1 - _maxfib=$2 + local i port maxfib _p _fib _ofib + port=$1 + maxfib=$2 _fib=$3 _ofib=$4 i=0 - while test ${i} -lt ${_maxfib}; do + while test ${i} -lt ${maxfib}; do case ${_ofib} in - -1) _p=$((_port + 1 + i)) ;; - *) _p=$((_port + 1 + _maxfib - 1 - i)) ;; + -1) _p=$((port + 1 + i)) ;; + *) _p=$((port + 1 + maxfib - 1 - i)) ;; esac # Only count ICMP6 echo replies. @@ -532,10 +532,10 @@ setup_ipfw_count() ipfw add $((20000 + i)) count ipv6-icmp from any to any \ icmp6types 128 fib ${i} via ${IFACEFAR} out > /dev/null ipfw add $((20000 + i)) count tcp from any to any \ - dst-port $((${_port} + 1 + i)) fib ${i} \ + dst-port $((${port} + 1 + i)) fib ${i} \ via ${IFACEFAR} out > /dev/null ipfw add $((20000 + i)) count udp from any to any \ - dst-port $((${_port} + 1 + i)) fib ${i} \ + dst-port $((${port} + 1 + i)) fib ${i} \ via ${IFACEFAR} out > /dev/null i=$((i + 1)) @@ -544,7 +544,7 @@ setup_ipfw_count() report_ipfw_count() { - local _fib _o i _rstr _c _req _p _opts + local _fib _o i _rstr _c _req _p _opts base _o="$2" case ${DEBUG} in @@ -553,9 +553,9 @@ report_ipfw_count() esac _rstr="RESULTS " - for _base in 10000 20000; do + for base in 10000 20000; do for _o in i t u; do - case ${_base} in + case ${base} in 10000) _rstr="${_rstr}\nLEFT " ;; 20000) _rstr="${_rstr}\nRIGHT " ;; esac @@ -568,11 +568,11 @@ report_ipfw_count() while test ${i} -lt ${RT_NUMFIBS}; do case "${_o}" in - i) _c=`ipfw show $((${_base} + i)) | \ + i) _c=`ipfw show $((${base} + i)) | \ awk '/ ipv6-icmp / { print $2 }'` ;; - t) _c=`ipfw show $((${_base} + i)) | \ + t) _c=`ipfw show $((${base} + i)) | \ awk '/ tcp / { print $2 }'` ;; - u) _c=`ipfw show $((${_base} + i)) | \ + u) _c=`ipfw show $((${base} + i)) | \ awk '/ udp / { print $2 }'` ;; esac _rstr="${_rstr}${i} ${_c}," @@ -582,7 +582,7 @@ report_ipfw_count() done i=0 while test ${i} -lt ${RT_NUMFIBS}; do - ipfw delete $((${_base} + i)) > /dev/null 2>&1 || true + ipfw delete $((${base} + i)) > /dev/null 2>&1 || true i=$((i + 1)) done done @@ -994,18 +994,18 @@ fwd_fib_symmetric_ipfw() _fwd_fib_asymmetric_results() { - local _n _fib _maxfib i _edge _type _rc + local _n fib maxfib i _edge _type _rc _n="$1" - _fib=$2 - _maxfib=$3 + fib=$2 + maxfib=$3 i=0 - while test ${i} -lt ${_maxfib}; do + while test ${i} -lt ${maxfib}; do _edge="RIGHT" for _type in "ICMP6" "TCP" "UDP"; do case ${i} in - ${_fib}) eval rc_${_n}_${_edge}_${_type}_${i}=1 + ${fib}) eval rc_${_n}_${_edge}_${_type}_${i}=1 #print_debug \ # "rc_${_n}_${_edge}_${_type}_${i}=1" ;; @@ -1018,14 +1018,14 @@ _fwd_fib_asymmetric_results() done i=$((i + 1)) done - _fib=$((_maxfib - 1 - _fib)) + fib=$((maxfib - 1 - fib)) i=0 - while test ${i} -lt ${_maxfib}; do + while test ${i} -lt ${maxfib}; do _edge="LEFT" for _type in "ICMP6" "TCP" "UDP"; do case ${i} in - ${_fib}) eval rc_${_n}_${_edge}_${_type}_${i}=1 + ${fib}) eval rc_${_n}_${_edge}_${_type}_${i}=1 #print_debug \ # "rc_${_n}_${_edge}_${_type}_${i}=1" ;; @@ -1073,16 +1073,16 @@ _fwd_fib_asymmetric_left() _fwd_fib_asymmetric_middle_ifconfig() { - local _n _maxfib i + local _n maxfib i _n="$1" - _maxfib=$2 + maxfib=$2 i=0 - while test ${i} -lt ${_maxfib}; do + while test ${i} -lt ${maxfib}; do ifconfig ${IFACE} fib ${i} - ifconfig ${IFACEFAR} fib $((${_maxfib} - 1 - ${i})) - setup_ipfw_count ${CTRLPORT} ${_maxfib} ${i} \ - $((${_maxfib} - 1 - ${i})) + ifconfig ${IFACEFAR} fib $((${maxfib} - 1 - ${i})) + setup_ipfw_count ${CTRLPORT} ${maxfib} ${i} \ + $((${maxfib} - 1 - ${i})) wait_remote_ready "START_${_n}_${i}" ipfw -q zero > /dev/null # Nothing to do for the middle node testing the default. @@ -1095,12 +1095,12 @@ _fwd_fib_asymmetric_middle_ifconfig() _fwd_fib_asymmetric_middle_ipfw() { - local _n _maxfib i j _port + local _n maxfib i j _port _n="$1" - _maxfib=$2 + maxfib=$2 i=0 - while test ${i} -lt ${_maxfib}; do + while test ${i} -lt ${maxfib}; do _port=$((CTRLPORT + 1 + i)) ipfw add 100 setfib ${i} ipv6-icmp from any to any \ @@ -1110,7 +1110,7 @@ _fwd_fib_asymmetric_middle_ipfw() ipfw add 100 setfib ${i} udp from any to any \ dst-port ${_port} via ${IFACE} in > /dev/null - j=$((${_maxfib} - 1 - ${i})) + j=$((${maxfib} - 1 - ${i})) ipfw add 100 setfib ${j} ipv6-icmp from any to any \ icmp6types 129 via ${IFACEFAR} in > /dev/null ipfw add 100 setfib ${j} tcp from any to any \ @@ -1118,7 +1118,7 @@ _fwd_fib_asymmetric_middle_ipfw() ipfw add 100 setfib ${j} udp from any to any \ src-port ${_port} via ${IFACEFAR} in > /dev/null - setup_ipfw_count ${CTRLPORT} ${_maxfib} ${i} ${j} + setup_ipfw_count ${CTRLPORT} ${maxfib} ${i} ${j} wait_remote_ready "START_${_n}_${i}" ipfw -q zero > /dev/null # Nothing to do for the middle node testing the default. Modified: stable/9/tools/test/netfibs/initiator.sh ============================================================================== --- head/tools/test/netfibs/initiator.sh Fri Feb 17 04:26:24 2012 (r231858) +++ stable/9/tools/test/netfibs/initiator.sh Mon Mar 5 19:13:18 2012 (r232566) @@ -219,6 +219,7 @@ send_greeting() # The latter is needed to allow indvidiual less specific later rules # from test cases to just disallow any IPv6 traffic on a matching FIB. ipfw -f flush > /dev/null 2>&1 + ipfw add 65000 permit ip from any to any > /dev/null 2>&1 ipfw add 5 permit ipv6-icmp from any to any icmp6types 135,136 fib 0 \ via ${IFACE} out > /dev/null 2>&1 @@ -255,7 +256,7 @@ EOI PEERLINKLOCAL=${_linklocal} # Swap the zoneid to the local interface scope. - PEERLINKLOCAL="${PEERLINKLOCAL%%\%*}%${IFACE}" + PEERLINKLOCAL=${PEERLINKLOCAL%%\%*}"%${IFACE}" print_debug "Successfully exchanged greeting. Peer at ${PEERLINKLOCAL}" } @@ -510,21 +511,21 @@ testtx_udp6_connected() # testtx_ulp6_connected_blackhole() { - local _fib i _n _o + local fib i _n _o _n="$1" _o="$2" - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do - print_debug "${_n} ${_fib}" + print_debug "${_n} ${fib}" # Setup expected return values. i=0 while test ${i} -lt ${RT_NUMFIBS}; do ipfw delete $((100 + i)) > /dev/null 2>&1 || true case ${i} in - ${_fib}) + ${fib}) eval rc_${i}_l=0 eval rc_${i}_a=0 ;; @@ -538,17 +539,17 @@ testtx_ulp6_connected_blackhole() i=$((i + 1)) done - testtx_ulp6_connected "${_n}${_fib}" "${_o}" ${_fib} + testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} case ${DEBUG} in ''|0) ;; *) ipfw show ;; esac - _fib=$((_fib + 1)) + fib=$((fib + 1)) done - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - ipfw delete $((100 + _fib)) > /dev/null 2>&1 || true - _fib=$((_fib + 1)) + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + ipfw delete $((100 + fib)) > /dev/null 2>&1 || true + fib=$((fib + 1)) done } @@ -584,50 +585,50 @@ testtx_udp6_connected_blackhole() # testtx_ulp6_connected_transfernets() { - local _fib i _n _o _p + local fib i _n _o _p _n="$1" _o="$2" # Setup transfer networks and firewall. ipfw delete 10 > /dev/null 2>&1 || true - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 || true - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 alias - ipfw add 10 setfib ${_fib} ipv6-icmp from 2001:2:${_fib}::/64 \ + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias + ipfw add 10 setfib ${fib} ipv6-icmp from 2001:2:${fib}::/64 \ to any ip6 icmp6types 135,136 via ${IFACE} in \ > /dev/null 2>&1 # Remove connected routes from all but matching FIB. i=0 while test ${i} -lt ${RT_NUMFIBS}; do case ${i} in - ${_fib});; + ${fib});; *) setfib -F${i} route delete -inet6 \ - -net 2001:2:${_fib}:: > /dev/null 2>&1 + -net 2001:2:${fib}:: > /dev/null 2>&1 ;; esac i=$((i + 1)) done - _fib=$((_fib + 1)) + fib=$((fib + 1)) done # Save PEERADDR _p=${PEERADDR} # Run tests. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - PEERADDR=2001:2:${_fib}::2 + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + PEERADDR=2001:2:${fib}::2 - print_debug "${_n} ${_fib}" + print_debug "${_n} ${fib}" # Setup expected return values. i=0 while test ${i} -lt ${RT_NUMFIBS}; do eval rc_${i}_l=0 case ${i} in - ${_fib}) + ${fib}) eval rc_${i}_a=0 ;; *) eval rc_${i}_a=1 @@ -636,18 +637,18 @@ testtx_ulp6_connected_transfernets() i=$((i + 1)) done - testtx_ulp6_connected "${_n}${_fib}" "${_o}" ${_fib} - _fib=$((_fib + 1)) + testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} + fib=$((fib + 1)) done # Restore PEERADDR PEERADDR=${_p} # Cleanup transfer networks and firewall. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias - _fib=$((_fib + 1)) + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias + fib=$((fib + 1)) done ipfw delete 10 > /dev/null 2>&1 } @@ -684,46 +685,46 @@ testtx_udp6_connected_transfernets() # testtx_ulp6_connected_ifconfig_transfernets() { - local _fib i _n _o _p + local fib i _n _o _p _n="$1" _o="$2" # Setup transfer networks. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 || true - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 alias + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias # Remove connected routes from all but matching FIB. i=0 while test ${i} -lt ${RT_NUMFIBS}; do case ${i} in - ${_fib});; + ${fib});; *) setfib -F${i} route delete -inet6 \ - -net 2001:2:${_fib}:: > /dev/null 2>&1 + -net 2001:2:${fib}:: > /dev/null 2>&1 ;; esac i=$((i + 1)) done - _fib=$((_fib + 1)) + fib=$((fib + 1)) done # Save PEERADDR _p=${PEERADDR} # Run tests. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - PEERADDR=2001:2:${_fib}::2 + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + PEERADDR=2001:2:${fib}::2 - print_debug "${_n} ${_fib}" + print_debug "${_n} ${fib}" # Setup expected return values. i=0 while test ${i} -lt ${RT_NUMFIBS}; do eval rc_${i}_l=0 case ${i} in - ${_fib}) + ${fib}) eval rc_${i}_a=0 ;; *) eval rc_${i}_a=1 @@ -732,20 +733,20 @@ testtx_ulp6_connected_ifconfig_transfern i=$((i + 1)) done - ifconfig ${IFACE} fib ${_fib} + ifconfig ${IFACE} fib ${fib} - testtx_ulp6_connected "${_n}${_fib}" "${_o}" ${_fib} - _fib=$((_fib + 1)) + testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} + fib=$((fib + 1)) done # Restore PEERADDR PEERADDR=${_p} # Cleanup transfer networks. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias - _fib=$((_fib + 1)) + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias + fib=$((fib + 1)) done ifconfig ${IFACE} fib 0 } @@ -779,23 +780,23 @@ testtx_udp6_connected_ifconfig_transfern # testtx_ulp6_gateway() { - local _fib i _n _o _p + local fib i _n _o _p _n="$1" _o="$2" # Setup default gateway and expected error codes. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} route delete -inet6 -net default \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 || true - setfib -F${_fib} route add -inet6 -net default ${PEERADDR} \ + setfib -F${fib} route add -inet6 -net default ${PEERADDR} \ > /dev/null 2>&1 case "${_o}" in - -i) eval rc_${_fib}_l=0 ;; # ICMPv6 will succeed - *) eval rc_${_fib}_l=1 ;; + -i) eval rc_${fib}_l=0 ;; # ICMPv6 will succeed + *) eval rc_${fib}_l=1 ;; esac - eval rc_${_fib}_a=0 - _fib=$((_fib + 1)) + eval rc_${fib}_a=0 + fib=$((fib + 1)) done # Save PEERADDR @@ -810,11 +811,11 @@ testtx_ulp6_gateway() PEERADDR=${_p} # Cleanup transfer networks. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} route delete -inet6 -net default \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 - _fib=$((_fib + 1)) + fib=$((fib + 1)) done } @@ -851,38 +852,38 @@ testtx_udp6_gateway() # testtx_ulp6_transfernets_gateways() { - local _fib i _n _o _p + local fib i _n _o _p _n="$1" _o="$2" # Setup transfer networks, default routes, and firewall. - _fib=0 + fib=0 ipfw delete 10 > /dev/null 2>&1 || true - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 || true - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 alias \ + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias \ > /dev/null 2>&1 - ipfw add 10 setfib ${_fib} ipv6-icmp \ - from 2001:2:${_fib}::/64 to any ip6 icmp6types 135,136 \ + ipfw add 10 setfib ${fib} ipv6-icmp \ + from 2001:2:${fib}::/64 to any ip6 icmp6types 135,136 \ via ${IFACE} in > /dev/null 2>&1 # Remove connected routes from all but matching FIB. i=0 while test ${i} -lt ${RT_NUMFIBS}; do case ${i} in - ${_fib});; + ${fib});; *) setfib -F${i} route delete -inet6 \ - -net 2001:2:${_fib}:: > /dev/null 2>&1 + -net 2001:2:${fib}:: > /dev/null 2>&1 ;; esac i=$((i + 1)) done # Add default route. - setfib -F${_fib} route delete -inet6 -net default \ + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 || true - setfib -F${_fib} route add -inet6 -net default \ - 2001:2:${_fib}::2 > /dev/null 2>&1 - _fib=$((_fib + 1)) + setfib -F${fib} route add -inet6 -net default \ + 2001:2:${fib}::2 > /dev/null 2>&1 + fib=$((fib + 1)) done # Save PEERADDR @@ -908,13 +909,13 @@ testtx_ulp6_transfernets_gateways() PEERADDR=${_p} # Cleanup default routes, transfer networks, and firewall. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} route delete -inet6 -net default \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 - _fib=$((_fib + 1)) + fib=$((fib + 1)) done ipfw delete 10 > /dev/null 2>&1 } @@ -954,33 +955,33 @@ testtx_udp6_transfernets_gateways() # testtx_ulp6_transfernets_gateway() { - local _fib i _n _o _p + local fib i _n _o _p _n="$1" _o="$2" # Setup transfer networks, default routes, and firewall. - _fib=0 + fib=0 ipfw delete 10 > /dev/null 2>&1 || true - while test ${_fib} -lt ${RT_NUMFIBS}; do - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + while test ${fib} -lt ${RT_NUMFIBS}; do + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 || true - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 alias \ + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 alias \ > /dev/null 2>&1 - ipfw add 10 setfib ${_fib} ipv6-icmp \ - from 2001:2:${_fib}::/64 to any ip6 icmp6types 135,136 \ + ipfw add 10 setfib ${fib} ipv6-icmp \ + from 2001:2:${fib}::/64 to any ip6 icmp6types 135,136 \ via ${IFACE} in > /dev/null 2>&1 # Remove connected routes from all but matching FIB. i=0 while test ${i} -lt ${RT_NUMFIBS}; do case ${i} in - ${_fib});; + ${fib});; *) setfib -F${i} route delete -inet6 \ - -net 2001:2:${_fib}:: > /dev/null 2>&1 + -net 2001:2:${fib}:: > /dev/null 2>&1 ;; esac i=$((i + 1)) done - _fib=$((_fib + 1)) + fib=$((fib + 1)) done # Save PEERADDR @@ -988,10 +989,10 @@ testtx_ulp6_transfernets_gateway() PEERADDR="2001:2:ff01::2" # Run tests. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do - print_debug "${_n} ${_fib}" + print_debug "${_n} ${fib}" # Setup expected return values. i=0 @@ -1001,7 +1002,7 @@ testtx_ulp6_transfernets_gateway() *) eval rc_${i}_l=1 ;; esac case ${i} in - ${_fib}) + ${fib}) eval rc_${i}_a=0 ;; *) eval rc_${i}_a=1 @@ -1011,30 +1012,30 @@ testtx_ulp6_transfernets_gateway() done # Add default route. - setfib -F${_fib} route delete -inet6 -net default \ + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 || true - setfib -F${_fib} route add -inet6 -net default \ - 2001:2:${_fib}::2 > /dev/null 2>&1 + setfib -F${fib} route add -inet6 -net default \ + 2001:2:${fib}::2 > /dev/null 2>&1 - testtx_ulp6_connected "${_n}${_fib}" "${_o}" ${_fib} + testtx_ulp6_connected "${_n}${fib}" "${_o}" ${fib} # Delete default route again. - setfib -F${_fib} route delete -inet6 -net default \ + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 - _fib=$((_fib + 1)) + fib=$((fib + 1)) done # Restore PEERADDR PEERADDR=${_p} # Cleanup default routes, transfer networks, and firewall. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} route delete -inet6 -net default \ + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} route delete -inet6 -net default \ > /dev/null 2>&1 - ifconfig ${IFACE} inet6 2001:2:${_fib}::1/64 -alias \ + ifconfig ${IFACE} inet6 2001:2:${fib}::1/64 -alias \ > /dev/null 2>&1 - _fib=$((_fib + 1)) + fib=$((fib + 1)) done ipfw delete 10 > /dev/null 2>&1 } @@ -1356,7 +1357,7 @@ testrx_main_setup_rc() testrx_main() { - local _n _o s t _fib _instances _destructive _transfer + local _n _o s t fib _instances _destructive _transfer _n="$1" _o="$2" _instances=$3 @@ -1369,14 +1370,14 @@ testrx_main() for t in ipfw ifconfig; do print_debug "${_n}_${t}" - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do testrx_main_setup_rc "${_n}" "${t}" \ - ${_fib} "${_o}" ${_instances} \ + ${fib} "${_o}" ${_instances} \ ${_destructive} ${_transfer} - _fib=$((_fib + 1)) + fib=$((fib + 1)) done done done @@ -1432,10 +1433,14 @@ testrx_udp6_same_addr_all_fibs_a_time() # # Prereqs. # -kldload ipfw > /dev/null 2>&1 || kldstat -v | grep -q ipfw +if test `sysctl -n security.jail.jailed` -eq 0; then + kldload ipfw > /dev/null 2>&1 || kldstat -v | grep -q ipfw -# Reduce the time we wait in case of no reply to 2s. -sysctl net.inet.tcp.keepinit=2000 > /dev/null 2>&1 + # Reduce the time we wait in case of no reply to 2s. + sysctl net.inet.tcp.keepinit=2000 > /dev/null 2>&1 +fi +ipfw -f flush > /dev/null 2>&1 || die "please load ipfw in base system" +ipfw add 65000 permit ip from any to any > /dev/null 2>&1 ################################################################################ # @@ -1491,7 +1496,7 @@ for uso in 0 1; do testtx_udp6_transfernets_gateway && sleep 1 done -# Receiver testering. +# Receiver testing. for uso in 0 1; do USE_SOSETFIB=${uso} Modified: stable/9/tools/test/netfibs/reflector.sh ============================================================================== --- head/tools/test/netfibs/reflector.sh Fri Feb 17 04:26:24 2012 (r231858) +++ stable/9/tools/test/netfibs/reflector.sh Mon Mar 5 19:13:18 2012 (r232566) @@ -70,6 +70,7 @@ delay() # sleep 1 is too long. touch /tmp/foo || true + stat /tmp/foo > /dev/null 2>&1 || true } check_rc() @@ -222,7 +223,7 @@ testtx_udp6_connected() # testtx_icmp6_connected_blackhole() { - local _opts _fib + local _opts fib _opts="" case ${DEBUG} in @@ -231,20 +232,20 @@ testtx_icmp6_connected_blackhole() *) _opts="-d" ;; esac - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do print_debug "./reflect -p ${CTRLPORT} -T TCP6 " \ - "-t testtx_icmp6_connected_blackhole${_fib} ${_opts}" + "-t testtx_icmp6_connected_blackhole${fib} ${_opts}" ./reflect -p ${CTRLPORT} -T TCP6 \ - -t testtx_icmp6_connected_blackhole${_fib} ${_opts} + -t testtx_icmp6_connected_blackhole${fib} ${_opts} print_debug "reflect terminated without error." - _fib=$((_fib + 1)) + fib=$((fib + 1)) done } testtx_tcp6_connected_blackhole() { - local _opts _fib + local _opts fib _opts="" case ${DEBUG} in @@ -253,20 +254,20 @@ testtx_tcp6_connected_blackhole() *) _opts="-d" ;; esac - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do print_debug "./reflect -p ${CTRLPORT} -T TCP6 " \ - "-t testtx_tcp6_connected_blackhole${_fib} ${_opts}" + "-t testtx_tcp6_connected_blackhole${fib} ${_opts}" ./reflect -p ${CTRLPORT} -T TCP6 \ - -t testtx_tcp6_connected_blackhole${_fib} ${_opts} + -t testtx_tcp6_connected_blackhole${fib} ${_opts} print_debug "reflect terminated without error." - _fib=$((_fib + 1)) + fib=$((fib + 1)) done } testtx_udp6_connected_blackhole() { - local _opts _fib + local _opts fib _opts="" case ${DEBUG} in @@ -275,14 +276,14 @@ testtx_udp6_connected_blackhole() *) _opts="-d" ;; esac - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do print_debug "./reflect -p ${CTRLPORT} -T UDP6 " \ - "-t testtx_udp6_connected_blackhole${_fib} ${_opts}" + "-t testtx_udp6_connected_blackhole${fib} ${_opts}" ./reflect -p ${CTRLPORT} -T UDP6 \ - -t testtx_udp6_connected_blackhole${_fib} ${_opts} + -t testtx_udp6_connected_blackhole${fib} ${_opts} print_debug "reflect terminated without error." - _fib=$((_fib + 1)) + fib=$((fib + 1)) done } @@ -290,7 +291,7 @@ testtx_udp6_connected_blackhole() # testtx_ulp6_connected_transfernets() { - local _opts _fib _n _o + local _opts fib _n _o _n="$1" _o="$2" @@ -302,28 +303,28 @@ testtx_ulp6_connected_transfernets() esac # Setup transfer networks. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} \ - ifconfig ${IFACE} inet6 2001:2:${_fib}::2/64 alias - _fib=$((_fib + 1)) + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} \ + ifconfig ${IFACE} inet6 2001:2:${fib}::2/64 alias + fib=$((fib + 1)) done - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - print_debug "./reflect -p ${CTRLPORT} -T ${_o} -t ${_n}${_fib} ${_opts}" - ./reflect -p ${CTRLPORT} -T ${_o} -t ${_n}${_fib} ${_opts} + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + print_debug "./reflect -p ${CTRLPORT} -T ${_o} -t ${_n}${fib} ${_opts}" + ./reflect -p ${CTRLPORT} -T ${_o} -t ${_n}${fib} ${_opts} print_debug "reflect terminated without error." - _fib=$((_fib + 1)) + fib=$((fib + 1)) done # Cleanup transfer networks. - _fib=0 - while test ${_fib} -lt ${RT_NUMFIBS}; do - setfib -F${_fib} \ - ifconfig ${IFACE} inet6 2001:2:${_fib}::2/64 -alias + fib=0 + while test ${fib} -lt ${RT_NUMFIBS}; do + setfib -F${fib} \ + ifconfig ${IFACE} inet6 2001:2:${fib}::2/64 -alias delay - _fib=$((_fib + 1)) + fib=$((fib + 1)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203051913.q25JDI8j000595>