summaryrefslogtreecommitdiff
path: root/contrib/netbsd-tests/net/ndp/t_ra.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/net/ndp/t_ra.sh')
-rwxr-xr-xcontrib/netbsd-tests/net/ndp/t_ra.sh80
1 files changed, 48 insertions, 32 deletions
diff --git a/contrib/netbsd-tests/net/ndp/t_ra.sh b/contrib/netbsd-tests/net/ndp/t_ra.sh
index b2345704f462b..69f227af498e8 100755
--- a/contrib/netbsd-tests/net/ndp/t_ra.sh
+++ b/contrib/netbsd-tests/net/ndp/t_ra.sh
@@ -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.24 2017/01/13 08:11:01 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.+<AUTOCONF>" \
+ atf_check -s exit:0 \
+ -o match:"$addr_prefix.+<(TENTATIVE,)?AUTOCONF>" \
rump.ifconfig shmif0 inet6
unset RUMP_SERVER
}
@@ -603,60 +604,75 @@ 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
- 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
+ export RUMP_SERVER=$RUMPCLI
+
# Check temporary address
- export RUMP_SERVER=${RUMPCLI}
- atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+<AUTOCONF,TEMPORARY>" \
+ 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 '/<AUTOCONF>/ {sub(/\/[0-9]*/, ""); print $2;}')
+ ip_temp=$(rump.ifconfig shmif0 |awk '/<AUTOCONF,TEMPORARY>/ {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_temp $IP6SRV
+
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
- wait_term ${PIDFILE}
+ wait_term $PIDFILE
rump_server_destroy_ifaces
}