Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2012 20:59:45 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r232985 - projects/multi-fibv6/7/tools/test/netfibs
Message-ID:  <201203142059.q2EKxjeJ031347@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Wed Mar 14 20:59:45 2012
New Revision: 232985
URL: http://svn.freebsd.org/changeset/base/232985

Log:
  Add a test case for each FIB to properly populate on traffic, checking
  both netstat -rnf inet6 and ndp -an for the neighbor.
  
  Add a) longer delays and b) clear the neighbor table between each test
  case to make stable/7 testing a lot more deterministic and less exposed
  to network stack address list locking, etc. races.  It's very close to
  be deterministic in all cases with that.
  
  Adjust the expected return codes for the few cases that behave differently
  in 7 to 8 and later.
  
  Update documentation for the new test and correct some spelling errors.
  
  Sponsored by:	Cisco Systems, Inc.

Added:
  projects/multi-fibv6/7/tools/test/netfibs/checknd6.sh   (contents, props changed)
Modified:
  projects/multi-fibv6/7/tools/test/netfibs/README
  projects/multi-fibv6/7/tools/test/netfibs/initiator.sh
  projects/multi-fibv6/7/tools/test/netfibs/reflector.sh

Modified: projects/multi-fibv6/7/tools/test/netfibs/README
==============================================================================
--- projects/multi-fibv6/7/tools/test/netfibs/README	Wed Mar 14 20:57:48 2012	(r232984)
+++ projects/multi-fibv6/7/tools/test/netfibs/README	Wed Mar 14 20:59:45 2012	(r232985)
@@ -9,13 +9,12 @@ reflect.c
 	Makefile just builds reflect, a program to echo data on a TCP or UDP
 	socket in very simplistic ways.  It has a couple of options to provide
 	an address or port, a FIB to bind to or a FIB to add to a reflected
-	message as well as some "magic" keyword handling to let the intiators
+	message as well as some "magic" keyword handling to let the initiators
 	control it.
 
 initiator.sh and reflector.sh
 
-	intiator.sh runs two local test cases, one which shows a documented
-	limitation.
+	initiator.sh runs two local test cases.
 
 	All further tests are either exercising the sending or receiving of
 	ICMP6, TCP or UDP packets with multiple FIBs.  initiator.sh and
@@ -28,7 +27,7 @@ initiator.sh and reflector.sh
 	depend on ping6, netcat, awk, tr and ipfw.  The interface to use can
 	be set from the environment.  The commands can be run like:
 	
-	env IFACE=ifname sh intiator.sh
+	env IFACE=ifname sh initiator.sh
 	env IFACE=ifname sh reflector.sh
 	
 	Both scripts also support a DEBUG environment variable for additional
@@ -43,6 +42,17 @@ initiator.sh and reflector.sh
 	It is suggested to run one test case at a time manually disabling
 	the others in both scripts.
 
+checknd6.sh
+
+	Check seeding of neighbor table (netstat and ndp) for each FIB
+	individually by changing to that FIB ping6ing the reflector host
+	from initiator and in addition to checking the ping6 result code
+	grep the netstat -rnf inet6 and ndp -an output for the address.
+	Run as:
+
+	env IFACE=ifname sh checknd6.sh initiator
+	env IFACE=ifname sh checknd6.sh reflector
+
 forwarding.sh
 
 	forwarding.sh tests FIBs in the forwarding path, making sure that

Added: projects/multi-fibv6/7/tools/test/netfibs/checknd6.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/multi-fibv6/7/tools/test/netfibs/checknd6.sh	Wed Mar 14 20:59:45 2012	(r232985)
@@ -0,0 +1,350 @@
+#!/bin/sh
+#-
+# Copyright (c) 2012 Cisco Systems, Inc.
+# All rights reserved.
+#
+# This software was developed by Bjoern Zeeb under contract to
+# Cisco Systems, Inc..
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# We will use the RFC5180 (and Errata) benchmarking working group prefix
+# 2001:0002::/48 for testing.
+PREFIX="2001:2:"
+
+# Set IFACE to the real interface you want to run the test on.
+: ${IFACE:=lo0}
+
+# Number of seconds to wait for peer node to synchronize for test.
+: ${WAITS:=120}
+
+# Control port we use to exchange messages between nodes to sync. tests, etc.
+: ${CTRLPORT:=6666}
+
+# Get the number of FIBs from the kernel.
+RT_NUMFIBS=`sysctl -n net.fibs`
+
+OURADDR="2001:2:ff00::1"
+PEERADDR="2001:2:ff00::2"
+PEERLINKLOCAL=""
+
+# By default all commands must succeed.  Individual tests may disable this
+# temporary.
+set -e
+
+# Debug magic.
+case "${DEBUG}" in
+42)	set -x ;;
+esac
+
+
+################################################################################
+#
+# Input validation.
+#
+
+node=$1
+case ${node} in
+initiator)	;;
+reflector)	;;
+*)	echo "ERROR: invalid node name '${node}'. Must be initiator or" \
+	    " reflector" >&1
+	exit 1
+	;;
+esac
+
+################################################################################
+#
+# Helper functions.
+#
+check_rc()
+{
+	local _rc _exp _testno _testname _msg _r
+	_rc=$1
+	_exp=$2
+	_testno=$3
+	_testname="$4"
+	_msg="$5"
+
+	_r="not ok"
+	if test ${_rc} -eq ${_exp}; then
+		_r="ok"
+	fi
+	echo "${_r} ${_testno} ${_testname} # ${_msg} ${_rc} ${_exp}"
+}
+
+print_debug()
+{
+	local _msg
+	_msg="$*"
+
+	case ${DEBUG} in
+	''|0)	;;
+	*)	echo "DEBUG: ${_msg}" >&2 ;;
+	esac
+}
+
+die()
+{
+	local _msg
+	_msg="$*"
+
+	echo "ERROR: ${_msg}" >&2
+	exit 1
+}
+
+nc_send_recv()
+{
+	local _loops _msg _expreply _addr _port _opts i
+	_loops=$2
+	_msg="$3"
+	_expreply="$4"
+	_addr=$5
+	_port=$6
+	_opts="$7"
+
+	i=0
+	while test ${i} -lt ${_loops}; do
+		i=$((i + 1))
+		_reply=`echo "${_msg}" | nc -V 0 ${_opts} ${_addr} ${_port}`
+		if test "${_reply}" != "${_expreply}"; then
+			if test ${i} -lt ${_loops}; then
+				sleep 1
+			else
+			# Must let caller decide how to handle the error.
+			#	die "Got invalid reply from peer." \
+			#	    "Expected '${_expreply}', got '${_reply}'"
+				return 1
+			fi
+		else
+			break
+		fi
+	done
+	return 0
+}
+
+send_greeting()
+{
+        local _type _greeting _keyword _linklocal
+	_type="$1"
+
+	set +e
+	i=0
+	rc=-1
+	while test ${i} -lt ${WAITS} -a ${rc} -ne 0; do
+		print_debug "Sending greeting #${i} to peer"
+		_greeting=`echo "${_type}" | \
+		    nc -6 -w 1 ${PEERADDR} ${CTRLPORT}`
+		rc=$?
+		i=$((i + 1))
+		# Might sleep longer in total but better than to DoS
+		# and not get anywhere.
+		sleep 1
+	done
+	set -e
+
+	read _keyword _linklocal <<EOI
+${_greeting}
+EOI
+	print_debug "_keyword=${_keyword}"
+	print_debug "_linklocal=${_linklocal}"
+	case ${_keyword} in
+	${_type})	;;
+	*)	die "Got invalid keyword in greeting: ${_greeting}"
+	;;
+	esac
+	PEERLINKLOCAL=${_linklocal}
+
+	# Swap the zoneid to the local interface scope.
+	PEERLINKLOCAL=${PEERLINKLOCAL%%\%*}"%${IFACE}"
+
+	print_debug "Successfully exchanged greeting. Peer at ${PEERLINKLOCAL}"
+}
+
+# We are setup.  Wait for the initiator to tell us that it is ready.
+wait_remote_ready()
+{
+        local _case _msg _keyword
+	_case="$1"
+
+	# Wait for the remote to connect and start things.
+	# We tell it the magic keyword, and our number of FIBs.
+	_msg=`echo "${_case} ${PEERLINKLOCAL}" | nc -6 -l ${CTRLPORT}`
+
+	read _keyword <<EOI
+${_msg}
+EOI
+	print_debug "_keyword=${_keyword}"
+	case ${_keyword} in
+	${_case});;
+	*)	die "Got invalid keyword in control message: ${_msg}"
+		;;
+	esac
+
+	print_debug "Successfully received control message."
+}
+
+setup_addr_initiator()
+{
+	local i
+
+	print_debug "Setting up interface ${IFACE}"
+	ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up
+	OURLINKLOCAL=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'`
+
+	i=0
+	while test ${i} -lt ${RT_NUMFIBS}; do
+		setfib -F ${i} ndp -cn > /dev/null 2>&1
+		i=$((i + 1))
+	done
+
+	# Let things settle.
+	print_debug "Waiting 4 seconds for things to settle"
+	sleep 4
+}
+
+setup_addr_reflector()
+{
+	local i
+
+	print_debug "Setting up interface ${IFACE}"
+	ifconfig ${IFACE} inet6 ${PEERADDR}/64 alias up
+	PEERLINKLOCAL=`ifconfig ${IFACE} | awk '/inet6 fe80:/ { print $2 }'`
+
+	i=0
+	while test ${i} -lt ${RT_NUMFIBS}; do
+		setfib -F ${i} ndp -cn > /dev/null 2>&1
+		i=$((i + 1))
+	done
+
+	# Let things settle.
+	print_debug "Waiting 4 seconds for things to settle"
+	sleep 2
+}
+
+cleanup_addr()
+{
+	local addr
+	addr="$1"
+
+	print_debug "Removing address from interface ${IFACE}"
+	ifconfig ${IFACE} inet6 ${addr}/64 -alias
+}
+
+################################################################################
+
+check_netstat_rn()
+{
+	local testno fib addr ext c
+	testno=$1
+	fib=$2
+	addr="$3"
+	ext="$4"
+
+	c=`netstat -rnf inet6 | egrep "^${addr}[[:space:]]" | wc -l`
+	check_rc ${c} 1 ${testno} "check_netstat_addr_${fib}_${ext}" \
+	    "FIB ${fib} ${addr}"
+	if test ${c} -ne 1; then
+		print_debug "`netstat -rnf inet6`"
+	fi
+}
+
+check_ndp()
+{
+	local testno fib addr ext c
+	testno=$1
+	fib=$2
+	addr="$3"
+	ext="$4"
+
+	# Check that the entry is there and 'R'eachable still.
+	c=`ndp -an | egrep "^${addr}[[:space:]].*R" | wc -l`
+	check_rc ${c} 1 ${testno} "check_ndp_addr_${fib}_${ext}" \
+	    "FIB ${fib} ${addr}"
+	if test ${c} -ne 1; then
+		print_debug "`ndp -an`"
+	fi
+}
+
+check_nd6()
+{
+	local testno fib
+
+	printf "1..%d\n" `expr 6 \* ${RT_NUMFIBS}`
+	testno=1
+	fib=0
+	set +e
+	while test ${fib} -lt ${RT_NUMFIBS}; do
+		print_debug "Testing FIB ${fib}"
+
+		setfib -F${fib} ping6 -n -c3 ${PEERLINKLOCAL} > /dev/null 2>&1
+		check_rc $? 0 ${testno} "check_local_addr_${fib}_l" \
+		    "FIB ${fib} ${_l}"
+		testno=$((testno + 1))
+
+		check_netstat_rn ${testno} ${fib} ${PEERLINKLOCAL} "l"
+		testno=$((testno + 1))
+
+		check_ndp ${testno} ${fib} ${PEERLINKLOCAL} "l"
+		testno=$((testno + 1))
+
+		setfib -F${fib} ping6 -n -c3 ${PEERADDR} > /dev/null 2>&1
+		check_rc $? 0 ${testno} "check_local_addr_${fib}_a" \
+		    "FIB ${fib} ${OURADDR}"
+		testno=$((testno + 1))
+
+		check_netstat_rn ${testno} ${fib} ${PEERADDR} "a"
+		testno=$((testno + 1))
+
+		check_ndp ${testno} ${fib} ${PEERADDR} "a"
+		testno=$((testno + 1))
+
+		fib=$((fib + 1))
+	done
+	set -e
+}
+
+################################################################################
+#
+# MAIN
+#
+
+case ${node} in
+initiator)
+	setup_addr_initiator
+	send_greeting BEGIN
+	check_nd6
+	send_greeting END
+	cleanup_addr ${OURADDR}
+	;;
+reflector)
+	setup_addr_reflector
+	wait_remote_ready BEGIN
+	wait_remote_ready END
+	cleanup_addr ${PEERADDR}
+	;;
+esac
+
+# end

Modified: projects/multi-fibv6/7/tools/test/netfibs/initiator.sh
==============================================================================
--- projects/multi-fibv6/7/tools/test/netfibs/initiator.sh	Wed Mar 14 20:57:48 2012	(r232984)
+++ projects/multi-fibv6/7/tools/test/netfibs/initiator.sh	Wed Mar 14 20:59:45 2012	(r232985)
@@ -100,6 +100,18 @@ die()
 	exit 1
 }
 
+clean_ndp_cn()
+{
+	local cn
+
+	cn=0
+	while test ${cn} -lt ${RT_NUMFIBS}; do
+		setfib -F ${cn} ndp -cn > /dev/null 2>&1
+		cn=$((cn + 1))
+	done
+}
+
+
 #
 # Test functions.
 #
@@ -167,7 +179,8 @@ check_local_tun()
 		print_debug "Testing FIB ${i}"
 		if test ${i} -gt 0; then
 			# Flag the well known behaviour as such.
-			_msg="TODO "
+			# Is fine on 7.x
+			#_msg="TODO "
 		fi
 
 		setfib -F${i} ping6 -n -c1 ${_l} > /dev/null 2>&1
@@ -198,9 +211,6 @@ check_remote_up()
 	# Let things settle.
 	print_debug "Waiting 4 seconds for things to settle"
 	sleep 4
-
-
-
 }
 
 send_greeting()
@@ -382,14 +392,14 @@ testtx_tcp_udp()
 		eval _rc="\${rc_${i}_l}"
 		_fibtxt="${_n}_${i}_l ${_f} ${i} ${PEERLINKLOCAL}"
 		nc_send_recv ${i} 1 "${_fibtxt}" "${_fibtxt}" ${PEERLINKLOCAL} \
-		    ${CTRLPORT} "-6 ${_o} -w1"
+		    ${CTRLPORT} "-6 ${_o} -w2"
 		check_rc $? ${_rc} ${testno} "${_fibtxt}"
 		testno=$((testno + 1))
 
 		eval _rc="\${rc_${i}_a}"
 		_fibtxt="${_n}_${i}_a ${_f} ${i} ${PEERADDR}"
 		nc_send_recv ${i} 1 "${_fibtxt}" "${_fibtxt}" ${PEERADDR} \
-		    ${CTRLPORT} "-6 ${_o} -w1"
+		    ${CTRLPORT} "-6 ${_o} -w2"
 		check_rc $? ${_rc} ${testno} "${_fibtxt}"
 		testno=$((testno + 1))
 
@@ -427,7 +437,7 @@ testtx_ulp6_connected()
 	# Let peer know that we are about to start.
 	_msg="START ${_n}"
 	nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \
-	    ${CTRLPORT} "-6 ${_opts} -w1"
+	    ${CTRLPORT} "-6 ${_opts} -w2"
 	case $? in
 	0)	;;
 	*)	die "Got invalid reply from peer." \
@@ -443,7 +453,7 @@ testtx_ulp6_connected()
 	# This must immediately succeed.
 	_msg="DONE ${_n}"
 	nc_send_recv ${_fib} ${WAITS} "${_msg}" "${_msg}" ${PEERADDR} \
-	    ${CTRLPORT} "-6 ${_opts} -w1"
+	    ${CTRLPORT} "-6 ${_opts} -w2"
 	case $? in
 	0)	;;
 	*)	die "Got invalid reply from peer." \
@@ -613,6 +623,9 @@ testtx_ulp6_connected_transfernets()
 		fib=$((fib + 1))
 	done
 
+	# Let things settle.
+	sleep 5
+
 	# Save PEERADDR
 	_p=${PEERADDR}
 
@@ -712,6 +725,9 @@ testtx_ulp6_connected_ifconfig_transfern
 	# Save PEERADDR
 	_p=${PEERADDR}
 
+	# Let things settle.
+	sleep 5
+
 	# Run tests.
 	fib=0
 	while test ${fib} -lt ${RT_NUMFIBS}; do
@@ -890,6 +906,9 @@ testtx_ulp6_transfernets_gateways()
 	_p=${PEERADDR}
 	PEERADDR="2001:2:ff01::2"
 
+	# Let things settle.
+	sleep 4
+
 	# Setup expected return values.
 	i=0
 	while test ${i} -lt ${RT_NUMFIBS}; do
@@ -988,6 +1007,9 @@ testtx_ulp6_transfernets_gateway()
 	_p=${PEERADDR}
 	PEERADDR="2001:2:ff01::2"
 
+	# Let things settle.
+	sleep 4
+
 	# Run tests.
 	fib=0
 	while test ${fib} -lt ${RT_NUMFIBS}; do
@@ -1200,6 +1222,9 @@ testrx_setup_transfer_networks()
 		ifconfig ${IFACE} inet6 2001:2:${i}::1/64 alias
 		i=$((i + 1))
 	done
+
+	# Let things settle.
+	sleep 4
 }
 
 testrx_cleanup_transfer_networks()
@@ -1218,6 +1243,7 @@ testrx_cleanup_transfer_networks()
 testrx_run_test()
 {
 	local _n _t _fib _o _txt _msg i _reply _instances _destructive _transfer
+	local cn
 	_n="$1"
 	_t="$2"
 	_fib=$3
@@ -1246,8 +1272,14 @@ testrx_run_test()
 	1)	testrx_setup_transfer_networks ;;
 	esac
 
+	cn=0
+	while test ${cn} -lt ${RT_NUMFIBS}; do
+		setfib -F ${cn} ndp -cn > /dev/null 2>&1
+		cn=$((cn + 1))
+	done
+
 	# Let the other side a chance to get ready as well.
-	sleep 1
+	sleep 2
 
 	set +e
 	# Let peer know that we are about to start.
@@ -1261,7 +1293,7 @@ testrx_run_test()
 	esac
 
 	# Let the other side a chance to get ready as well.
-	sleep 1
+	sleep 2
 
 	# Send probe.
 	case "${_o}" in
@@ -1282,10 +1314,10 @@ testrx_run_test()
 	esac
 
 	# Collect and validate the results.   Always use TCP.
-	sleep 1
+	sleep 2
 	set +e
 	nc_send_recv ${_fib} 1 "RESULT REQUEST" "" ${PEERADDR} \
-	    ${CTRLPORT} "-6 -w1"
+	    ${CTRLPORT} "-6 -w3"
 	case "${_reply}" in
 	RESULT\ *) testrx_results ${_fib} "${_txt}_" "${_reply}" ${_instances} \
 			${_transfer} "${_o}"
@@ -1332,14 +1364,32 @@ testrx_main_setup_rc()
 				case "${_o}" in
 				-i)	case ${_transfer} in
 					0) eval rc_${i}_a=0 ;;
-					1) eval rc_${i}_a=1 ;;
+					1) # 7.x always ok in this case
+					   if test ${_instances} -eq 1 -a \
+					      "${_t}" = "ifconfig"; then
+						eval rc_${i}_a=0
+					   elif test ${_fib} -eq 0 -a \
+					      "${_t}" = "ipfw" -a \
+					      "${_instances}" -eq 1; then
+						eval rc_${i}_a=0
+					   else
+						eval rc_${i}_a=1
+					   fi
+						;;
 					esac
 					;;
 				*)	if test ${_instances} -eq 1 -a \
 					    ${_transfer} -eq 0; then
 						eval rc_${i}_a=0
-					else
+					elif test ${_instances} -eq \
+					    ${RT_NUMFIBS} -a \
+					    ${i} -ne 0; then
+						# 7.x returns 0 for FIB0 and
+					        # the FIB-UT, 1 otherwise.
 						eval rc_${i}_a=1
+					else
+						# 7.x also returns 0 here.
+						eval rc_${i}_a=0
 					fi
 					;;
 				esac
@@ -1460,39 +1510,60 @@ for uso in 0 1; do
 
 	# Only run ICMP6 tests for the first loop.
 	# 160 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_connected && sleep 1
+	clean_ndp_cn
 	testtx_udp6_connected && sleep 1
 
 	# 2560 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected_blackhole && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_connected_blackhole && sleep 1
+	clean_ndp_cn
 	testtx_udp6_connected_blackhole && sleep 1
 
 	# 2560 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected_transfernets && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_connected_transfernets && sleep 1
+	clean_ndp_cn
 	testtx_udp6_connected_transfernets && sleep 1
 
 	# 2560 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || \
 	    testtx_icmp6_connected_ifconfig_transfernets && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_connected_ifconfig_transfernets && sleep 1
+	clean_ndp_cn
 	testtx_udp6_connected_ifconfig_transfernets && sleep 1
 
 	# 160 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_gateway && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_gateway && sleep 1
+	clean_ndp_cn
 	testtx_udp6_gateway && sleep 1
 
 	# 160 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_transfernets_gateways && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_transfernets_gateways && sleep 1
+	clean_ndp_cn
 	testtx_udp6_transfernets_gateways && sleep 1
 
 	# 2560 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_transfernets_gateway && sleep 1
+	clean_ndp_cn
 	testtx_tcp6_transfernets_gateway && sleep 1
+	clean_ndp_cn
 	testtx_udp6_transfernets_gateway && sleep 1
 done
 
@@ -1503,15 +1574,21 @@ for uso in 0 1; do
 
 	# Only expect ICMP6 tests for the first loop.
 	# 6144 cases at 16 FIBs.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testrx_icmp6_same_addr_one_fib_a_time && sleep 1
+
 	# 12288 cases at 16 FIBs.
+	clean_ndp_cn
 	testrx_tcp6_same_addr_one_fib_a_time && sleep 1
 	# 12288 cases at 16 FIBs.
+	clean_ndp_cn
 	testrx_udp6_same_addr_one_fib_a_time && sleep 1
 
 	# 12288 cases at 16 FIBs.
+	clean_ndp_cn
 	testrx_tcp6_same_addr_all_fibs_a_time && sleep 1
 	# 12288 cases at 16 FIBs.
+	clean_ndp_cn
 	testrx_udp6_same_addr_all_fibs_a_time && sleep 1
 
 done

Modified: projects/multi-fibv6/7/tools/test/netfibs/reflector.sh
==============================================================================
--- projects/multi-fibv6/7/tools/test/netfibs/reflector.sh	Wed Mar 14 20:57:48 2012	(r232984)
+++ projects/multi-fibv6/7/tools/test/netfibs/reflector.sh	Wed Mar 14 20:59:45 2012	(r232985)
@@ -109,6 +109,17 @@ die()
 	exit 1
 }
 
+clean_ndp_cn()
+{
+	local cn
+
+	cn=0
+	while test ${cn} -lt ${RT_NUMFIBS}; do
+		setfib -F ${cn} ndp -cn > /dev/null 2>&1
+		cn=$((cn + 1))
+	done
+}
+
 #
 # Test functions.
 #
@@ -310,6 +321,12 @@ testtx_ulp6_connected_transfernets()
 		fib=$((fib + 1))
 	done
 
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 2 seconds for things to settle"
+	sleep 2
+
 	fib=0
 	while test ${fib} -lt ${RT_NUMFIBS}; do
 		print_debug "./reflect -p ${CTRLPORT} -T ${_o} -t ${_n}${fib} ${_opts}"
@@ -382,6 +399,12 @@ testtx_ulp6_gateway()
 	delay
 	ifconfig lo0 inet6 2001:2:ff01::2 alias
 
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 1 seconds for things to settle"
+	sleep 1
+
 	_opts=""
 	case ${DEBUG} in
 	''|0)	;;
@@ -445,6 +468,12 @@ testtx_ulp6_transfernets_gateways()
 	delay
 	ifconfig lo0 inet6 2001:2:ff01::2 alias
 
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 1 seconds for things to settle"
+	sleep 1
+
 	# Reflect requests.
 	print_debug "./reflect -p ${CTRLPORT} -T ${_o} " \
 	    "-t ${_n} ${_opts} -A 2001:2:ff01::2"
@@ -513,6 +542,12 @@ testtx_ulp6_transfernets_gateway()
 	delay
 	ifconfig lo0 inet6 2001:2:ff01::2 alias
 
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 1 seconds for things to settle"
+	sleep 1
+
 	# Reflect requests.
 	fib=0
 	while test ${fib} -lt ${RT_NUMFIBS}; do
@@ -586,6 +621,12 @@ textrx_ipfw_setup()
 	ipfw add 100 setfib ${_fib} ipv6-icmp \
 	    from ${PEERLINKLOCAL%\%*} to ${OURLINKLOCAL%\%*} \
 	    via ${IFACE} in > /dev/null 2>&1
+	ipfw add 100 setfib ${_fib} ipv6-icmp \
+	    from ${PEERLINKLOCAL%\%*} to ff02::/16 \
+	    via ${IFACE} in > /dev/null 2>&1
+	ipfw add 100 setfib ${_fib} ipv6-icmp \
+	    from :: to ff02::/16 \
+	    via ${IFACE} in > /dev/null 2>&1
 
 	# Always also do a setfib for the control port so that OOB
 	# signaling workes even if we remove connected subnets.
@@ -798,6 +839,12 @@ testrx_cleanup_connected()
 		delay
 		ifconfig ${IFACE} inet6 ${OURADDR}/64 alias up
 	fi
+
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 1 seconds for things to settle"
+	sleep 1
 }
 
 testrx_setup_transfer_networks()
@@ -812,6 +859,12 @@ testrx_setup_transfer_networks()
 		ifconfig ${IFACE} inet6 2001:2:${i}::2/64 alias
 		i=$((i + 1))
 	done
+
+	clean_ndp_cn
+
+	# Let things settle.
+	print_debug "Waiting 1 seconds for things to settle"
+	sleep 1
 }
 
 testrx_run_one()
@@ -881,6 +934,7 @@ testrx_run_multiple()
 testrx_run_test()
 {
 	local _n _t _fib _o _txt i _f _instance _destructive _transfer
+	local cn
 	_n="$1"
 	_t="$2"
 	_fib=$3
@@ -929,6 +983,8 @@ testrx_run_test()
 	1)	testrx_remove_connected ${_fib} ${_transfer} ;;
 	esac
 
+	clean_ndp_cn
+
 	# Setup to get result counts.
 	textrx_count_setup
 
@@ -1046,32 +1102,53 @@ wait_remote_ready
 for uso in 0 1; do
 
 	# Only run ICMP6 tests for the first loop.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected
+	clean_ndp_cn
 	testtx_tcp6_connected
+	clean_ndp_cn
 	testtx_udp6_connected
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected_blackhole
+	clean_ndp_cn
 	testtx_tcp6_connected_blackhole
+	clean_ndp_cn
 	testtx_udp6_connected_blackhole
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected_transfernets
+	clean_ndp_cn
 	testtx_tcp6_connected_transfernets
+	clean_ndp_cn
 	testtx_udp6_connected_transfernets
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_connected_ifconfig_transfernets
+	clean_ndp_cn
 	testtx_tcp6_connected_ifconfig_transfernets
+	clean_ndp_cn
 	testtx_udp6_connected_ifconfig_transfernets
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_gateway
+	clean_ndp_cn
 	testtx_tcp6_gateway
+	clean_ndp_cn
 	testtx_udp6_gateway
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_transfernets_gateways
+	clean_ndp_cn
 	testtx_tcp6_transfernets_gateways
+	clean_ndp_cn
 	testtx_udp6_transfernets_gateways
 
+	clean_ndp_cn
 	test ${uso} -ne 0 || testtx_icmp6_transfernets_gateway
+	clean_ndp_cn
 	testtx_tcp6_transfernets_gateway
+	clean_ndp_cn
 	testtx_udp6_transfernets_gateway
 done
 
@@ -1084,13 +1161,17 @@ for uso in 0 1; do
 	USE_SOSETFIB=${uso}
 	
 	# Only expect ICMP6 tests for the first loop.
+	clean_ndp_cn
 	test ${uso} -ne 0 || testrx_icmp6_same_addr_one_fib_a_time
+	clean_ndp_cn
 	testrx_tcp6_same_addr_one_fib_a_time
+	clean_ndp_cn
 	testrx_udp6_same_addr_one_fib_a_time
 
+	clean_ndp_cn
 	testrx_tcp6_same_addr_all_fibs_a_time
+	clean_ndp_cn
 	testrx_udp6_same_addr_all_fibs_a_time
-
 done
 
 cleanup



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203142059.q2EKxjeJ031347>