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

2020-09-17 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Sep 17 11:56:35 UTC 2020

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

Log Message:
ndp_rtm: Only ping once

Pointless doing 3 pings.
On a slow system, it's possible that many RTM_MISS messages could
overflow into the next test.


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

2020-09-17 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Sep 17 11:56:35 UTC 2020

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

Log Message:
ndp_rtm: Only ping once

Pointless doing 3 pings.
On a slow system, it's possible that many RTM_MISS messages could
overflow into the next test.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 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.38 src/tests/net/ndp/t_ndp.sh:1.39
--- src/tests/net/ndp/t_ndp.sh:1.38	Sun Mar 15 21:15:25 2020
+++ src/tests/net/ndp/t_ndp.sh	Thu Sep 17 11:56:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.38 2020/03/15 21:15:25 roy Exp $
+#	$NetBSD: t_ndp.sh,v 1.39 2020/09/17 11:56:35 roy Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -464,9 +464,8 @@ ndp_rtm_body()
 	rump.route -n monitor -c 1 > $file &
 	pid=$!
 	sleep 1
-	# nd6_mmaxtries = 3, second between each try
 	atf_check -s exit:1 -o ignore -e ignore \
-		rump.ping6 -n -X 3 -c 3 $IP6DST_FAIL1
+		rump.ping6 -n -X 1 -c 1 $IP6DST_FAIL1
 	wait $pid
 	$DEBUG && cat $file
 



CVS commit: src/tests/net/ndp

2020-03-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Mar 15 21:15:25 UTC 2020

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

Log Message:
tests: ndp_rtm: Check correct source address in RTA_AUTHOR

Fixes PR kern/55074.


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

2020-03-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Mar 15 21:15:25 UTC 2020

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

Log Message:
tests: ndp_rtm: Check correct source address in RTA_AUTHOR

Fixes PR kern/55074.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.37 src/tests/net/ndp/t_ndp.sh:1.38
--- src/tests/net/ndp/t_ndp.sh:1.37	Wed Mar 11 08:52:13 2020
+++ src/tests/net/ndp/t_ndp.sh	Sun Mar 15 21:15:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.37 2020/03/11 08:52:13 roy Exp $
+#	$NetBSD: t_ndp.sh,v 1.38 2020/03/15 21:15:25 roy Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -472,7 +472,7 @@ ndp_rtm_body()
 
 	hdr="RTM_MISS.+"
 	what=""
-	addr="$IP6DST_FAIL1 link#2 $IP6DST"
+	addr="$IP6DST_FAIL1 link#2 $IP6SRC"
 	atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
 		cat $file
 



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
 }



CVS commit: src/tests/net/ndp

2018-03-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Mar  7 02:30:37 UTC 2018

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

Log Message:
Tweak tests; increase the size of NS packets for the addition of a nonce


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/net/ndp/t_dad.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

2018-03-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Mar  7 02:30:00 UTC 2018

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

Log Message:
Provide more informative reports on failures


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/net/ndp/t_dad.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

2018-03-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Mar  7 02:30:37 UTC 2018

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

Log Message:
Tweak tests; increase the size of NS packets for the addition of a nonce


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.13 src/tests/net/ndp/t_dad.sh:1.14
--- src/tests/net/ndp/t_dad.sh:1.13	Wed Mar  7 02:30:00 2018
+++ src/tests/net/ndp/t_dad.sh	Wed Mar  7 02:30:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.13 2018/03/07 02:30:00 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.14 2018/03/07 02:30:37 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -74,9 +74,9 @@ make_ns_pkt_str()
 {
 	local id=$1
 	local target=$2
-	pkt="33:33:ff:00:00:0${id}, ethertype IPv6 (0x86dd), length 78: ::"
+	pkt="33:33:ff:00:00:0${id}, ethertype IPv6 (0x86dd), length 86: ::"
 	pkt="$pkt > ff02::1:ff00:${id}: ICMP6, neighbor solicitation,"
-	pkt="$pkt who has $target, length 24"
+	pkt="$pkt who has $target, length 32"
 	echo $pkt
 }
 



CVS commit: src/tests/net/ndp

2018-03-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Mar  7 02:30:00 UTC 2018

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

Log Message:
Provide more informative reports on failures


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.12 src/tests/net/ndp/t_dad.sh:1.13
--- src/tests/net/ndp/t_dad.sh:1.12	Fri Nov 25 08:51:17 2016
+++ src/tests/net/ndp/t_dad.sh	Wed Mar  7 02:30:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.12 2016/11/25 08:51:17 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.13 2018/03/07 02:30:00 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,6 +31,7 @@ SOCKPEER=unix://commsock2
 DEBUG=${DEBUG:-false}
 
 duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa][Tt][Ee][Dd]"
+tentative="[Tt][Ee][Nn][Tt][Aa][Tt][Ii][Vv][Ee]"
 
 atf_test_case dad_basic cleanup
 atf_test_case dad_duplicated cleanup
@@ -95,11 +96,12 @@ dad_basic_body()
 	$DEBUG && rump.ifconfig shmif0
 
 	atf_check -s exit:0 rump.ifconfig shmif0 up
-	rump.ifconfig shmif0 > ./out
-	$DEBUG && cat ./out
+	$DEBUG && rump.ifconfig shmif0
 
 	# The primary address doesn't start with tentative state
-	atf_check -s not-exit:0 -x "cat ./out |grep $localip1 |grep -q tentative"
+	atf_check -s exit:0 -o match:"$localip1" \
+	-o not-match:"$localip1.+$tentative" \
+	rump.ifconfig shmif0
 	# The alias address starts with tentative state
 	# XXX we have no stable way to check this, so skip for now
 	#atf_check -s exit:0 -x "cat ./out |grep $localip2 |grep -q tentative"
@@ -110,10 +112,12 @@ dad_basic_body()
 
 	# Check DAD probe packets (Neighbor Solicitation Message)
 	pkt=$(make_ns_pkt_str 2 $localip2)
-	atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
+	pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g')
+	atf_check -s exit:0 -o match:"$pkt" cat ./out
 	# No DAD for the primary address
 	pkt=$(make_ns_pkt_str 1 $localip1)
-	atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+	pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g')
+	atf_check -s exit:0 -o not-match:"$pkt" cat ./out
 
 	# Waiting for DAD complete
 	atf_check -s exit:0 rump.ifconfig -w 10
@@ -123,7 +127,9 @@ dad_basic_body()
 	# IPv6 DAD doesn't announce (Neighbor Advertisement Message)
 
 	# The alias address left tentative
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q tentative"
+	atf_check -s exit:0 -o match:"$localip2" \
+	-o not-match:"$localip2.+$tentative" \
+	rump.ifconfig shmif0
 
 	#
 	# Add a new address on the fly
@@ -139,7 +145,8 @@ dad_basic_body()
 	extract_new_packets bus1 > ./out
 	$DEBUG && cat ./out
 	pkt=$(make_ns_pkt_str 3 $localip3)
-	atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
+	pkt=$(echo $pkt | sed 's/\([\(\)]\)/\\\1/g')
+	atf_check -s exit:0 -o match:"$pkt" cat ./out
 
 	# Waiting for DAD complete
 	atf_check -s exit:0 rump.ifconfig -w 10
@@ -149,7 +156,9 @@ dad_basic_body()
 	# IPv6 DAD doesn't announce (Neighbor Advertisement Message)
 
 	# The new address left tentative
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip3 |grep -q tentative"
+	atf_check -s exit:0 -o match:"$localip3" \
+	-o not-match:"$localip3.+$tentative" \
+	rump.ifconfig shmif0
 
 	rump_server_destroy_ifaces
 }
@@ -169,7 +178,8 @@ dad_duplicated_body()
 	export RUMP_SERVER=$SOCKLOCAL
 
 	# The primary address isn't marked as duplicated
-	atf_check -s exit:0 -o not-match:"$localip1.+$duplicated" \
+	atf_check -s exit:0 -o match:"$localip1" \
+	-o not-match:"$localip1.+$duplicated" \
 	rump.ifconfig shmif0
 
 	#
@@ -185,7 +195,8 @@ dad_duplicated_body()
 	# A unique address isn't marked as duplicated
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2
 	atf_check -s exit:0 sleep 1
-	atf_check -s exit:0 -o not-match:"$localip2.+$duplicated" \
+	atf_check -s exit:0 -o match:"$localip2" \
+	-o not-match:"$localip2.+$duplicated" \
 	rump.ifconfig shmif0
 
 	rump_server_destroy_ifaces



CVS commit: src/tests/net/ndp

2017-11-24 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov 25 07:58:47 UTC 2017

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

Log Message:
Make this test somewhat deterministic - far fewer races, and most
of what are left are "race for the bus" type - if we lose, we just
wait for the next one ... slower but still reliable.

There are two exceptions ... when starting more than one rtadvd
(on different routers) we expect to receive an RA from each, but
all that we can check is that we received the (at least) right number
of RAs.  It is possible (though unlikely) that one router sent two
before another sent any, in which case we will not have the data we
expect, and a sub-test will fail.

Second, there is no way to know for sure that we have waited long
enough when we're waiting for data to expire - in systems with
correctly working clocks that actually measure time, this should not
be an issue, if data is due to expire in < 5 seconds, and we wait
5 seconds, and the data is still there, then that indicates a
failure, which should be detected.   Unfortunately with QEMU testing
time just isn't that reliable.  But fortunately, it is generally the
sleep which takes longer, while other timers run correctly, which is
the way that makes us happy...

While here lots of cleanups - everything from white space and
line wrapping, to removing superfluous quotes and adding some
(but probably not enough) that are not (though given the data is
all known here, lack of quotes will rarely hurt.)

Also take note of the fact that current rtadvd *cannot* delete its
pidfile, so waiting for that file to be removed is doomed to failure.
Do things in a way that works, rather than simply resorting to assassination.

Because we do a lot less "sleep and hope it is long enough" and more
"wait until it is observed to happen" the tests generally run in less
elapsed time than before (20% less has been observed.)  But because we
"wait until it is observed to happen" rather than just "sleep and hope
it is long enough" sometimes things take longer (and when that happens,
we no longer fail).  Up to 7% slower (overall) has been observed.
(Observations on an amd64 DomU, no idea yet as to what QEMU might observe.)


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

2017-11-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Nov 24 03:38:32 UTC 2017

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

Log Message:
Fix the ndp_rtm test the same way the arp_rtm test was fixed:
1. get pid of bg process with $! not $?
2. expect a single message from route monitor, not two, after ndp -d
3. run atf_check just once to verify correct output, not once for each string


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 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.29 src/tests/net/ndp/t_ndp.sh:1.30
--- src/tests/net/ndp/t_ndp.sh:1.29	Wed Jun 28 08:17:50 2017
+++ src/tests/net/ndp/t_ndp.sh	Fri Nov 24 03:38:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.29 2017/06/28 08:17:50 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.30 2017/11/24 03:38:32 kre Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -418,7 +418,7 @@ ndp_rtm_body()
 {
 	local macaddr_src= macaddr_dst=
 	local file=./tmp
-	local pid= str=
+	local pid= hdr= what= addr=
 
 	rump_server_start $SOCKSRC netinet6
 	rump_server_start $SOCKDST netinet6
@@ -433,33 +433,31 @@ ndp_rtm_body()
 
 	# Test ping and a resulting routing message (RTM_ADD)
 	rump.route -n monitor -c 1 > $file &
-	pid=$?
+	pid=$!
 	sleep 1
 	atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
 	wait $pid
 	$DEBUG && cat $file
 
-	str="RTM_ADD.+"
-	atf_check -s exit:0 -o match:"$str" cat $file
-	str=""
-	atf_check -s exit:0 -o match:"$str" cat $file
-	str="$IP6DST link#2"
-	atf_check -s exit:0 -o match:"$str" cat $file
+	hdr="RTM_ADD.+"
+	what=""
+	addr="$IP6DST link#2"
+	atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+		cat $file
 
 	# Test ndp -d and resulting routing messages (RTM_DELETE)
-	rump.route -n monitor -c 2 > $file &
-	pid=$?
+	rump.route -n monitor -c 1 > $file &
+	pid=$!
 	sleep 1
 	atf_check -s exit:0 -o ignore rump.ndp -d $IP6DST
 	wait $pid
 	$DEBUG && cat $file
 
-	str="RTM_DELETE.+"
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str=""
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str="$IP6DST $macaddr_dst"
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
+	hdr="RTM_DELETE.+"
+	what=""
+	addr="$IP6DST $macaddr_dst"
+	atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+		grep -A 3 RTM_DELETE $file
 
 	rump_server_destroy_ifaces
 }



CVS commit: src/tests/net/ndp

2017-11-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Nov 24 03:38:32 UTC 2017

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

Log Message:
Fix the ndp_rtm test the same way the arp_rtm test was fixed:
1. get pid of bg process with $! not $?
2. expect a single message from route monitor, not two, after ndp -d
3. run atf_check just once to verify correct output, not once for each string


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

2017-11-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov  7 02:19:23 UTC 2017

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

Log Message:
Let rtadvd not use syslog for logging

Thanks to christos@ now rtadvd can log via stderr instead of syslog
by -D option.

Address PR bin/52701


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

2017-11-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov  7 02:19:23 UTC 2017

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

Log Message:
Let rtadvd not use syslog for logging

Thanks to christos@ now rtadvd can log via stderr instead of syslog
by -D option.

Address PR bin/52701


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 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.30 src/tests/net/ndp/t_ra.sh:1.31
--- src/tests/net/ndp/t_ra.sh:1.30	Mon Nov  6 10:51:40 2017
+++ src/tests/net/ndp/t_ra.sh	Tue Nov  7 02:19:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.30 2017/11/06 10:51:40 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.31 2017/11/07 02:19:23 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -151,7 +151,8 @@ start_rtadvd()
 	local pidfile=$2
 
 	export RUMP_SERVER=$sock
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0
+	atf_check -s exit:0 -e ignore \
+	rump.rtadvd -D -c ${CONFIG} -p $pidfile shmif0
 	while [ ! -f $pidfile ]; do
 		sleep 0.2
 	done



CVS commit: src/tests/net/ndp

2017-11-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Nov  6 10:51:40 UTC 2017

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

Log Message:
Kill rtadvd surely even if the tests fail in the middle

It may help PR bin/52701.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 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.29 src/tests/net/ndp/t_ra.sh:1.30
--- src/tests/net/ndp/t_ra.sh:1.29	Thu Jun 22 09:56:48 2017
+++ src/tests/net/ndp/t_ra.sh	Mon Nov  6 10:51:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.29 2017/06/22 09:56:48 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.30 2017/11/06 10:51:40 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -85,6 +85,34 @@ wait_term()
 	return 0
 }
 
+kill_rtadvd()
+{
+	local pidfile=$1
+
+	kill -KILL `cat $pidfile`
+	rm -f $pidfile
+}
+
+terminate_rtadvd()
+{
+	local pidfile=$1
+	local n=5
+
+	if [ ! -f $pidfile ]; then
+		return
+	fi
+
+	kill -TERM `cat $pidfile`
+	while [ -f $pidfile ]; do
+		n=$((n - 1))
+		if [ $n = 0 ]; then
+			kill_rtadvd $pidfile
+			break
+		fi
+		sleep 0.2
+	done
+}
+
 create_rtadvdconfig()
 {
 
@@ -203,8 +231,7 @@ ra_basic_body()
 	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
+	terminate_rtadvd $PIDFILE
 
 	export RUMP_SERVER=${RUMPCLI}
 	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
@@ -215,8 +242,7 @@ ra_basic_body()
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
+	terminate_rtadvd $PIDFILE
 
 	rump_server_destroy_ifaces
 }
@@ -224,12 +250,8 @@ ra_basic_body()
 ra_basic_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
 	cleanup
 }
 
@@ -267,7 +289,7 @@ ra_flush_prefix_entries_body()
 
 	# Terminate rtadvd to prevent new RA messages from coming
 	# Note that ifconfig down; kill -TERM doesn't work
-	kill -KILL `cat ${PIDFILE}`
+	kill_rtadvd $PIDFILE
 
 	# Flush all the entries in the prefix list
 	atf_check -s exit:0 rump.ndp -P
@@ -288,6 +310,7 @@ ra_flush_prefix_entries_cleanup()
 {
 
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
 	cleanup
 }
 
@@ -325,7 +348,7 @@ ra_flush_defrouter_entries_body()
 
 	# Terminate rtadvd to prevent new RA messages from coming
 	# Note that ifconfig down; kill -TERM doesn't work
-	kill -KILL `cat ${PIDFILE}`
+	kill_rtadvd $PIDFILE
 
 	# Flush all the entries in the default router list
 	atf_check -s exit:0 rump.ndp -R
@@ -345,6 +368,7 @@ ra_flush_defrouter_entries_cleanup()
 {
 
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
 	cleanup
 }
 
@@ -384,8 +408,7 @@ ra_delete_address_body()
 	$(rump.ifconfig shmif0 |awk '/AUTOCONF/ {print $2}') delete
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
+	terminate_rtadvd $PIDFILE
 
 	rump_server_destroy_ifaces
 }
@@ -393,12 +416,8 @@ ra_delete_address_body()
 ra_delete_address_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
 	cleanup
 }
 
@@ -444,10 +463,8 @@ ra_multiple_routers_body()
 	atf_check_equal $n 2
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
-	wait_term ${PIDFILE3}
+	terminate_rtadvd $PIDFILE
+	terminate_rtadvd $PIDFILE3
 
 	rump_server_destroy_ifaces
 }
@@ -455,16 +472,9 @@ ra_multiple_routers_body()
 ra_multiple_routers_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-	if [ -f ${PIDFILE3} ]; then
-		kill -TERM `cat ${PIDFILE3}`
-		wait_term ${PIDFILE3}
-	fi
-
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
+	terminate_rtadvd $PIDFILE3
 	cleanup
 }
 
@@ -510,10 +520,8 @@ ra_multiple_routers_single_prefix_body()
 	atf_check_equal $n 1
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE1_2}`
-	wait_term ${PIDFILE1_2}
+	terminate_rtadvd $PIDFILE
+	terminate_rtadvd $PIDFILE1_2
 
 	rump_server_destroy_ifaces
 }
@@ -521,16 +529,9 @@ ra_multiple_routers_single_prefix_body()
 ra_multiple_routers_single_prefix_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-	if [ -f ${PIDFILE1_2} ]; then
-		kill -TERM `cat ${PIDFILE1_2}`
-		wait_term ${PIDFILE1_2}
-	fi
-
 	$DEBUG && dump
+	terminate_rtadvd $PIDFILE
+	terminate_rtadvd $PIDFILE1_2
 	cleanup
 }
 
@@ -588,12 +589,9 @@ ra_multiple_routers_maxifprefixes_body()
 	# TODO check other conditions
 	unset 

CVS commit: src/tests/net/ndp

2017-11-06 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Nov  6 10:51:40 UTC 2017

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

Log Message:
Kill rtadvd surely even if the tests fail in the middle

It may help PR bin/52701.


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

2017-06-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jun 22 09:05:02 UTC 2017

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

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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.22 src/tests/net/ndp/t_ndp.sh:1.23
--- src/tests/net/ndp/t_ndp.sh:1.22	Wed Jun 21 09:05:31 2017
+++ src/tests/net/ndp/t_ndp.sh	Thu Jun 22 09:05:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.22 2017/06/21 09:05:31 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.23 2017/06/22 09:05:02 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -398,7 +398,7 @@ atf_test_case ndp_rtm cleanup
 ndp_rtm_head()
 {
 
-	atf_set "descr" "Tests for routing messages on operations of ARP entries"
+	atf_set "descr" "Tests for routing messages on operations of NDP entries"
 	atf_set "require.progs" "rump_server"
 }
 



CVS commit: src/tests/net/ndp

2017-06-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jun 22 09:05:02 UTC 2017

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

Log Message:
Fix typo


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

2017-02-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Feb 22 03:03:37 UTC 2017

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

Log Message:
Add tests for expiration of default router and prefix entries


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/tests/net/ndp/t_ra.sh:1.25
--- src/tests/net/ndp/t_ra.sh:1.24	Fri Jan 13 08:11:01 2017
+++ src/tests/net/ndp/t_ra.sh	Wed Feb 22 03:03:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.24 2017/01/13 08:11:01 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.25 2017/02/22 03:03:37 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -94,6 +94,29 @@ shmif0:\
 _EOF
 }
 
+create_rtadvdconfig_rltime()
+{
+	local time=$1
+
+	cat << _EOF > ${CONFIG}
+shmif0:\
+	:mtu#1300:maxinterval#4:mininterval#3:rltime#$time:
+_EOF
+	$DEBUG && cat ${CONFIG}
+}
+
+create_rtadvdconfig_vltime()
+{
+	local addr=$1
+	local time=$2
+
+	cat << _EOF > ${CONFIG}
+shmif0:\
+	:mtu#1300:maxinterval#4:mininterval#3:addr="$addr":vltime#$time:
+_EOF
+	$DEBUG && cat ${CONFIG}
+}
+
 start_rtadvd()
 {
 	local sock=$1
@@ -689,6 +712,136 @@ ra_temporary_address_cleanup()
 	cleanup
 }
 
+atf_test_case ra_defrouter_expiration cleanup
+ra_defrouter_expiration_head()
+{
+
+	atf_set "descr" "Tests for default router expiration"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_defrouter_expiration_body()
+{
+	local expire_time=5
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	init_server $RUMPSRV
+
+	create_rtadvdconfig_rltime $expire_time
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+
+	export RUMP_SERVER=${RUMPCLI}
+
+	# Terminate rtadvd to prevent new RA messages from coming
+	# Note that ifconfig down; kill -TERM doesn't work
+	kill -KILL `cat ${PIDFILE}`
+
+	# Wait until the default routers and prefix entries are expired
+	sleep $expire_time
+
+	$DEBUG && dump_entries
+
+	# Give nd6_timer a chance to sweep default routers and prefix entries
+	sleep 2
+
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o not-match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+
+	rump_server_destroy_ifaces
+}
+
+ra_defrouter_expiration_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+atf_test_case ra_prefix_expiration cleanup
+ra_prefix_expiration_head()
+{
+
+	atf_set "descr" "Tests for prefix expiration"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_prefix_expiration_body()
+{
+	local expire_time=5
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	init_server $RUMPSRV
+
+	create_rtadvdconfig_vltime "${IP6SRV_PREFIX}:" $expire_time
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+
+	export RUMP_SERVER=${RUMPCLI}
+
+	# Terminate rtadvd to prevent new RA messages from coming
+	# Note that ifconfig down; kill -TERM doesn't work
+	kill -KILL `cat ${PIDFILE}`
+
+	# Wait until the default routers and prefix entries are expired
+	sleep $expire_time
+
+	$DEBUG && dump_entries
+
+	# Give nd6_timer a chance to sweep default routers and prefix entries
+	sleep 2
+
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o empty rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+
+	rump_server_destroy_ifaces
+}
+
+ra_prefix_expiration_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -700,4 +853,6 @@ atf_init_test_cases()
 	atf_add_test_case ra_multiple_routers_single_prefix
 	atf_add_test_case ra_multiple_routers_maxifprefixes
 	atf_add_test_case ra_temporary_address
+	atf_add_test_case ra_defrouter_expiration
+	

CVS commit: src/tests/net/ndp

2017-02-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Feb 22 03:03:37 UTC 2017

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

Log Message:
Add tests for expiration of default router and prefix entries


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

2017-01-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 08:11:01 UTC 2017

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

Log Message:
Remove a check added wrongly


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/tests/net/ndp/t_ra.sh:1.24
--- src/tests/net/ndp/t_ra.sh:1.23	Fri Jan 13 06:30:33 2017
+++ src/tests/net/ndp/t_ra.sh	Fri Jan 13 08:11:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.23 2017/01/13 06:30:33 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.24 2017/01/13 08:11:01 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -667,7 +667,6 @@ ra_temporary_address_body()
 
 	atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV
 	# autoconf, temporal address should be used as the source address
-	check_echo_request_pkt bus1 $ip_auto $IP6SRV
 	check_echo_request_pkt bus1 $ip_temp $IP6SRV
 
 	unset RUMP_SERVER



CVS commit: src/tests/net/ndp

2017-01-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 08:11:01 UTC 2017

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

Log Message:
Remove a check added wrongly


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

2017-01-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 06:30:09 UTC 2017

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

Log Message:
Remove extra checks and cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/tests/net/ndp/t_ra.sh:1.22
--- src/tests/net/ndp/t_ra.sh:1.21	Wed Jan 11 07:22:43 2017
+++ src/tests/net/ndp/t_ra.sh	Fri Jan 13 06:30:09 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.21 2017/01/11 07:22:43 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.22 2017/01/13 06:30:09 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -610,55 +610,32 @@ ra_temporary_address_body()
 	rump_server_fs_start $RUMPSRV netinet6
 	rump_server_start $RUMPCLI netinet6
 
-	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 $RUMPSRV $IP6SRV
 	init_server $RUMPSRV
+	setup_shmif0 $RUMPCLI $IP6CLI
 
-	setup_shmif0 ${RUMPCLI} ${IP6CLI}
-	export RUMP_SERVER=${RUMPCLI}
-	$DEBUG && rump.ndp -n -a
-	atf_check -s exit:0 -o match:'= 0' \
-	rump.sysctl net.inet6.ip6.accept_rtadv
-	atf_check -s exit:0 -o match:'= 0' \
-	rump.sysctl net.inet6.ip6.use_tempaddr
-	unset RUMP_SERVER
-
-	create_rtadvdconfig
-	start_rtadvd $RUMPSRV $PIDFILE
-	sleep $WAITTIME
-
-	export RUMP_SERVER=${RUMPCLI}
-	atf_check -s exit:0 -o empty rump.ndp -r
-	atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p
-	atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a
-	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
-	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
-	unset RUMP_SERVER
-
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
-
-	export RUMP_SERVER=${RUMPCLI}
+	export RUMP_SERVER=$RUMPCLI
 	atf_check -s exit:0 -o match:'0.->.1' \
 	rump.sysctl -w net.inet6.ip6.accept_rtadv=1
 	atf_check -s exit:0 -o match:'0.->.1' \
 	rump.sysctl -w net.inet6.ip6.use_tempaddr=1
 	unset RUMP_SERVER
 
+	create_rtadvdconfig
 	start_rtadvd $RUMPSRV $PIDFILE
 	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
 	# Check temporary address
-	export RUMP_SERVER=${RUMPCLI}
+	export RUMP_SERVER=$RUMPCLI
 	atf_check -s exit:0 \
 	-o match:"$IP6SRV_PREFIX.+<(TENTATIVE,)?AUTOCONF,TEMPORARY>" \
 	rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
+	wait_term $PIDFILE
 
 	rump_server_destroy_ifaces
 }



CVS commit: src/tests/net/ndp

2017-01-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 06:30:33 UTC 2017

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

Log Message:
Add tests for net.inet6.ip6.prefer_tempaddr


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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.22 src/tests/net/ndp/t_ra.sh:1.23
--- src/tests/net/ndp/t_ra.sh:1.22	Fri Jan 13 06:30:09 2017
+++ src/tests/net/ndp/t_ra.sh	Fri Jan 13 06:30:33 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.22 2017/01/13 06:30:09 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.23 2017/01/13 06:30:33 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -604,8 +604,19 @@ ra_temporary_address_head()
 	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
 }
 
+check_echo_request_pkt()
+{
+	local pkt="$2 > $3: .+ echo request"
+
+	extract_new_packets $1 > ./out
+	$DEBUG && echo $pkt
+	$DEBUG && cat ./out
+	atf_check -s exit:0 -o match:"$pkt" cat ./out
+}
+
 ra_temporary_address_body()
 {
+	local ip_auto= ip_temp=
 
 	rump_server_fs_start $RUMPSRV netinet6
 	rump_server_start $RUMPCLI netinet6
@@ -627,11 +638,38 @@ ra_temporary_address_body()
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
-	# Check temporary address
 	export RUMP_SERVER=$RUMPCLI
+
+	# Check temporary address
 	atf_check -s exit:0 \
 	-o match:"$IP6SRV_PREFIX.+<(TENTATIVE,)?AUTOCONF,TEMPORARY>" \
 	rump.ifconfig shmif0 inet6
+
+	#
+	# Testing net.inet6.ip6.prefer_tempaddr
+	#
+	atf_check -s exit:0 rump.ifconfig -w 10
+	$DEBUG && rump.ifconfig shmif0
+	ip_auto=$(rump.ifconfig shmif0 |awk '// {sub(/\/[0-9]*/, ""); print $2;}')
+	ip_temp=$(rump.ifconfig shmif0 |awk '// {sub(/\/[0-9]*/, ""); print $2;}')
+	$DEBUG && echo $ip_auto $ip_temp
+
+	# Ignore old packets
+	extract_new_packets bus1 > /dev/null
+
+	atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV
+	# autoconf (non-temporal) address should be used as the source address
+	check_echo_request_pkt bus1 $ip_auto $IP6SRV
+
+	# Enable net.inet6.ip6.prefer_tempaddr
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.prefer_tempaddr=1
+
+	atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV
+	# autoconf, temporal address should be used as the source address
+	check_echo_request_pkt bus1 $ip_auto $IP6SRV
+	check_echo_request_pkt bus1 $ip_temp $IP6SRV
+
 	unset RUMP_SERVER
 
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`



CVS commit: src/tests/net/ndp

2017-01-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 06:30:33 UTC 2017

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

Log Message:
Add tests for net.inet6.ip6.prefer_tempaddr


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

2017-01-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 13 06:30:09 UTC 2017

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

Log Message:
Remove extra checks and cleanup


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

2017-01-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jan 11 07:22:43 UTC 2017

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

Log Message:
Cope with tentative state


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

2017-01-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jan 11 07:22:43 UTC 2017

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

Log Message:
Cope with tentative state


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/tests/net/ndp/t_ra.sh:1.21
--- src/tests/net/ndp/t_ra.sh:1.20	Wed Jan 11 03:15:44 2017
+++ src/tests/net/ndp/t_ra.sh	Wed Jan 11 07:22:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.21 2017/01/11 07:22:43 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -127,7 +127,8 @@ check_entries()
 	-o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \
 	rump.ndp -n -a
 	atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a
-	atf_check -s exit:0 -o match:"$addr_prefix.+" \
+	atf_check -s exit:0 \
+	-o match:"$addr_prefix.+<(TENTATIVE,)?AUTOCONF>" \
 	rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 }
@@ -651,7 +652,8 @@ ra_temporary_address_body()
 
 	# Check temporary address
 	export RUMP_SERVER=${RUMPCLI}
-	atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+" \
+	atf_check -s exit:0 \
+	-o match:"$IP6SRV_PREFIX.+<(TENTATIVE,)?AUTOCONF,TEMPORARY>" \
 	rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 



CVS commit: src/tests/net/ndp

2017-01-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jan 11 03:15:11 UTC 2017

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

Log Message:
Check autoconf flag


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/tests/net/ndp/t_ra.sh:1.19
--- src/tests/net/ndp/t_ra.sh:1.18	Mon Dec 26 01:26:25 2016
+++ src/tests/net/ndp/t_ra.sh	Wed Jan 11 03:15:11 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.18 2016/12/26 01:26:25 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.19 2017/01/11 03:15:11 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -127,7 +127,8 @@ check_entries()
 	-o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \
 	rump.ndp -n -a
 	atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a
-	atf_check -s exit:0 -o match:$addr_prefix rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o match:"$addr_prefix.+" \
+	rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 }
 



CVS commit: src/tests/net/ndp

2017-01-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jan 11 03:15:11 UTC 2017

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

Log Message:
Check autoconf flag


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

2017-01-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jan 11 03:15:44 UTC 2017

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

Log Message:
Add a test case for IPv6 temporary address


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/tests/net/ndp/t_ra.sh:1.20
--- src/tests/net/ndp/t_ra.sh:1.19	Wed Jan 11 03:15:11 2017
+++ src/tests/net/ndp/t_ra.sh	Wed Jan 11 03:15:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.19 2017/01/11 03:15:11 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -595,6 +595,84 @@ ra_multiple_routers_maxifprefixes_cleanu
 	cleanup
 }
 
+atf_test_case ra_temporary_address cleanup
+ra_temporary_address_head()
+{
+
+	atf_set "descr" "Tests for IPv6 temporary address"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_temporary_address_body()
+{
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	init_server $RUMPSRV
+
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+	export RUMP_SERVER=${RUMPCLI}
+	$DEBUG && rump.ndp -n -a
+	atf_check -s exit:0 -o match:'= 0' \
+	rump.sysctl net.inet6.ip6.accept_rtadv
+	atf_check -s exit:0 -o match:'= 0' \
+	rump.sysctl net.inet6.ip6.use_tempaddr
+	unset RUMP_SERVER
+
+	create_rtadvdconfig
+	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o empty rump.ndp -r
+	atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a
+	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.use_tempaddr=1
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+
+	# Check temporary address
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+" \
+	rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+
+	rump_server_destroy_ifaces
+}
+
+ra_temporary_address_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -605,4 +683,5 @@ atf_init_test_cases()
 	atf_add_test_case ra_multiple_routers
 	atf_add_test_case ra_multiple_routers_single_prefix
 	atf_add_test_case ra_multiple_routers_maxifprefixes
+	atf_add_test_case ra_temporary_address
 }



CVS commit: src/tests/net/ndp

2016-12-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 26 01:26:25 UTC 2016

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

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.17 src/tests/net/ndp/t_ra.sh:1.18
--- src/tests/net/ndp/t_ra.sh:1.17	Wed Dec 21 07:02:16 2016
+++ src/tests/net/ndp/t_ra.sh	Mon Dec 26 01:26:25 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.17 2016/12/21 07:02:16 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.18 2016/12/26 01:26:25 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -494,7 +494,7 @@ ra_multiple_routers_single_prefix_body()
 	rump_server_destroy_ifaces
 }
 
-multiple_routers_single_prefix_cleanup()
+ra_multiple_routers_single_prefix_cleanup()
 {
 
 	if [ -f ${PIDFILE} ]; then



CVS commit: src/tests/net/ndp

2016-12-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 26 01:26:25 UTC 2016

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

Log Message:
Fix typo


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

2016-12-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 21 07:02:16 UTC 2016

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

Log Message:
Restore multiple_routers_single_prefix_cleanup removed wrongly


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.16 src/tests/net/ndp/t_ra.sh:1.17
--- src/tests/net/ndp/t_ra.sh:1.16	Tue Dec 20 10:12:24 2016
+++ src/tests/net/ndp/t_ra.sh	Wed Dec 21 07:02:16 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.16 2016/12/20 10:12:24 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.17 2016/12/21 07:02:16 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -494,6 +494,22 @@ ra_multiple_routers_single_prefix_body()
 	rump_server_destroy_ifaces
 }
 
+multiple_routers_single_prefix_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+	if [ -f ${PIDFILE1_2} ]; then
+		kill -TERM `cat ${PIDFILE1_2}`
+		wait_term ${PIDFILE1_2}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_test_case ra_multiple_routers_maxifprefixes cleanup
 ra_multiple_routers_maxifprefixes_head()
 {



CVS commit: src/tests/net/ndp

2016-12-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 21 07:02:16 UTC 2016

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

Log Message:
Restore multiple_routers_single_prefix_cleanup removed wrongly


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

2016-12-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Dec 20 10:12:24 UTC 2016

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

Log Message:
Reduce unnecessary wait


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.15 src/tests/net/ndp/t_ra.sh:1.16
--- src/tests/net/ndp/t_ra.sh:1.15	Mon Dec 19 03:07:05 2016
+++ src/tests/net/ndp/t_ra.sh	Tue Dec 20 10:12:24 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.15 2016/12/19 03:07:05 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.16 2016/12/20 10:12:24 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -43,6 +43,7 @@ PIDFILE1_2=./rump.rtadvd.pid12
 PIDFILE3=./rump.rtadvd.pid3
 PIDFILE4=./rump.rtadvd.pid4
 CONFIG=./rtadvd.conf
+WAITTIME=2
 DEBUG=${DEBUG:-true}
 
 init_server()
@@ -100,8 +101,9 @@ start_rtadvd()
 
 	export RUMP_SERVER=$sock
 	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0
-	atf_check -s exit:0 sleep 3
-	atf_check -s exit:0 -o ignore -e empty cat $pidfile
+	while [ ! -f $pidfile ]; do
+		sleep 0.2
+	done
 	unset RUMP_SERVER
 }
 
@@ -165,6 +167,7 @@ ra_basic_body()
 
 	create_rtadvdconfig
 	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
 
 	export RUMP_SERVER=${RUMPCLI}
 	atf_check -s exit:0 -o empty rump.ndp -r
@@ -183,6 +186,7 @@ ra_basic_body()
 	unset RUMP_SERVER
 
 	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
@@ -230,6 +234,7 @@ ra_flush_prefix_entries_body()
 	unset RUMP_SERVER
 
 	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
@@ -287,6 +292,7 @@ ra_flush_defrouter_entries_body()
 	unset RUMP_SERVER
 
 	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
@@ -344,6 +350,7 @@ ra_delete_address_body()
 	unset RUMP_SERVER
 
 	start_rtadvd $RUMPSRV $PIDFILE
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
@@ -402,6 +409,7 @@ ra_multiple_routers_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 	start_rtadvd $RUMPSRV3 $PIDFILE3
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 	check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX
@@ -467,6 +475,7 @@ ra_multiple_routers_single_prefix_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 	start_rtadvd $RUMPSRV1_2 $PIDFILE1_2
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 	check_entries $RUMPCLI $RUMPSRV1_2 $IP6SRV_PREFIX
@@ -523,11 +532,13 @@ ra_multiple_routers_maxifprefixes_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 	start_rtadvd $RUMPSRV3 $PIDFILE3
+	sleep $WAITTIME
 
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 	check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX
 
 	start_rtadvd $RUMPSRV4 $PIDFILE4
+	sleep $WAITTIME
 
 	export RUMP_SERVER=${RUMPCLI}
 	$DEBUG && dump_entries



CVS commit: src/tests/net/ndp

2016-12-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Dec 20 10:12:24 UTC 2016

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

Log Message:
Reduce unnecessary wait


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

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 03:07:05 UTC 2016

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

Log Message:
Add a test case for exceeding the number of maximum prefixes

The test case pinpoints purge_detached.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.14 src/tests/net/ndp/t_ra.sh:1.15
--- src/tests/net/ndp/t_ra.sh:1.14	Mon Dec 19 02:27:02 2016
+++ src/tests/net/ndp/t_ra.sh	Mon Dec 19 03:07:05 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.14 2016/12/19 02:27:02 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.15 2016/12/19 03:07:05 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -29,15 +29,19 @@ RUMPSRV=unix://r1
 RUMPSRV1_2=unix://r12
 RUMPCLI=unix://r2
 RUMPSRV3=unix://r3
+RUMPSRV4=unix://r4
 IP6SRV=fc00:1::1
 IP6SRV1_2=fc00:1::2
 IP6SRV_PREFIX=fc00:1:
 IP6CLI=fc00:2::2
 IP6SRV3=fc00:3::1
 IP6SRV3_PREFIX=fc00:3:
+IP6SRV4=fc00:4::1
+IP6SRV4_PREFIX=fc00:4:
 PIDFILE=./rump.rtadvd.pid
 PIDFILE1_2=./rump.rtadvd.pid12
 PIDFILE3=./rump.rtadvd.pid3
+PIDFILE4=./rump.rtadvd.pid4
 CONFIG=./rtadvd.conf
 DEBUG=${DEBUG:-true}
 
@@ -481,16 +485,82 @@ ra_multiple_routers_single_prefix_body()
 	rump_server_destroy_ifaces
 }
 
-ra_multiple_routers_single_prefix_cleanup()
+atf_test_case ra_multiple_routers_maxifprefixes cleanup
+ra_multiple_routers_maxifprefixes_head()
+{
+
+	atf_set "descr" "Tests for exceeding the number of maximum prefixes"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_multiple_routers_maxifprefixes_body()
+{
+	local n=
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_fs_start $RUMPSRV3 netinet6
+	rump_server_fs_start $RUMPSRV4 netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPSRV3} ${IP6SRV3}
+	setup_shmif0 ${RUMPSRV4} ${IP6SRV4}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	init_server $RUMPSRV
+	init_server $RUMPSRV3
+	init_server $RUMPSRV4
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' \
+	rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	# Limit the maximum number of prefix entries to 2
+	atf_check -s exit:0 -o match:'16.->.2' \
+	rump.sysctl -w net.inet6.ip6.maxifprefixes=2
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	start_rtadvd $RUMPSRV3 $PIDFILE3
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+	check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX
+
+	start_rtadvd $RUMPSRV4 $PIDFILE4
+
+	export RUMP_SERVER=${RUMPCLI}
+	$DEBUG && dump_entries
+	# There should remain two prefixes
+	n=$(rump.ndp -p |grep 'advertised by' |wc -l)
+	atf_check_equal $n 2
+	# TODO check other conditions
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
+	wait_term ${PIDFILE3}
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE4}`
+	wait_term ${PIDFILE4}
+
+	rump_server_destroy_ifaces
+}
+
+ra_multiple_routers_maxifprefixes_cleanup()
 {
 
 	if [ -f ${PIDFILE} ]; then
 		kill -TERM `cat ${PIDFILE}`
 		wait_term ${PIDFILE}
 	fi
-	if [ -f ${PIDFILE1_2} ]; then
-		kill -TERM `cat ${PIDFILE1_2}`
-		wait_term ${PIDFILE1_2}
+	if [ -f ${PIDFILE3} ]; then
+		kill -TERM `cat ${PIDFILE3}`
+		wait_term ${PIDFILE3}
+	fi
+	if [ -f ${PIDFILE4} ]; then
+		kill -TERM `cat ${PIDFILE4}`
+		wait_term ${PIDFILE4}
 	fi
 
 	$DEBUG && dump
@@ -506,4 +576,5 @@ atf_init_test_cases()
 	atf_add_test_case ra_delete_address
 	atf_add_test_case ra_multiple_routers
 	atf_add_test_case ra_multiple_routers_single_prefix
+	atf_add_test_case ra_multiple_routers_maxifprefixes
 }



CVS commit: src/tests/net/ndp

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 03:07:05 UTC 2016

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

Log Message:
Add a test case for exceeding the number of maximum prefixes

The test case pinpoints purge_detached.


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

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 02:27:03 UTC 2016

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

Log Message:
Add tests for multiple routers with a single prefix


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/tests/net/ndp/t_ra.sh:1.14
--- src/tests/net/ndp/t_ra.sh:1.13	Mon Dec 19 01:37:30 2016
+++ src/tests/net/ndp/t_ra.sh	Mon Dec 19 02:27:02 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.13 2016/12/19 01:37:30 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.14 2016/12/19 02:27:02 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -26,14 +26,17 @@
 #
 
 RUMPSRV=unix://r1
+RUMPSRV1_2=unix://r12
 RUMPCLI=unix://r2
 RUMPSRV3=unix://r3
 IP6SRV=fc00:1::1
+IP6SRV1_2=fc00:1::2
 IP6SRV_PREFIX=fc00:1:
 IP6CLI=fc00:2::2
 IP6SRV3=fc00:3::1
 IP6SRV3_PREFIX=fc00:3:
 PIDFILE=./rump.rtadvd.pid
+PIDFILE1_2=./rump.rtadvd.pid12
 PIDFILE3=./rump.rtadvd.pid3
 CONFIG=./rtadvd.conf
 DEBUG=${DEBUG:-true}
@@ -374,6 +377,7 @@ ra_multiple_routers_head()
 
 ra_multiple_routers_body()
 {
+	local n=
 
 	rump_server_fs_start $RUMPSRV netinet6
 	rump_server_fs_start $RUMPSRV3 netinet6
@@ -398,6 +402,12 @@ ra_multiple_routers_body()
 	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 	check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX
 
+	export RUMP_SERVER=$RUMPCLI
+	# Two prefixes are advertised by differnt two routers
+	n=$(rump.ndp -p |grep 'advertised by' |wc -l)
+	atf_check_equal $n 2
+	unset RUMP_SERVER
+
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
 	wait_term ${PIDFILE}
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
@@ -422,6 +432,71 @@ ra_multiple_routers_cleanup()
 	cleanup
 }
 
+atf_test_case ra_multiple_routers_single_prefix cleanup
+ra_multiple_routers_single_prefix_head()
+{
+
+	atf_set "descr" "Tests for multiple routers with a single prefix"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_multiple_routers_single_prefix_body()
+{
+	local n=
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_fs_start $RUMPSRV1_2 netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPSRV1_2} ${IP6SRV1_2}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	init_server $RUMPSRV
+	init_server $RUMPSRV1_2
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	start_rtadvd $RUMPSRV1_2 $PIDFILE1_2
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+	check_entries $RUMPCLI $RUMPSRV1_2 $IP6SRV_PREFIX
+
+	export RUMP_SERVER=$RUMPCLI
+	# One prefix is advertised by differnt two routers
+	n=$(rump.ndp -p |grep 'advertised by' |wc -l)
+	atf_check_equal $n 1
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE1_2}`
+	wait_term ${PIDFILE1_2}
+
+	rump_server_destroy_ifaces
+}
+
+ra_multiple_routers_single_prefix_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+	if [ -f ${PIDFILE1_2} ]; then
+		kill -TERM `cat ${PIDFILE1_2}`
+		wait_term ${PIDFILE1_2}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -430,4 +505,5 @@ atf_init_test_cases()
 	atf_add_test_case ra_flush_defrouter_entries
 	atf_add_test_case ra_delete_address
 	atf_add_test_case ra_multiple_routers
+	atf_add_test_case ra_multiple_routers_single_prefix
 }



CVS commit: src/tests/net/ndp

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 02:27:03 UTC 2016

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

Log Message:
Add tests for multiple routers with a single prefix


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

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 01:37:30 UTC 2016

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

Log Message:
Fix the description of a test


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

2016-12-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 19 01:37:30 UTC 2016

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

Log Message:
Fix the description of a test


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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.12 src/tests/net/ndp/t_ra.sh:1.13
--- src/tests/net/ndp/t_ra.sh:1.12	Fri Dec 16 09:11:18 2016
+++ src/tests/net/ndp/t_ra.sh	Mon Dec 19 01:37:30 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.12 2016/12/16 09:11:18 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.13 2016/12/19 01:37:30 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -368,7 +368,7 @@ atf_test_case ra_multiple_routers cleanu
 ra_multiple_routers_head()
 {
 
-	atf_set "descr" "Tests for deleting auto-configured address"
+	atf_set "descr" "Tests for multiple routers"
 	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
 }
 



CVS commit: src/tests/net/ndp

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:11:18 UTC 2016

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

Log Message:
Add tests for multiple routers


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

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:11:18 UTC 2016

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

Log Message:
Add tests for multiple routers


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/tests/net/ndp/t_ra.sh:1.12
--- src/tests/net/ndp/t_ra.sh:1.11	Fri Dec 16 09:10:37 2016
+++ src/tests/net/ndp/t_ra.sh	Fri Dec 16 09:11:18 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.11 2016/12/16 09:10:37 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.12 2016/12/16 09:11:18 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -27,9 +27,14 @@
 
 RUMPSRV=unix://r1
 RUMPCLI=unix://r2
+RUMPSRV3=unix://r3
 IP6SRV=fc00:1::1
+IP6SRV_PREFIX=fc00:1:
 IP6CLI=fc00:2::2
+IP6SRV3=fc00:3::1
+IP6SRV3_PREFIX=fc00:3:
 PIDFILE=./rump.rtadvd.pid
+PIDFILE3=./rump.rtadvd.pid3
 CONFIG=./rtadvd.conf
 DEBUG=${DEBUG:-true}
 
@@ -95,15 +100,25 @@ start_rtadvd()
 
 check_entries()
 {
+	local cli=$1
+	local srv=$2
+	local addr_prefix=$3
+	local mac_srv= ll_srv=
 
-	export RUMP_SERVER=$1
+	ll_srv=$(get_linklocal_addr $srv shmif0)
+	mac_srv=$(get_macaddr $srv shmif0)
+
+	export RUMP_SERVER=$cli
 	$DEBUG && dump_entries
 	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
 	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:"${ll_srv}%shmif0 \(reachable\)" rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
-	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
-	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 \
+	-o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \
+	rump.ndp -n -a
+	atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a
+	atf_check -s exit:0 -o match:$addr_prefix rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 }
 
@@ -162,7 +177,7 @@ ra_basic_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 
-	check_entries $RUMPCLI
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
 	wait_term ${PIDFILE}
@@ -209,7 +224,7 @@ ra_flush_prefix_entries_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 
-	check_entries $RUMPCLI
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
 	export RUMP_SERVER=${RUMPCLI}
 
@@ -266,7 +281,7 @@ ra_flush_defrouter_entries_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 
-	check_entries $RUMPCLI
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
 	export RUMP_SERVER=${RUMPCLI}
 
@@ -323,7 +338,7 @@ ra_delete_address_body()
 
 	start_rtadvd $RUMPSRV $PIDFILE
 
-	check_entries $RUMPCLI
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
 
 	export RUMP_SERVER=${RUMPCLI}
 	$DEBUG && rump.ifconfig shmif0
@@ -349,6 +364,64 @@ ra_delete_address_cleanup()
 	cleanup
 }
 
+atf_test_case ra_multiple_routers cleanup
+ra_multiple_routers_head()
+{
+
+	atf_set "descr" "Tests for deleting auto-configured address"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_multiple_routers_body()
+{
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_fs_start $RUMPSRV3 netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPSRV3} ${IP6SRV3}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	init_server $RUMPSRV
+	init_server $RUMPSRV3
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	start_rtadvd $RUMPSRV $PIDFILE
+	start_rtadvd $RUMPSRV3 $PIDFILE3
+
+	check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+	check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
+	wait_term ${PIDFILE3}
+
+	rump_server_destroy_ifaces
+}
+
+ra_multiple_routers_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+	if [ -f ${PIDFILE3} ]; then
+		kill -TERM `cat ${PIDFILE3}`
+		wait_term ${PIDFILE3}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -356,4 +429,5 @@ atf_init_test_cases()
 	atf_add_test_case ra_flush_prefix_entries
 	atf_add_test_case ra_flush_defrouter_entries
 	atf_add_test_case ra_delete_address
+	atf_add_test_case ra_multiple_routers
 }



CVS commit: src/tests/net/ndp

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:10:37 UTC 2016

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

Log Message:
Unify common routines


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

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:10:37 UTC 2016

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

Log Message:
Unify common routines


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/tests/net/ndp/t_ra.sh:1.11
--- src/tests/net/ndp/t_ra.sh:1.10	Fri Dec 16 09:10:08 2016
+++ src/tests/net/ndp/t_ra.sh	Fri Dec 16 09:10:37 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.10 2016/12/16 09:10:08 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.11 2016/12/16 09:10:37 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -33,6 +33,17 @@ PIDFILE=./rump.rtadvd.pid
 CONFIG=./rtadvd.conf
 DEBUG=${DEBUG:-true}
 
+init_server()
+{
+
+	export RUMP_SERVER=$1
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
+	unset LD_PRELOAD
+	unset RUMP_SERVER
+}
+
 setup_shmif0()
 {
 	local sock=$1
@@ -70,6 +81,32 @@ shmif0:\
 _EOF
 }
 
+start_rtadvd()
+{
+	local sock=$1
+	local pidfile=$2
+
+	export RUMP_SERVER=$sock
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0
+	atf_check -s exit:0 sleep 3
+	atf_check -s exit:0 -o ignore -e empty cat $pidfile
+	unset RUMP_SERVER
+}
+
+check_entries()
+{
+
+	export RUMP_SERVER=$1
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+}
+
 dump_entries()
 {
 
@@ -96,12 +133,7 @@ ra_basic_body()
 	rump_server_start $RUMPCLI netinet6
 
 	setup_shmif0 ${RUMPSRV} ${IP6SRV}
-	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
-	export LD_PRELOAD=/usr/lib/librumphijack.so
-	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
-	unset LD_PRELOAD
-	unset RUMP_SERVER
+	init_server $RUMPSRV
 
 	setup_shmif0 ${RUMPCLI} ${IP6CLI}
 	export RUMP_SERVER=${RUMPCLI}
@@ -110,12 +142,7 @@ ra_basic_body()
 	unset RUMP_SERVER
 
 	create_rtadvdconfig
-
-	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
-	atf_check -s exit:0 sleep 3
-	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
-	unset RUMP_SERVER
+	start_rtadvd $RUMPSRV $PIDFILE
 
 	export RUMP_SERVER=${RUMPCLI}
 	atf_check -s exit:0 -o empty rump.ndp -r
@@ -133,22 +160,9 @@ ra_basic_body()
 	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
 	unset RUMP_SERVER
 
-	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
-	atf_check -s exit:0 sleep 3
-	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
-	unset RUMP_SERVER
+	start_rtadvd $RUMPSRV $PIDFILE
 
-	export RUMP_SERVER=${RUMPCLI}
-	$DEBUG && rump.ndp -n -a
-	$DEBUG && rump.ndp -r
-	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
-	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
-	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
-	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
-	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
-	unset RUMP_SERVER
+	check_entries $RUMPCLI
 
 	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
 	wait_term ${PIDFILE}
@@ -185,12 +199,7 @@ ra_flush_prefix_entries_body()
 	setup_shmif0 ${RUMPSRV} ${IP6SRV}
 	setup_shmif0 ${RUMPCLI} ${IP6CLI}
 
-	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
-	export LD_PRELOAD=/usr/lib/librumphijack.so
-	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
-	unset LD_PRELOAD
-	unset RUMP_SERVER
+	init_server $RUMPSRV
 
 	create_rtadvdconfig
 
@@ -198,20 +207,11 @@ ra_flush_prefix_entries_body()
 	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
 	unset RUMP_SERVER
 
-	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
-	atf_check -s exit:0 sleep 3
-	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
-	unset RUMP_SERVER
+	start_rtadvd $RUMPSRV $PIDFILE
+
+	check_entries $RUMPCLI
 
 	export RUMP_SERVER=${RUMPCLI}
-	$DEBUG && dump_entries
-	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
-	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
-	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n 

CVS commit: src/tests/net/ndp

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:10:08 UTC 2016

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

Log Message:
Avoid using /var/run/rump.rtadvd.pid


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/tests/net/ndp/t_ra.sh:1.10
--- src/tests/net/ndp/t_ra.sh:1.9	Fri Dec 16 03:49:45 2016
+++ src/tests/net/ndp/t_ra.sh	Fri Dec 16 09:10:08 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.9 2016/12/16 03:49:45 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.10 2016/12/16 09:10:08 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -29,7 +29,7 @@ RUMPSRV=unix://r1
 RUMPCLI=unix://r2
 IP6SRV=fc00:1::1
 IP6CLI=fc00:2::2
-PIDFILE=/var/run/rump.rtadvd.pid
+PIDFILE=./rump.rtadvd.pid
 CONFIG=./rtadvd.conf
 DEBUG=${DEBUG:-true}
 
@@ -112,7 +112,7 @@ ra_basic_body()
 	create_rtadvdconfig
 
 	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
 	atf_check -s exit:0 sleep 3
 	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
 	unset RUMP_SERVER
@@ -134,7 +134,7 @@ ra_basic_body()
 	unset RUMP_SERVER
 
 	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
 	atf_check -s exit:0 sleep 3
 	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
 	unset RUMP_SERVER
@@ -199,7 +199,7 @@ ra_flush_prefix_entries_body()
 	unset RUMP_SERVER
 
 	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
 	atf_check -s exit:0 sleep 3
 	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
 	unset RUMP_SERVER
@@ -270,7 +270,7 @@ ra_flush_defrouter_entries_body()
 	unset RUMP_SERVER
 
 	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
 	atf_check -s exit:0 sleep 3
 	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
 	unset RUMP_SERVER
@@ -341,7 +341,7 @@ ra_delete_address_body()
 	unset RUMP_SERVER
 
 	export RUMP_SERVER=${RUMPSRV}
-	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p ${PIDFILE} shmif0
 	atf_check -s exit:0 sleep 3
 	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
 	unset RUMP_SERVER



CVS commit: src/tests/net/ndp

2016-12-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 09:10:08 UTC 2016

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

Log Message:
Avoid using /var/run/rump.rtadvd.pid


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

2016-12-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 03:49:45 UTC 2016

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

Log Message:
Add a test case that deletes auto-configured addresses


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/tests/net/ndp/t_ra.sh:1.9
--- src/tests/net/ndp/t_ra.sh:1.8	Fri Dec 16 03:14:23 2016
+++ src/tests/net/ndp/t_ra.sh	Fri Dec 16 03:49:45 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.8 2016/12/16 03:14:23 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.9 2016/12/16 03:49:45 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -310,10 +310,79 @@ ra_flush_defrouter_entries_cleanup()
 	cleanup
 }
 
+atf_test_case ra_delete_address cleanup
+ra_delete_address_head()
+{
+
+	atf_set "descr" "Tests for deleting auto-configured address"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_delete_address_body()
+{
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
+	unset LD_PRELOAD
+	unset RUMP_SERVER
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 sleep 3
+	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPCLI}
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+
+	$DEBUG && rump.ifconfig shmif0
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 \
+	$(rump.ifconfig shmif0 |awk '/AUTOCONF/ {print $2}') delete
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+
+	rump_server_destroy_ifaces
+}
+
+ra_delete_address_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
 	atf_add_test_case ra_basic
 	atf_add_test_case ra_flush_prefix_entries
 	atf_add_test_case ra_flush_defrouter_entries
+	atf_add_test_case ra_delete_address
 }



CVS commit: src/tests/net/ndp

2016-12-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 03:49:45 UTC 2016

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

Log Message:
Add a test case that deletes auto-configured addresses


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

2016-12-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 03:14:23 UTC 2016

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

Log Message:
Improve stability of the tests

- Do ifconfig -w 10 after ifconfig up
- Accept /1d0h0m..s/ in addition to /23h59m..s/ for expiration time
- Prevent new RA messages from coming after flushing entries

The changes should fix flapping of test results on babylon5.


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

2016-12-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 16 03:14:23 UTC 2016

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

Log Message:
Improve stability of the tests

- Do ifconfig -w 10 after ifconfig up
- Accept /1d0h0m..s/ in addition to /23h59m..s/ for expiration time
- Prevent new RA messages from coming after flushing entries

The changes should fix flapping of test results on babylon5.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/tests/net/ndp/t_ra.sh:1.8
--- src/tests/net/ndp/t_ra.sh:1.7	Wed Dec 14 07:37:26 2016
+++ src/tests/net/ndp/t_ra.sh	Fri Dec 16 03:14:23 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.7 2016/12/14 07:37:26 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.8 2016/12/16 03:14:23 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -43,6 +43,7 @@ setup_shmif0()
 	export RUMP_SERVER=$sock
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6ADDR}
 	atf_check -s exit:0 rump.ifconfig shmif0 up
+	atf_check -s exit:0 rump.ifconfig -w 10
 
 	$DEBUG && rump.ifconfig
 }
@@ -144,7 +145,7 @@ ra_basic_body()
 	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
 	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
@@ -208,10 +209,14 @@ ra_flush_prefix_entries_body()
 	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
 	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
 
+	# Terminate rtadvd to prevent new RA messages from coming
+	# Note that ifconfig down; kill -TERM doesn't work
+	kill -KILL `cat ${PIDFILE}`
+
 	# Flush all the entries in the prefix list
 	atf_check -s exit:0 rump.ndp -P
 
@@ -219,25 +224,17 @@ ra_flush_prefix_entries_body()
 	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
 	atf_check -s exit:0 -o empty rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
 	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
-
 	rump_server_destroy_ifaces
 }
 
 ra_flush_prefix_entries_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-
 	$DEBUG && dump
 	cleanup
 }
@@ -283,10 +280,14 @@ ra_flush_defrouter_entries_body()
 	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
 	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
 
+	# Terminate rtadvd to prevent new RA messages from coming
+	# Note that ifconfig down; kill -TERM doesn't work
+	kill -KILL `cat ${PIDFILE}`
+
 	# Flush all the entries in the default router list
 	atf_check -s exit:0 rump.ndp -R
 
@@ -294,25 +295,17 @@ ra_flush_defrouter_entries_body()
 	atf_check -s exit:0 -o empty rump.ndp -r
 	atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p
 	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
-	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
 	unset RUMP_SERVER
 
-	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
-	wait_term ${PIDFILE}
-
 	rump_server_destroy_ifaces
 }
 
 ra_flush_defrouter_entries_cleanup()
 {
 
-	if [ -f ${PIDFILE} ]; then
-		kill -TERM `cat ${PIDFILE}`
-		wait_term ${PIDFILE}
-	fi
-
 	$DEBUG && dump
 	cleanup
 }



CVS commit: src/tests/net/ndp

2016-12-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 14 07:37:26 UTC 2016

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

Log Message:
Add tests for flushing prefix and default router entries


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

2016-12-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 14 07:37:26 UTC 2016

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

Log Message:
Add tests for flushing prefix and default router entries


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/tests/net/ndp/t_ra.sh:1.7
--- src/tests/net/ndp/t_ra.sh:1.6	Fri Nov 25 08:51:17 2016
+++ src/tests/net/ndp/t_ra.sh	Wed Dec 14 07:37:26 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.6 2016/11/25 08:51:17 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.7 2016/12/14 07:37:26 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -69,6 +69,17 @@ shmif0:\
 _EOF
 }
 
+dump_entries()
+{
+
+	echo ndp -n -a
+	rump.ndp -n -a
+	echo ndp -p
+	rump.ndp -p
+	echo ndp -r
+	rump.ndp -r
+}
+
 atf_test_case ra_basic cleanup
 ra_basic_head()
 {
@@ -156,8 +167,160 @@ ra_basic_cleanup()
 	cleanup
 }
 
+atf_test_case ra_flush_prefix_entries cleanup
+ra_flush_prefix_entries_head()
+{
+
+	atf_set "descr" "Tests for flushing prefixes (ndp -P)"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_flush_prefix_entries_body()
+{
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
+	unset LD_PRELOAD
+	unset RUMP_SERVER
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 sleep 3
+	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPCLI}
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+
+	# Flush all the entries in the prefix list
+	atf_check -s exit:0 rump.ndp -P
+
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o empty rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
+	unset RUMP_SERVER
+
+	atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
+	wait_term ${PIDFILE}
+
+	rump_server_destroy_ifaces
+}
+
+ra_flush_prefix_entries_cleanup()
+{
+
+	if [ -f ${PIDFILE} ]; then
+		kill -TERM `cat ${PIDFILE}`
+		wait_term ${PIDFILE}
+	fi
+
+	$DEBUG && dump
+	cleanup
+}
+
+atf_test_case ra_flush_defrouter_entries cleanup
+ra_flush_defrouter_entries_head()
+{
+
+	atf_set "descr" "Tests for flushing default routers (ndp -R)"
+	atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
+}
+
+ra_flush_defrouter_entries_body()
+{
+
+	rump_server_fs_start $RUMPSRV netinet6
+	rump_server_start $RUMPCLI netinet6
+
+	setup_shmif0 ${RUMPSRV} ${IP6SRV}
+	setup_shmif0 ${RUMPCLI} ${IP6CLI}
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd
+	unset LD_PRELOAD
+	unset RUMP_SERVER
+
+	create_rtadvdconfig
+
+	export RUMP_SERVER=${RUMPCLI}
+	atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPSRV}
+	atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0
+	atf_check -s exit:0 sleep 3
+	atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE}
+	unset RUMP_SERVER
+
+	export RUMP_SERVER=${RUMPCLI}
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r
+	atf_check -s exit:0 -o match:'advertised' rump.ndp -p
+	atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0
+	atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a
+	atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6
+
+	# Flush all the entries in the default router list
+	atf_check -s exit:0 rump.ndp -R
+
+	$DEBUG && dump_entries
+	atf_check -s exit:0 -o empty rump.ndp -r
+	atf_check -s exit:0 -o match:'No advertising 

CVS commit: src/tests/net/ndp

2016-10-03 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Oct  4 03:41:33 UTC 2016

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

Log Message:
Add tests for sysctl net.inet6.ip6.dad_count

>From suzu-ken@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.7 src/tests/net/ndp/t_dad.sh:1.8
--- src/tests/net/ndp/t_dad.sh:1.7	Fri Sep 16 00:50:43 2016
+++ src/tests/net/ndp/t_dad.sh	Tue Oct  4 03:41:33 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.7 2016/09/16 00:50:43 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.8 2016/10/04 03:41:33 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,6 +39,7 @@ duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa]
 
 atf_test_case dad_basic cleanup
 atf_test_case dad_duplicated cleanup
+atf_test_case dad_count cleanup
 
 dad_basic_head()
 {
@@ -52,6 +53,12 @@ dad_duplicated_head()
 	atf_set "require.progs" "rump_server"
 }
 
+dad_count_head()
+{
+	atf_set "descr" "Tests for IPv6 DAD count behavior"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_server()
 {
 	local sock=$1
@@ -202,6 +209,63 @@ dad_duplicated_body()
 	rump.ifconfig shmif0
 }
 
+dad_count_test()
+{
+	local pkt=
+	local count=$1
+	local id=$2
+	local target=$3
+
+	#
+	# Set DAD count to $count
+	#
+	atf_check -s exit:0 rump.sysctl -w -q net.inet6.ip6.dad_count=$count
+
+	# Add a new address
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $target
+
+	# Waiting for DAD complete
+	atf_check -s exit:0 rump.ifconfig -w 20
+
+	# Check the number of DAD probe packets (Neighbor Solicitation Message)
+	atf_check -s exit:0 sleep 2
+	extract_new_packets > ./out
+	$DEBUG && cat ./out
+	pkt=$(make_ns_pkt_str $id $target)
+	atf_check -s exit:0 -o match:"$count" \
+	-x "cat ./out |grep '$pkt' | wc -l | tr -d ' '"
+}
+
+dad_count_body()
+{
+	local localip1=fc00::1
+	local localip2=fc00::2
+
+	atf_check -s exit:0 ${inetserver} $SOCKLOCAL
+	export RUMP_SERVER=$SOCKLOCAL
+
+	# Check default value
+	atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet6.ip6.dad_count
+
+	# Setup interface
+	atf_check -s exit:0 rump.ifconfig shmif0 create
+	atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
+	atf_check -s exit:0 rump.ifconfig shmif0 up
+	atf_check -s exit:0 sleep 2
+	rump.ifconfig shmif0 > ./out
+	$DEBUG && cat ./out
+
+	#
+	# Set and test DAD count (count=1)
+	#
+	dad_count_test 1 1 $localip1
+
+	#
+	# Set and test DAD count (count=8)
+	#
+	dad_count_test 8 2 $localip2
+}
+
 cleanup()
 {
 	gdb -ex bt /usr/bin/rump_server rump_server.core
@@ -248,8 +312,16 @@ dad_duplicated_cleanup()
 	cleanup
 }
 
+dad_count_cleanup()
+{
+	$DEBUG && dump_local
+	$DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r -
+	env RUMP_SERVER=$SOCKLOCAL rump.halt
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case dad_basic
 	atf_add_test_case dad_duplicated
+	atf_add_test_case dad_count
 }



CVS commit: src/tests/net/ndp

2016-10-03 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Oct  4 03:41:33 UTC 2016

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

Log Message:
Add tests for sysctl net.inet6.ip6.dad_count

>From suzu-ken@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/ndp/t_dad.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

2016-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Sep 16 00:50:43 UTC 2016

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

Log Message:
Ignore case in duplicated


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/ndp/t_dad.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

2016-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Sep 16 00:50:43 UTC 2016

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

Log Message:
Ignore case in duplicated


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.6 src/tests/net/ndp/t_dad.sh:1.7
--- src/tests/net/ndp/t_dad.sh:1.6	Fri Sep 16 00:14:33 2016
+++ src/tests/net/ndp/t_dad.sh	Fri Sep 16 00:50:43 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.6 2016/09/16 00:14:33 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.7 2016/09/16 00:50:43 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -35,6 +35,8 @@ SOCKPEER=unix://commsock2
 
 DEBUG=false
 
+duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa][Tt][Ee][Dd]"
+
 atf_test_case dad_basic cleanup
 atf_test_case dad_duplicated cleanup
 
@@ -180,8 +182,8 @@ dad_duplicated_body()
 	export RUMP_SERVER=$SOCKLOCAL
 
 	# The primary address isn't marked as duplicated
-	atf_check -s exit:0 -o not-match:'DUPLICATED' \
-	-x "rump.ifconfig shmif0 |grep $localip1"
+	atf_check -s exit:0 -o not-match:"$localip1.+$duplicated" \
+	rump.ifconfig shmif0
 
 	#
 	# Add a new address duplicated with the peer server
@@ -190,14 +192,14 @@ dad_duplicated_body()
 	atf_check -s exit:0 sleep 1
 
 	# The new address is marked as duplicated
-	atf_check -s exit:0 -o match:'DUPLICATED' \
-	-x "rump.ifconfig shmif0 |grep $peerip"
+	atf_check -s exit:0 -o match:"$peerip.+$duplicated" \
+	rump.ifconfig shmif0
 
 	# A unique address isn't marked as duplicated
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2
 	atf_check -s exit:0 sleep 1
-	atf_check -s exit:0 -o not-match:'DUPLICATED' \
-	-x "rump.ifconfig shmif0 |grep $localip2"
+	atf_check -s exit:0 -o not-match:"$localip2.+$duplicated" \
+	rump.ifconfig shmif0
 }
 
 cleanup()



CVS commit: src/tests/net/ndp

2016-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Sep 16 00:14:33 UTC 2016

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

Log Message:
Adjust for new ifconfig output

And use -o match to provide informative error messages.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.5 src/tests/net/ndp/t_dad.sh:1.6
--- src/tests/net/ndp/t_dad.sh:1.5	Wed Aug 10 23:07:57 2016
+++ src/tests/net/ndp/t_dad.sh	Fri Sep 16 00:14:33 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.5 2016/08/10 23:07:57 kre Exp $
+#	$NetBSD: t_dad.sh,v 1.6 2016/09/16 00:14:33 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -180,7 +180,8 @@ dad_duplicated_body()
 	export RUMP_SERVER=$SOCKLOCAL
 
 	# The primary address isn't marked as duplicated
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated"
+	atf_check -s exit:0 -o not-match:'DUPLICATED' \
+	-x "rump.ifconfig shmif0 |grep $localip1"
 
 	#
 	# Add a new address duplicated with the peer server
@@ -189,12 +190,14 @@ dad_duplicated_body()
 	atf_check -s exit:0 sleep 1
 
 	# The new address is marked as duplicated
-	atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated"
+	atf_check -s exit:0 -o match:'DUPLICATED' \
+	-x "rump.ifconfig shmif0 |grep $peerip"
 
 	# A unique address isn't marked as duplicated
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2
 	atf_check -s exit:0 sleep 1
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated"
+	atf_check -s exit:0 -o not-match:'DUPLICATED' \
+	-x "rump.ifconfig shmif0 |grep $localip2"
 }
 
 cleanup()



CVS commit: src/tests/net/ndp

2016-08-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 10 23:07:57 UTC 2016

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

Log Message:
+ -lrumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/ndp/t_dad.sh
cvs rdiff -u -r1.12 -r1.13 src/tests/net/ndp/t_ndp.sh
cvs rdiff -u -r1.2 -r1.3 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

2016-08-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 10 23:07:57 UTC 2016

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

Log Message:
+ -lrumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/ndp/t_dad.sh
cvs rdiff -u -r1.12 -r1.13 src/tests/net/ndp/t_ndp.sh
cvs rdiff -u -r1.2 -r1.3 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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.4 src/tests/net/ndp/t_dad.sh:1.5
--- src/tests/net/ndp/t_dad.sh:1.4	Mon Aug 24 02:02:25 2015
+++ src/tests/net/ndp/t_dad.sh	Wed Aug 10 23:07:57 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.4 2015/08/24 02:02:25 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.5 2016/08/10 23:07:57 kre Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,6 +27,7 @@
 
 inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet"
 inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif"
+inetserver="$inetserver -lrumpdev"
 HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes"
 
 SOCKLOCAL=unix://commsock1

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.12 src/tests/net/ndp/t_ndp.sh:1.13
--- src/tests/net/ndp/t_ndp.sh:1.12	Tue Jun 21 05:04:16 2016
+++ src/tests/net/ndp/t_ndp.sh	Wed Aug 10 23:07:57 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.12 2016/06/21 05:04:16 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.13 2016/08/10 23:07:57 kre Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,6 +27,7 @@
 
 inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet"
 inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif"
+inetserver="$inetserver -lrumpdev"
 HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes"
 
 SOCKSRC=unix://commsock1

Index: src/tests/net/ndp/t_ra.sh
diff -u src/tests/net/ndp/t_ra.sh:1.2 src/tests/net/ndp/t_ra.sh:1.3
--- src/tests/net/ndp/t_ra.sh:1.2	Thu Nov 12 05:01:28 2015
+++ src/tests/net/ndp/t_ra.sh	Wed Aug 10 23:07:57 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ra.sh,v 1.2 2015/11/12 05:01:28 ozaki-r Exp $
+#	$NetBSD: t_ra.sh,v 1.3 2016/08/10 23:07:57 kre Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -26,7 +26,7 @@
 #
 
 RUMPFLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6"
-RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif"
+RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif -lrumpdev"
 RUMPFLAGS="${RUMPFLAGS} -lrumpvfs -lrumpfs_ffs"
 
 RUMPSRV=unix://r1



CVS commit: src/tests/net/ndp

2016-05-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 20 06:48:52 UTC 2016

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

Log Message:
Adjust the tests for temp option that works now

See PR kern/50127


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/tests/net/ndp/t_ndp.sh:1.11
--- src/tests/net/ndp/t_ndp.sh:1.10	Mon Apr  4 07:37:08 2016
+++ src/tests/net/ndp/t_ndp.sh	Fri May 20 06:48:52 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.10 2016/04/04 07:37:08 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.11 2016/05/20 06:48:52 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -210,12 +210,11 @@ command_body()
 	atf_check -s exit:0 -o ignore -e ignore rump.ndp -n fc00::11
 	atf_check -s exit:0 -o ignore -e ignore rump.ndp -n fc00::12
 
-	# Test temp option (XXX it doesn't work; expire time isn't set)
 	$DEBUG && rump.ndp -n -a
-	#atf_check -s exit:0 -o ignore rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp
+	atf_check -s exit:0 -o ignore rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp
 	rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp
 	$DEBUG && rump.ndp -n -a
-	#atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10
+	atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10
 
 	return 0
 }



CVS commit: src/tests/net/ndp

2016-05-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 20 06:48:52 UTC 2016

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

Log Message:
Adjust the tests for temp option that works now

See PR kern/50127


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

2015-11-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 18 04:13:01 UTC 2015

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

Log Message:
Don't assign unused IP address

It sometimes creates an unexpected NDP cache.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/tests/net/ndp/t_ndp.sh:1.8
--- src/tests/net/ndp/t_ndp.sh:1.7	Tue Nov 17 06:44:13 2015
+++ src/tests/net/ndp/t_ndp.sh	Wed Nov 18 04:13:01 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.7 2015/11/17 06:44:13 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.8 2015/11/18 04:13:01 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -68,10 +68,14 @@ neighborgcthresh_head()
 
 setup_dst_server()
 {
+	local assign_ip=$1
+
 	export RUMP_SERVER=$SOCKDST
 	atf_check -s exit:0 rump.ifconfig shmif0 create
 	atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1
-	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6DST
+	if [ "$assign_ip" != no ]; then
+		atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6DST
+	fi
 	atf_check -s exit:0 rump.ifconfig shmif0 up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
@@ -249,7 +253,7 @@ neighborgcthresh_body()
 	atf_check -s exit:0 ${inetserver} $SOCKSRC
 	atf_check -s exit:0 ${inetserver} $SOCKDST
 
-	setup_dst_server
+	setup_dst_server no
 	setup_src_server
 
 	export RUMP_SERVER=$SOCKDST



CVS commit: src/tests/net/ndp

2015-11-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 18 04:13:01 UTC 2015

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

Log Message:
Don't assign unused IP address

It sometimes creates an unexpected NDP cache.


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

2015-11-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov 17 06:44:13 UTC 2015

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

Log Message:
Add tests for GC of neighbor caches


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

2015-11-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov 17 06:44:13 UTC 2015

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

Log Message:
Add tests for GC of neighbor caches


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/tests/net/ndp/t_ndp.sh:1.7
--- src/tests/net/ndp/t_ndp.sh:1.6	Tue Aug 18 00:58:35 2015
+++ src/tests/net/ndp/t_ndp.sh	Tue Nov 17 06:44:13 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.6 2015/08/18 00:58:35 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.7 2015/11/17 06:44:13 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -40,6 +40,7 @@ TIMEOUT=1
 atf_test_case cache_expiration cleanup
 atf_test_case command cleanup
 atf_test_case cache_overwriting cleanup
+atf_test_case neighborgcthresh cleanup
 
 cache_expiration_head()
 {
@@ -59,6 +60,12 @@ cache_overwriting_head()
 	atf_set "require.progs" "rump_server"
 }
 
+neighborgcthresh_head()
+{
+	atf_set "descr" "Tests for GC of neighbor caches"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_dst_server()
 {
 	export RUMP_SERVER=$SOCKDST
@@ -230,6 +237,68 @@ cache_overwriting_body()
 	return 0
 }
 
+get_n_caches()
+{
+
+	echo $(rump.ndp -a -n |grep -v -e Neighbor -e permanent |wc -l)
+}
+
+neighborgcthresh_body()
+{
+
+	atf_check -s exit:0 ${inetserver} $SOCKSRC
+	atf_check -s exit:0 ${inetserver} $SOCKDST
+
+	setup_dst_server
+	setup_src_server
+
+	export RUMP_SERVER=$SOCKDST
+	for i in $(seq 0 9); do
+		atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6DST}$i
+	done
+
+	export RUMP_SERVER=$SOCKSRC
+
+	# ping to 3 destinations
+	$DEBUG && rump.ndp -n -a
+	for i in $(seq 0 2); do
+		atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 \
+		${IP6DST}$i
+	done
+	$DEBUG && rump.ndp -n -a
+
+	# 3 caches should be created
+	atf_check_equal $(get_n_caches) 3
+
+	# ping to additional 3 destinations
+	for i in $(seq 3 5); do
+		atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 \
+		${IP6DST}$i
+	done
+	$DEBUG && rump.ndp -n -a
+
+	# 6 caches should be created in total
+	atf_check_equal $(get_n_caches) 6
+
+	# Limit the number of neighbor caches to 5
+	atf_check -s exit:0 -o ignore rump.sysctl -w \
+	net.inet6.ip6.neighborgcthresh=5
+
+	# ping to additional 4 destinations
+	for i in $(seq 6 9); do
+		atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 \
+		${IP6DST}$i
+	done
+
+	# More than 5 caches should be created in total, but exceeded caches
+	# should be GC-ed
+	if [ "$(get_n_caches)" -gt 5 ]; then
+		atf_fail "Neighbor caches are not GC-ed"
+	fi
+
+	return 0
+}
+
 cleanup()
 {
 	env RUMP_SERVER=$SOCKSRC rump.halt
@@ -281,9 +350,16 @@ cache_overwriting_cleanup()
 	cleanup
 }
 
+neighborgcthresh_cleanup()
+{
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case cache_expiration
 	atf_add_test_case command
 	atf_add_test_case cache_overwriting
+	atf_add_test_case neighborgcthresh
 }



CVS commit: src/tests/net/ndp

2015-11-11 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 12 05:01:28 UTC 2015

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

Log Message:
Fix up the header

Remove unnecessary shebang and add missing keyword expansion,
copyright and license.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/tests/net/ndp/t_ra.sh:1.2
--- src/tests/net/ndp/t_ra.sh:1.1	Wed Nov 11 07:52:57 2015
+++ src/tests/net/ndp/t_ra.sh	Thu Nov 12 05:01:28 2015
@@ -1,4 +1,30 @@
-#! /usr/bin/env atf-sh
+#	$NetBSD: t_ra.sh,v 1.2 2015/11/12 05:01:28 ozaki-r Exp $
+#
+# Copyright (c) 2015 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+#
+
 RUMPFLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6"
 RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif"
 RUMPFLAGS="${RUMPFLAGS} -lrumpvfs -lrumpfs_ffs"



CVS commit: src/tests/net/ndp

2015-11-11 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 12 05:01:28 UTC 2015

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

Log Message:
Fix up the header

Remove unnecessary shebang and add missing keyword expansion,
copyright and license.


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

2015-08-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Aug 18 00:58:35 UTC 2015

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

Log Message:
Make a test a bit easy

Accept just 24h of expiration time in addition to 24h - a few seconds.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/tests/net/ndp/t_ndp.sh:1.6
--- src/tests/net/ndp/t_ndp.sh:1.5	Mon Aug 17 07:47:21 2015
+++ src/tests/net/ndp/t_ndp.sh	Tue Aug 18 00:58:35 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.5 2015/08/17 07:47:21 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.6 2015/08/18 00:58:35 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -124,7 +124,7 @@ cache_expiration_body()
 	$DEBUG  rump.ndp -n -a
 	atf_check -s exit:0 -o match:'permanent' rump.ndp -n $IP6SRC
 	# Expired but remains until GC sweaps it (1 day)
-	atf_check -s exit:0 -o match:'23h59m' rump.ndp -n $IP6DST
+	atf_check -s exit:0 -o match:'(1d0h0m|23h59m)' rump.ndp -n $IP6DST
 }
 
 ifdown_dst_server()



CVS commit: src/tests/net/ndp

2015-08-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Aug 18 00:58:35 UTC 2015

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

Log Message:
Make a test a bit easy

Accept just 24h of expiration time in addition to 24h - a few seconds.


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

2015-08-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 17 07:47:21 UTC 2015

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

Log Message:
Improve test stability

A test for ndp -c was sometimes failed because between the deletion
and the check NS/NA messages were exchanged and a NDP cache was
recreated unexpectedly. To provent this situation, we do ifconfig
shmif0 down of the peer before the test, so the test won't be
interfered by the messages.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/tests/net/ndp/t_ndp.sh:1.5
--- src/tests/net/ndp/t_ndp.sh:1.4	Mon Aug 10 09:32:01 2015
+++ src/tests/net/ndp/t_ndp.sh	Mon Aug 17 07:47:21 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.4 2015/08/10 09:32:01 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.5 2015/08/17 07:47:21 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -127,6 +127,13 @@ cache_expiration_body()
 	atf_check -s exit:0 -o match:'23h59m' rump.ndp -n $IP6DST
 }
 
+ifdown_dst_server()
+{
+	export RUMP_SERVER=$SOCKDST
+	atf_check -s exit:0 rump.ifconfig shmif0 down
+	export RUMP_SERVER=$SOCKSRC
+}
+
 command_body()
 {
 	atf_check -s exit:0 ${inetserver} $SOCKSRC
@@ -170,6 +177,9 @@ command_body()
 	atf_check -s exit:0 -o match:'fc00::11' rump.ndp -n -a
 	atf_check -s exit:0 -o match:'fc00::12' rump.ndp -n -a
 
+	# Ensure no packet upsets the src server
+	ifdown_dst_server
+
 	# Flush all entries (-c)
 	$DEBUG  rump.ndp -n -a
 	atf_check -s exit:0 -o ignore rump.ndp -c



CVS commit: src/tests/net/ndp

2015-08-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 17 07:47:21 UTC 2015

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

Log Message:
Improve test stability

A test for ndp -c was sometimes failed because between the deletion
and the check NS/NA messages were exchanged and a NDP cache was
recreated unexpectedly. To provent this situation, we do ifconfig
shmif0 down of the peer before the test, so the test won't be
interfered by the messages.


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

2015-08-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 10 09:32:01 UTC 2015

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

Log Message:
Fix head and cleanup definitions for cache_expiration tests


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/net/ndp/t_ndp.sh:1.4
--- src/tests/net/ndp/t_ndp.sh:1.3	Fri Aug  7 00:50:12 2015
+++ src/tests/net/ndp/t_ndp.sh	Mon Aug 10 09:32:01 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.3 2015/08/07 00:50:12 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.4 2015/08/10 09:32:01 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -41,7 +41,7 @@ atf_test_case cache_expiration cleanup
 atf_test_case command cleanup
 atf_test_case cache_overwriting cleanup
 
-cache_expiration()
+cache_expiration_head()
 {
 	atf_set descr Tests for NDP cache expiration
 	atf_set require.progs rump_server
@@ -253,7 +253,7 @@ dump()
 	$DEBUG  gdb -ex bt /usr/sbin/rump.ndp rump.ndp.core
 }
 
-cache_expiration()
+cache_expiration_cleanup()
 {
 	$DEBUG  dump
 	cleanup



CVS commit: src/tests/net/ndp

2015-08-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 10 09:32:01 UTC 2015

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

Log Message:
Fix head and cleanup definitions for cache_expiration tests


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

2015-08-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 10 09:31:13 UTC 2015

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

Log Message:
Fix cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/ndp/t_dad.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_dad.sh
diff -u src/tests/net/ndp/t_dad.sh:1.1 src/tests/net/ndp/t_dad.sh:1.2
--- src/tests/net/ndp/t_dad.sh:1.1	Mon Aug  3 09:54:20 2015
+++ src/tests/net/ndp/t_dad.sh	Mon Aug 10 09:31:13 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.1 2015/08/03 09:54:20 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.2 2015/08/10 09:31:13 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -217,7 +217,7 @@ dad_basic_cleanup()
 dad_duplicated_cleanup()
 {
 	$DEBUG  dump
-	env RUMP_SERVER=$SOCKLOCAL rump.halt
+	cleanup
 }
 
 atf_init_test_cases()



CVS commit: src/tests/net/ndp

2015-08-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 10 09:31:13 UTC 2015

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

Log Message:
Fix cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/ndp/t_dad.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

2015-08-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Aug  4 07:43:25 UTC 2015

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

Log Message:
Check the output of ndp -d strictly


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

2015-08-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Aug  4 07:43:25 UTC 2015

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

Log Message:
Check the output of ndp -d strictly


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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.1 src/tests/net/ndp/t_ndp.sh:1.2
--- src/tests/net/ndp/t_ndp.sh:1.1	Mon Aug  3 09:54:20 2015
+++ src/tests/net/ndp/t_ndp.sh	Tue Aug  4 07:43:25 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.1 2015/08/03 09:54:20 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.2 2015/08/04 07:43:25 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -145,7 +145,7 @@ command_body()
 	atf_check -s exit:0 -o ignore rump.ndp -s fc00::10 b2:a0:20:00:00:10
 	$DEBUG  rump.ndp -n -a
 	atf_check -s exit:0 -o match:'permanent' rump.ndp -n fc00::10
-	atf_check -s exit:0 -o ignore rump.ndp -d fc00::10
+	atf_check -s exit:0 -o match:'deleted' rump.ndp -d fc00::10
 	$DEBUG  rump.ndp -n -a
 	atf_check -s not-exit:0 -o ignore -e ignore rump.ndp -n fc00::10