CVS commit: src/tests/net/ndp

2022-01-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan  7 03:07:41 UTC 2022

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

Log Message:
tests: skip ndp_cache_state on qemu


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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.39 src/tests/net/ndp/t_ndp.sh:1.40
--- src/tests/net/ndp/t_ndp.sh:1.39	Thu Sep 17 11:56:35 2020
+++ src/tests/net/ndp/t_ndp.sh	Fri Jan  7 03:07:41 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.39 2020/09/17 11:56:35 roy Exp $
+#	$NetBSD: t_ndp.sh,v 1.40 2022/01/07 03:07:41 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -752,6 +752,8 @@ ndp_cache_state_body()
 {
 	local macaddr=
 
+	skip_if_qemu
+
 	rump_server_start $SOCKSRC netinet6
 	rump_server_start $SOCKDST netinet6
 



CVS commit: src/tests/net/ndp

2022-01-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan  7 03:07:41 UTC 2022

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

Log Message:
tests: skip ndp_cache_state on qemu


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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.



CVS commit: src/tests/net/ndp

2019-10-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Oct 16 07:42:23 UTC 2019

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

Log Message:
tests: add tests for the validateion of net.inet6.ip6.temppltime


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

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



CVS commit: src/tests/net/ndp

2019-10-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Oct 16 07:42:23 UTC 2019

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

Log Message:
tests: add tests for the validateion of net.inet6.ip6.temppltime


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/net/ndp/t_ra.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_ra.sh
diff -u src/tests/net/ndp/t_ra.sh:1.32 src/tests/net/ndp/t_ra.sh:1.33
--- src/tests/net/ndp/t_ra.sh:1.32	Sat Nov 25 07:58:47 2017
+++ src/tests/net/ndp/t_ra.sh	Wed Oct 16 07:42:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.32 2017/11/25 07:58:47 kre Exp $
+#	$NetBSD: t_ra.sh,v 1.33 2019/10/16 07:42:22 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -695,6 +695,15 @@ ra_temporary_address_body()
 	# autoconf, temporal address should be used as the source address
 	check_echo_request_pkt bus1 $ip_temp $IP6SRV
 
+	#
+	# Testing the validation of net.inet6.ip6.temppltime
+	#
+	# XXX should move to a better place
+	atf_check -s not-exit:0 -e match:'Invalid argument' \
+	rump.sysctl -w net.inet6.ip6.temppltime=$((600 + 5))
+	atf_check -s exit:0 -o match:'86400 -> 606' \
+	rump.sysctl -w net.inet6.ip6.temppltime=$((600 + 5 + 1))
+
 	unset RUMP_SERVER
 
 	terminate_rtadvd $PIDFILE



CVS commit: src/tests/net/ndp

2019-08-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 19 03:20:28 UTC 2019

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

Log Message:
tests: fix test header name


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.34 src/tests/net/ndp/t_ndp.sh:1.35
--- src/tests/net/ndp/t_ndp.sh:1.34	Tue Aug 13 07:20:43 2019
+++ src/tests/net/ndp/t_ndp.sh	Mon Aug 19 03:20:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.34 2019/08/13 07:20:43 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.35 2019/08/19 03:20:27 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -687,7 +687,7 @@ ndp_stray_entries_cleanup()
 }
 
 atf_test_case ndp_cache_state cleanup
-ndp_stray_entries_head()
+ndp_cache_state_head()
 {
 
 	atf_set "descr" "Tests states of neighbor cache entries"



CVS commit: src/tests/net/ndp

2019-08-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 19 03:20:28 UTC 2019

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

Log Message:
tests: fix test header name


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.



CVS commit: src/tests/net/ndp

2019-08-13 Thread Ryota Ozaki
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.



CVS commit: src/tests/net/ndp

2019-08-13 Thread Ryota Ozaki
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)
 	#



CVS commit: src/tests/net/ndp

2019-07-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 18 04:00:09 UTC 2019

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

Log Message:
tests: shorten the expire time of neighbor caches to reduce the runtime of the 
tests


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.



CVS commit: src/tests/net/ndp

2019-07-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 18 04:00:09 UTC 2019

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

Log Message:
tests: shorten the expire time of neighbor caches to reduce the runtime of the 
tests


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/tests/net/ndp/t_ndp.sh:1.33
--- src/tests/net/ndp/t_ndp.sh:1.32	Fri Jun 28 06:46:04 2019
+++ src/tests/net/ndp/t_ndp.sh	Thu Jul 18 04:00:09 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.32 2019/06/28 06:46:04 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.33 2019/07/18 04:00:09 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -121,10 +121,15 @@ ndp_cache_expiration_body()
 	setup_dst_server
 	setup_src_server
 
+	export RUMP_SERVER=$SOCKSRC
+
+	# Shorten the expire time of cache entries
+	atf_check -s exit:0 -o match:'basereachable=7s0ms' \
+	rump.ndp -i shmif0 basereachable=7000
+
 	#
 	# Check if a cache is expired expectedly
 	#
-	export RUMP_SERVER=$SOCKSRC
 	atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6DST
 
 	$DEBUG && rump.ndp -n -a
@@ -714,6 +719,10 @@ ndp_cache_state_body()
 
 	export RUMP_SERVER=$SOCKSRC
 
+	# Shorten the expire time of cache entries
+	atf_check -s exit:0 -o match:'basereachable=7s0ms' \
+	rump.ndp -i shmif0 basereachable=7000
+
 	#
 	# Reachability confirmation (RFC 4861 7.3.3)
 	#



CVS commit: src/tests/net/ndp

2019-06-28 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 28 06:46:04 UTC 2019

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

Log Message:
tests: test state transitions of neighbor caches


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.



CVS commit: src/tests/net/ndp

2019-06-28 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 28 06:46:04 UTC 2019

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

Log Message:
tests: test state transitions of neighbor caches


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/tests/net/ndp/t_ndp.sh:1.32
--- src/tests/net/ndp/t_ndp.sh:1.31	Thu Mar 22 09:21:24 2018
+++ src/tests/net/ndp/t_ndp.sh	Fri Jun 28 06:46:04 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.31 2018/03/22 09:21:24 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.32 2019/06/28 06:46:04 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -673,6 +673,81 @@ ndp_stray_entries_cleanup()
 	cleanup
 }
 
+atf_test_case ndp_cache_state cleanup
+ndp_stray_entries_head()
+{
+
+	atf_set "descr" "Tests states of neighbor cache entries"
+	atf_set "require.progs" "rump_server"
+}
+
+check_cache_state()
+{
+	local dst=$1
+	local state=$2
+
+	$DEBUG && rump.ndp -n $dst
+	atf_check -s exit:0 -o match:"^$dst.*$state " rump.ndp -n $dst
+}
+
+wait_until_stalled()
+{
+	local dst=$1
+	local state=$2
+
+	$DEBUG && rump.ndp -n $dst
+	while true; do
+		 rump.ndp -n $dst | grep -q "^$dst.*S " && break
+		 sleep 1
+	done
+	$DEBUG && rump.ndp -n $dst
+}
+
+ndp_cache_state_body()
+{
+
+	rump_server_start $SOCKSRC netinet6
+	rump_server_start $SOCKDST netinet6
+
+	setup_dst_server
+	setup_src_server
+
+	export RUMP_SERVER=$SOCKSRC
+
+	#
+	# Reachability confirmation (RFC 4861 7.3.3)
+	#
+	atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6DST
+
+	# Receiving a solicited NA packet changes the state of the cache to REACHABLE
+	check_cache_state $IP6DST R
+
+	# The state of the cache transits to STALE after a while
+	wait_until_stalled $IP6DST
+
+	# Sending a packet on the cache will run a reachability confirmation
+	atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6DST
+
+	sleep 1
+
+	# The state of the cache is changed to DELAY and stay for 5s, then
+	# send a NS packet and change the state to PROBE
+	check_cache_state $IP6DST D
+
+	sleep $((5 + 1))
+
+	# If the reachability confirmation is success, the state of the cache
+	# is changed to REACHABLE
+	check_cache_state $IP6DST R
+}
+
+ndp_cache_state_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case ndp_cache_expiration
@@ -685,4 +760,5 @@ atf_init_test_cases()
 	atf_add_test_case ndp_purge_on_route_delete
 	atf_add_test_case ndp_purge_on_ifdown
 	atf_add_test_case ndp_stray_entries
+	atf_add_test_case ndp_cache_state
 }