Module Name:    src
Committed By:   ozaki-r
Date:           Tue Aug 13 07:20:43 UTC 2019

Modified Files:
        src/tests/net/ndp: t_ndp.sh

Log Message:
Make a permanet neighbor cache to avoid sending an NS packet disturbing the test

A receiver of an ICMPv6 request packet creates a stale cache entry and it turns
into the delay state on replying the packet.  After 5 second, the receiver sends
an NS packet as a reachability confirmation, which disturbs the test and causes
a unexpected result.

Should fix PR misc/54451


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/net/ndp/t_ndp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.33 src/tests/net/ndp/t_ndp.sh:1.34
--- src/tests/net/ndp/t_ndp.sh:1.33	Thu Jul 18 04:00:09 2019
+++ src/tests/net/ndp/t_ndp.sh	Tue Aug 13 07:20:43 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.33 2019/07/18 04:00:09 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.34 2019/08/13 07:20:43 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -114,6 +114,7 @@ get_timeout()
 
 ndp_cache_expiration_body()
 {
+	local macaddr=
 
 	rump_server_start $SOCKSRC netinet6
 	rump_server_start $SOCKDST netinet6
@@ -121,12 +122,19 @@ ndp_cache_expiration_body()
 	setup_dst_server
 	setup_src_server
 
-	export RUMP_SERVER=$SOCKSRC
-
 	# Shorten the expire time of cache entries
+	export RUMP_SERVER=$SOCKSRC
 	atf_check -s exit:0 -o match:'basereachable=7s0ms' \
 	    rump.ndp -i shmif0 basereachable=7000
 
+	# Make a permanent cache entry to avoid sending an NS packet disturbing
+	# the test
+	macaddr=$(get_macaddr $SOCKSRC shmif0)
+	export RUMP_SERVER=$SOCKDST
+	atf_check -s exit:0 -o ignore rump.ndp -s $IP6SRC $macaddr
+
+	export RUMP_SERVER=$SOCKSRC
+
 	#
 	# Check if a cache is expired expectedly
 	#
@@ -710,6 +718,7 @@ wait_until_stalled()
 
 ndp_cache_state_body()
 {
+	local macaddr=
 
 	rump_server_start $SOCKSRC netinet6
 	rump_server_start $SOCKDST netinet6
@@ -717,12 +726,19 @@ ndp_cache_state_body()
 	setup_dst_server
 	setup_src_server
 
-	export RUMP_SERVER=$SOCKSRC
-
 	# Shorten the expire time of cache entries
+	export RUMP_SERVER=$SOCKSRC
 	atf_check -s exit:0 -o match:'basereachable=7s0ms' \
 	    rump.ndp -i shmif0 basereachable=7000
 
+	# Make a permanent cache entry to avoid sending an NS packet disturbing
+	# the test
+	macaddr=$(get_macaddr $SOCKSRC shmif0)
+	export RUMP_SERVER=$SOCKDST
+	atf_check -s exit:0 -o ignore rump.ndp -s $IP6SRC $macaddr
+
+	export RUMP_SERVER=$SOCKSRC
+
 	#
 	# Reachability confirmation (RFC 4861 7.3.3)
 	#

Reply via email to