Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/ndp Add a test case for IPv6 temporary address



details:   https://anonhg.NetBSD.org/src/rev/b4cd43e638f3
branches:  trunk
changeset: 820542:b4cd43e638f3
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jan 11 03:15:44 2017 +0000

description:
Add a test case for IPv6 temporary address

diffstat:

 tests/net/ndp/t_ra.sh |  81 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 80 insertions(+), 1 deletions(-)

diffs (100 lines):

diff -r b65fae012298 -r b4cd43e638f3 tests/net/ndp/t_ra.sh
--- a/tests/net/ndp/t_ra.sh     Wed Jan 11 03:15:11 2017 +0000
+++ b/tests/net/ndp/t_ra.sh     Wed Jan 11 03:15:44 2017 +0000
@@ -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 @@
        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.+<AUTOCONF,TEMPORARY>" \
+           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_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
 }



Home | Main Index | Thread Index | Old Index