diff mbox series

[04/11] selftests: net/fcnal: Use accept_dad=0 to avoid setup sleep

Message ID 9cfeec9f336bf6f5fe06309526820e9bbbc87ea3.1633520807.git.cdleonard@gmail.com (mailing list archive)
State New
Headers show
Series selftests: Improve nettest and net/fcnal-test.sh | expand

Commit Message

Leonard Crestez Oct. 6, 2021, 11:47 a.m. UTC
Duplicate Address Detection makes ipv6 addresses unavailable for a short
period after adding (average about 1 second). Adding sleep statements
avoid this but since all addresses in the test environment are
controlled from the same source we can just disable DAD for the entire
namespace.

Unlike sprinkling nodad to all ipv6 address additions this also skips
DAD for link-local-addresses.

Signed-off-by: Leonard Crestez <cdleonard@gmail.com>
---
 tools/testing/selftests/net/fcnal-test.sh | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

David Ahern Oct. 6, 2021, 2:38 p.m. UTC | #1
On 10/6/21 5:47 AM, Leonard Crestez wrote:
> Duplicate Address Detection makes ipv6 addresses unavailable for a short
> period after adding (average about 1 second). Adding sleep statements
> avoid this but since all addresses in the test environment are
> controlled from the same source we can just disable DAD for the entire
> namespace.
> 
> Unlike sprinkling nodad to all ipv6 address additions this also skips
> DAD for link-local-addresses.
> 
> Signed-off-by: Leonard Crestez <cdleonard@gmail.com>
> ---
>  tools/testing/selftests/net/fcnal-test.sh | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 9cf05e6e0d9b..0bd60cd3bc06 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -357,11 +357,11 @@  create_vrf()
 	ip -netns ${ns} link set ${vrf} up
 	ip -netns ${ns} route add vrf ${vrf} unreachable default metric 8192
 	ip -netns ${ns} -6 route add vrf ${vrf} unreachable default metric 8192
 
 	ip -netns ${ns} addr add 127.0.0.1/8 dev ${vrf}
-	ip -netns ${ns} -6 addr add ::1 dev ${vrf} nodad
+	ip -netns ${ns} -6 addr add ::1 dev ${vrf}
 	if [ "${addr}" != "-" ]; then
 		ip -netns ${ns} addr add dev ${vrf} ${addr}
 	fi
 	if [ "${addr6}" != "-" ]; then
 		ip -netns ${ns} -6 addr add dev ${vrf} ${addr6}
@@ -378,10 +378,11 @@  create_ns()
 	local ns=$1
 	local addr=$2
 	local addr6=$3
 
 	ip netns add ${ns}
+	ip netns exec ${ns} sysctl -wq net.ipv6.conf.{all,default}.accept_dad=0
 
 	ip -netns ${ns} link set lo up
 	if [ "${addr}" != "-" ]; then
 		ip -netns ${ns} addr add dev lo ${addr}
 	fi
@@ -490,12 +491,10 @@  setup()
 	# tell ns-B how to get to remote addresses of ns-A
 	ip -netns ${NSB} ro add ${NSA_LO_IP}/32 via ${NSA_IP} dev ${NSB_DEV}
 	ip -netns ${NSB} ro add ${NSA_LO_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV}
 
 	set +e
-
-	sleep 1
 }
 
 setup_lla_only()
 {
 	# make sure we are starting with a clean slate
@@ -520,12 +519,10 @@  setup_lla_only()
 	create_vrf ${NSA} ${VRF} ${VRF_TABLE} "-" "-"
 	ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF}
 	ip -netns ${NSA} link set dev ${NSA_DEV2} vrf ${VRF}
 
 	set +e
-
-	sleep 1
 }
 
 ################################################################################
 # IPv4
 
@@ -3014,11 +3011,11 @@  ipv6_udp_novrf()
 	sleep 1
 	run_cmd_nsb nettest -6 -D -r ${NSA_IP6}
 	log_test $? 0 "UDP in - LLA to GUA"
 
 	run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV}
-	run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad
+	run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV}
 }
 
 ipv6_udp_vrf()
 {
 	local a
@@ -3292,11 +3289,11 @@  ipv6_udp_vrf()
 	sleep 1
 	run_cmd_nsb nettest -6 -D -r ${NSA_IP6}
 	log_test $? 0 "UDP in - LLA to GUA"
 
 	run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV}
-	run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad
+	run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV}
 }
 
 ipv6_udp()
 {
         # should not matter, but set to known state
@@ -3742,11 +3739,11 @@  use_case_br()
 	setup_cmd ip addr del dev ${NSA_DEV} ${NSA_IP}/24
 	setup_cmd ip -6 addr del dev ${NSA_DEV} ${NSA_IP6}/64
 
 	setup_cmd ip link add br0 type bridge
 	setup_cmd ip addr add dev br0 ${NSA_IP}/24
-	setup_cmd ip -6 addr add dev br0 ${NSA_IP6}/64 nodad
+	setup_cmd ip -6 addr add dev br0 ${NSA_IP6}/64
 
 	setup_cmd ip li set ${NSA_DEV} master br0
 	setup_cmd ip li set ${NSA_DEV} up
 	setup_cmd ip li set br0 up
 	setup_cmd ip li set br0 vrf ${VRF}
@@ -3791,15 +3788,15 @@  use_case_br()
 
 	setup_cmd ip li set br0 nomaster
 	setup_cmd ip li add br0.100 link br0 type vlan id 100
 	setup_cmd ip li set br0.100 vrf ${VRF} up
 	setup_cmd ip    addr add dev br0.100 172.16.101.1/24
-	setup_cmd ip -6 addr add dev br0.100 2001:db8:101::1/64 nodad
+	setup_cmd ip -6 addr add dev br0.100 2001:db8:101::1/64
 
 	setup_cmd_nsb ip li add vlan100 link ${NSB_DEV} type vlan id 100
 	setup_cmd_nsb ip addr add dev vlan100 172.16.101.2/24
-	setup_cmd_nsb ip -6 addr add dev vlan100 2001:db8:101::2/64 nodad
+	setup_cmd_nsb ip -6 addr add dev vlan100 2001:db8:101::2/64
 	setup_cmd_nsb ip li set vlan100 up
 	sleep 1
 
 	rmmod br_netfilter 2>/dev/null