diff options
Diffstat (limited to 'contrib/netbsd-tests/net')
-rw-r--r-- | contrib/netbsd-tests/net/bpf/t_bpf.c | 40 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpf/t_mbuf.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpfilter/t_bpfilter.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpfjit/t_bpfjit.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpfjit/t_cop.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpfjit/t_extmem.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/bpfjit/t_mbuf.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/carp/t_basic.c | 221 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/carp/t_basic.sh | 165 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/config/netconfig.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/icmp/t_forward.c | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/icmp/t_ping.c | 6 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/if/t_ifconfig.sh | 4 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/if_loop/t_pr.c | 6 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/if_tun/t_tun.sh | 138 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/if_vlan/t_vlan.sh | 115 | ||||
-rwxr-xr-x | contrib/netbsd-tests/net/ndp/t_ra.sh | 80 | ||||
-rw-r--r-- | contrib/netbsd-tests/net/net/t_raw.c | 4 |
18 files changed, 537 insertions, 290 deletions
diff --git a/contrib/netbsd-tests/net/bpf/t_bpf.c b/contrib/netbsd-tests/net/bpf/t_bpf.c index 95ca2fc..cf8aa82 100644 --- a/contrib/netbsd-tests/net/bpf/t_bpf.c +++ b/contrib/netbsd-tests/net/bpf/t_bpf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $ */ +/* $NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $ */ /*- * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $"); +__RCSID("$NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" ATF_TC(bpfwriteleak); @@ -166,6 +166,39 @@ ATF_TC_BODY(bpfwritetrunc, tc) } #endif /* #if (SIZE_MAX > UINT_MAX) */ +ATF_TC(bpf_ioctl_BLEN); +ATF_TC_HEAD(bpf_ioctl_BLEN, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Checks behaviors of BIOCGBLEN and " + "BIOCSBLEN"); +} + +ATF_TC_BODY(bpf_ioctl_BLEN, tc) +{ + struct ifreq ifr; + int ifnum, bpfd; + u_int blen = 0; + + RZ(rump_init()); + RZ(rump_pub_shmif_create(NULL, &ifnum)); + sprintf(ifr.ifr_name, "shmif%d", ifnum); + + RL(bpfd = rump_sys_open("/dev/bpf", O_RDWR)); + + RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen)); + ATF_REQUIRE(blen != 0); + blen = 100; + RL(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen)); + RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen)); + ATF_REQUIRE_EQ(blen, 100); + + RL(rump_sys_ioctl(bpfd, BIOCSETIF, &ifr)); + + ATF_REQUIRE_EQ_MSG(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen), -1, + "Don't allow to change buflen after binding bpf to an interface"); +} + ATF_TP_ADD_TCS(tp) { @@ -173,5 +206,6 @@ ATF_TP_ADD_TCS(tp) #if (SIZE_MAX > UINT_MAX) ATF_TP_ADD_TC(tp, bpfwritetrunc); #endif + ATF_TP_ADD_TC(tp, bpf_ioctl_BLEN); return atf_no_error(); } diff --git a/contrib/netbsd-tests/net/bpf/t_mbuf.c b/contrib/netbsd-tests/net/bpf/t_mbuf.c index 965dd02..2076dc2 100644 --- a/contrib/netbsd-tests/net/bpf/t_mbuf.c +++ b/contrib/netbsd-tests/net/bpf/t_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $ */ +/* $NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $"); +__RCSID("$NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $"); #include <sys/param.h> #include <sys/mbuf.h> @@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" static bool test_ldb_abs(size_t split) diff --git a/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c b/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c index 460b43e..15a9ab6 100644 --- a/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c +++ b/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $ */ +/* $NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $"); +__RCSID("$NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -53,7 +53,7 @@ __RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" diff --git a/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c b/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c index 58db1e0..06c3d97 100644 --- a/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c +++ b/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $ */ +/* $NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2011-2012, 2014-2015 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $"); +__RCSID("$NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $"); #include <sys/param.h> #include <sys/mbuf.h> @@ -49,7 +49,7 @@ __RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" static uint8_t deadbeef_at_5[16] = { diff --git a/contrib/netbsd-tests/net/bpfjit/t_cop.c b/contrib/netbsd-tests/net/bpfjit/t_cop.c index 5a007e6..502c588 100644 --- a/contrib/netbsd-tests/net/bpfjit/t_cop.c +++ b/contrib/netbsd-tests/net/bpfjit/t_cop.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $ */ +/* $NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $"); +__RCSID("$NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $"); #include <stdint.h> #include <string.h> @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" static uint32_t retA(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); static uint32_t retBL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); diff --git a/contrib/netbsd-tests/net/bpfjit/t_extmem.c b/contrib/netbsd-tests/net/bpfjit/t_extmem.c index 915c436..51761ec 100644 --- a/contrib/netbsd-tests/net/bpfjit/t_extmem.c +++ b/contrib/netbsd-tests/net/bpfjit/t_extmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $ */ +/* $NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $"); +__RCSID("$NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $"); #include <stdint.h> #include <string.h> @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" static uint32_t retM(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); diff --git a/contrib/netbsd-tests/net/bpfjit/t_mbuf.c b/contrib/netbsd-tests/net/bpfjit/t_mbuf.c index 489ef80..d3a2b99 100644 --- a/contrib/netbsd-tests/net/bpfjit/t_mbuf.c +++ b/contrib/netbsd-tests/net/bpfjit/t_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $ */ +/* $NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $"); +__RCSID("$NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $"); #include <sys/param.h> #include <sys/mbuf.h> @@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $"); #undef m_data #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" static bool test_ldb_abs(size_t split) diff --git a/contrib/netbsd-tests/net/carp/t_basic.c b/contrib/netbsd-tests/net/carp/t_basic.c deleted file mode 100644 index fe2e6b5..0000000 --- a/contrib/netbsd-tests/net/carp/t_basic.c +++ /dev/null @@ -1,221 +0,0 @@ -/* $NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $ */ - -/*- - * Copyright (c) 2010 The NetBSD Foundation, 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. - */ - -#include <sys/cdefs.h> -#ifndef lint -__RCSID("$NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $"); -#endif /* not lint */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/wait.h> - -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip_carp.h> - -#include <rump/rump.h> -#include <rump/rump_syscalls.h> - -#include <atf-c.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <signal.h> - -#include "../config/netconfig.c" -#include "../../h_macros.h" - -static bool oknow = false; - -static void -sighnd(int sig) -{ - - ATF_REQUIRE_EQ(sig, SIGCHLD); - if (oknow) - return; - - atf_tc_fail("child died unexpectedly"); -} - -ATF_TC(handover); -ATF_TC_HEAD(handover, tc) -{ - - atf_tc_set_md_var(tc, "descr", "check that carp handover works if " - "the master dies"); -} - -#define THEBUS "buuuuuuus,etherbus" - -static void -child(bool master) -{ - char ifname[IFNAMSIZ]; - struct carpreq cr; - struct ifreq ifr; - const char *carpif; - int s; - - /* helps reading carp debug output */ - if (master) - carpif = "carp0"; - else - carpif = "carp1"; - - /* - * Should use sysctl, bug debug is dabug. - */ - { - //extern int rumpns_carp_opts[]; /* XXX */ - //rumpns_carp_opts[CARPCTL_LOG] = 1; - } - - - rump_init(); - - memset(&ifr, 0, sizeof(ifr)); - strlcpy(ifr.ifr_name, carpif, sizeof(ifr.ifr_name)); - - RL(s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0)); - RL(rump_sys_ioctl(s, SIOCIFCREATE, &ifr)); - - netcfg_rump_makeshmif(THEBUS, ifname); - - if (master) - netcfg_rump_if(ifname, "10.1.1.1", "255.255.255.0"); - else - netcfg_rump_if(ifname, "10.1.1.2", "255.255.255.0"); - - /* configure the carp interface */ - ifr.ifr_data = &cr; - RL(rump_sys_ioctl(s, SIOCGVH, &ifr)); - - strlcpy(cr.carpr_carpdev, ifname, sizeof(cr.carpr_carpdev)); - cr.carpr_vhid = 175; - if (master) - cr.carpr_advskew = 0; - else - cr.carpr_advskew = 200; - cr.carpr_advbase = 1; - strcpy((char *)cr.carpr_key, "s3cret"); - - RL(rump_sys_ioctl(s, SIOCSVH, &ifr)); - netcfg_rump_if(carpif, "10.1.1.100", "255.255.255.0"); - - /* tassa pause()en enka muuta voi */ - pause(); -} - -ATF_TC_BODY(handover, tc) -{ - char ifname[IFNAMSIZ]; - pid_t mpid, cpid; - int i, status; - - signal(SIGCHLD, sighnd); - - /* fork master */ - switch (mpid = fork()) { - case -1: - atf_tc_fail_errno("fork failed"); - /*NOTREACHED*/ - case 0: - child(true); - /*NOTREACHED*/ - default: - break; - } - - usleep(500000); - - /* fork backup */ - switch (cpid = fork()) { - case -1: - kill(mpid, SIGKILL); - atf_tc_fail_errno("fork failed"); - /*NOTREACHED*/ - case 0: - child(false); - /*NOTREACHED*/ - default: - break; - } - - usleep(500000); - - rump_init(); - netcfg_rump_makeshmif(THEBUS, ifname); - netcfg_rump_if(ifname, "10.1.1.240", "255.255.255.0"); - - /* check that the primary addresses are up */ - ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.1", 1000), true); - ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.2", 1000), true); - - /* give carp a while to croak */ - sleep(4); - - /* check that the shared IP works */ - ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.100", 500), true); - - /* KILLING SPREE */ - oknow = true; - kill(mpid, SIGKILL); - wait(&status); - usleep(10000); /* just in case */ - oknow = false; - - /* check that primary is now dead */ - ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.1", 100), false); - - /* do it in installments. carp will cluck meanwhile */ - for (i = 0; i < 5; i++) { - if (netcfg_rump_pingtest("10.1.1.100", 1000) == true) - break; - } - if (i == 5) - atf_tc_fail("failed to failover"); - - /* to kill the child */ - oknow = true; - kill(cpid, SIGKILL); - - /* clean & done */ -} - -ATF_TP_ADD_TCS(tp) -{ - - ATF_TP_ADD_TC(tp, handover); - - return atf_no_error(); -} diff --git a/contrib/netbsd-tests/net/carp/t_basic.sh b/contrib/netbsd-tests/net/carp/t_basic.sh new file mode 100755 index 0000000..94ada1c --- /dev/null +++ b/contrib/netbsd-tests/net/carp/t_basic.sh @@ -0,0 +1,165 @@ +# $NetBSD: t_basic.sh,v 1.1 2017/01/16 08:18:11 ozaki-r Exp $ +# +# Copyright (c) 2017 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. +# + +SOCK_CLIENT=unix://carp_client +SOCK_MASTER=unix://carp_master +SOCK_BACKUP=unix://carp_backup +BUS=bus_carp +IP_CLIENT=10.1.1.240 +IP_MASTER=10.1.1.1 +IP_BACKUP=10.1.1.2 +IP_CARP=10.1.1.100 +TIMEOUT=3 + +atf_test_case carp_handover cleanup + +carp_handover_head() +{ + + atf_set "descr" "Tests for CARP handover" + atf_set "require.progs" "rump_server" +} + +setup_carp() +{ + local sock=$1 + local master=$2 + local carpif= ip= advskew= + + if $master; then + carpif=carp0 + ip=$IP_MASTER + advskew=0 + else + carpif=carp1 + ip=$IP_BACKUP + advskew=200 + fi + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $carpif create + atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up + atf_check -s exit:0 rump.ifconfig $carpif \ + vhid 175 advskew $advskew advbase 1 pass s3cret \ + $IP_CARP netmask 255.255.255.0 + atf_check -s exit:0 rump.ifconfig -w 10 +} + +wait_handover() +{ + local i=0 + + export RUMP_SERVER=$SOCK_CLIENT + + while [ $i -ne 5 ]; do + $DEBUG && echo "Trying ping $IP_CARP" + rump.ping -n -w 1 -c 1 $IP_CARP >/dev/null + if [ $? = 0 ]; then + $DEBUG && echo "Passed ping $IP_CARP" + break; + fi + $DEBUG && echo "Failed ping $IP_CARP" + i=$((i + 1)) + done + + if [ $i -eq 5 ]; then + atf_fail "Failed to failover (5 sec)" + fi +} + +carp_handover_body() +{ + + rump_server_start $SOCK_CLIENT + rump_server_start $SOCK_MASTER + rump_server_start $SOCK_BACKUP + + rump_server_add_iface $SOCK_CLIENT shmif0 $BUS + rump_server_add_iface $SOCK_MASTER shmif0 $BUS + rump_server_add_iface $SOCK_BACKUP shmif0 $BUS + + setup_carp $SOCK_MASTER true + setup_carp $SOCK_BACKUP false + + export RUMP_SERVER=$SOCK_CLIENT + atf_check -s exit:0 rump.ifconfig shmif0 $IP_CLIENT/24 up + atf_check -s exit:0 rump.ifconfig -w 10 + + # Check that the primary addresses are up + atf_check -s exit:0 -o ignore \ + rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER + atf_check -s exit:0 -o ignore \ + rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP + + # Give carp a while to croak + sleep 4 + + # Check state + export RUMP_SERVER=$SOCK_MASTER + $DEBUG && rump.ifconfig + atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \ + rump.ifconfig carp0 + export RUMP_SERVER=$SOCK_BACKUP + $DEBUG && rump.ifconfig + atf_check -s exit:0 -o match:'carp: BACKUP carpdev shmif0' \ + rump.ifconfig carp1 + export RUMP_SERVER=$SOCK_CLIENT + + # Check that the shared IP works + atf_check -s exit:0 -o ignore \ + rump.ping -n -w $TIMEOUT -c 1 $IP_CARP + + # KILLING SPREE + env RUMP_SERVER=$SOCK_MASTER rump.halt + sleep 1 + + # Check that primary is now dead + atf_check -s not-exit:0 -o ignore \ + rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER + + # Do it in installments. carp will cluck meanwhile + wait_handover + + # Check state + export RUMP_SERVER=$SOCK_BACKUP + $DEBUG && rump.ifconfig + atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \ + rump.ifconfig carp1 +} + +carp_handover_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case carp_handover +} diff --git a/contrib/netbsd-tests/net/config/netconfig.c b/contrib/netbsd-tests/net/config/netconfig.c index c2f9dd4..6fe37cc 100644 --- a/contrib/netbsd-tests/net/config/netconfig.c +++ b/contrib/netbsd-tests/net/config/netconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $ */ +/* $NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $"); +__RCSID("$NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -53,7 +53,7 @@ __RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $"); #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" int noatf; diff --git a/contrib/netbsd-tests/net/icmp/t_forward.c b/contrib/netbsd-tests/net/icmp/t_forward.c index d418027..346614c 100644 --- a/contrib/netbsd-tests/net/icmp/t_forward.c +++ b/contrib/netbsd-tests/net/icmp/t_forward.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $ */ +/* $NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $"); +__RCSID("$NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -57,7 +57,7 @@ __RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $"); #include <string.h> #include <unistd.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" /* diff --git a/contrib/netbsd-tests/net/icmp/t_ping.c b/contrib/netbsd-tests/net/icmp/t_ping.c index 68a00c7..b3327e1 100644 --- a/contrib/netbsd-tests/net/icmp/t_ping.c +++ b/contrib/netbsd-tests/net/icmp/t_ping.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $ */ +/* $NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -52,7 +52,7 @@ __RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $"); #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" ATF_TC(simpleping); diff --git a/contrib/netbsd-tests/net/if/t_ifconfig.sh b/contrib/netbsd-tests/net/if/t_ifconfig.sh index a610017..21c877c 100755 --- a/contrib/netbsd-tests/net/if/t_ifconfig.sh +++ b/contrib/netbsd-tests/net/if/t_ifconfig.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ifconfig.sh,v 1.14 2016/10/01 22:15:04 kre Exp $ +# $NetBSD: t_ifconfig.sh,v 1.15 2017/01/20 08:35:33 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -181,7 +181,7 @@ ifconfig_options_body() # ifconfig -C # -C shows all of the interface cloners available on the system - atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C + atf_check -s exit:0 -o match:'shmif carp lo' rump.ifconfig -C unset RUMP_SERVER } diff --git a/contrib/netbsd-tests/net/if_loop/t_pr.c b/contrib/netbsd-tests/net/if_loop/t_pr.c index a22953f..ee4f684 100644 --- a/contrib/netbsd-tests/net/if_loop/t_pr.c +++ b/contrib/netbsd-tests/net/if_loop/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $ */ +/* $NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $"); +__RCSID("$NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $"); #include <unistd.h> #include "../config/netconfig.c" -#include "../../h_macros.h" +#include "h_macros.h" /* * Prepare rump, configure interface and route to cause fragmentation diff --git a/contrib/netbsd-tests/net/if_tun/t_tun.sh b/contrib/netbsd-tests/net/if_tun/t_tun.sh new file mode 100755 index 0000000..87df39a --- /dev/null +++ b/contrib/netbsd-tests/net/if_tun/t_tun.sh @@ -0,0 +1,138 @@ +# $NetBSD: t_tun.sh,v 1.4 2016/11/07 05:25:37 ozaki-r Exp $ +# +# Copyright (c) 2016 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. +# + +RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" +RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tun -lrumpdev" + +BUS=bus +SOCK_LOCAL=unix://commsock1 +SOCK_REMOTE=unix://commsock2 +IP_LOCAL=10.0.0.1 +IP_REMOTE=10.0.0.2 + +DEBUG=${DEBUG:-true} + +atf_test_case tun_create_destroy cleanup +tun_create_destroy_head() +{ + + atf_set "descr" "tests of creation and deletion of tun interface" + atf_set "require.progs" "rump_server" +} + +tun_create_destroy_body() +{ + + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 up + atf_check -s exit:0 rump.ifconfig tun0 down + atf_check -s exit:0 rump.ifconfig tun0 destroy +} + +tun_create_destroy_cleanup() +{ + + RUMP_SERVER=${SOCK_LOCAL} rump.halt +} + +atf_test_case tun_setup cleanup +tun_setup_head() +{ + + atf_set "descr" "tests of setting up a tunnel" + atf_set "require.progs" "rump_server" +} + +check_route_entry() +{ + local ip=$(echo $1 |sed 's/\./\\./g') + local gw=$2 + local flags=$3 + local iface=$4 + + atf_check -s exit:0 -o match:" $flags " -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" + atf_check -s exit:0 -o match:" $gw " -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" + atf_check -s exit:0 -o match:" $iface" -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" +} + +tun_setup_body() +{ + + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + atf_check -s exit:0 rump.ifconfig shmif0 ${IP_LOCAL}/24 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=${SOCK_REMOTE} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + atf_check -s exit:0 rump.ifconfig shmif0 ${IP_REMOTE}/24 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=${SOCK_LOCAL} + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 ${IP_LOCAL} ${IP_REMOTE} up + atf_check -s exit:0 \ + -o match:"inet ${IP_LOCAL}/32 -> ${IP_REMOTE}" rump.ifconfig tun0 + $DEBUG && rump.netstat -nr -f inet + check_route_entry ${IP_REMOTE} ${IP_LOCAL} UH tun0 + + export RUMP_SERVER=${SOCK_REMOTE} + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 ${IP_REMOTE} ${IP_LOCAL} up + atf_check -s exit:0 \ + -o match:"inet ${IP_REMOTE}/32 -> ${IP_LOCAL}" rump.ifconfig tun0 + $DEBUG && rump.netstat -nr -f inet + check_route_entry ${IP_LOCAL} ${IP_REMOTE} UH tun0 +} + +tun_setup_cleanup() +{ + + RUMP_SERVER=${SOCK_LOCAL} rump.halt + RUMP_SERVER=${SOCK_REMOTE} rump.halt +} + +atf_init_test_cases() +{ + + atf_add_test_case tun_create_destroy + atf_add_test_case tun_setup +} diff --git a/contrib/netbsd-tests/net/if_vlan/t_vlan.sh b/contrib/netbsd-tests/net/if_vlan/t_vlan.sh new file mode 100755 index 0000000..a6902fb1 --- /dev/null +++ b/contrib/netbsd-tests/net/if_vlan/t_vlan.sh @@ -0,0 +1,115 @@ +# $NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $ +# +# Copyright (c) 2016 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. +# + +BUS=bus +SOCK_LOCAL=unix://commsock1 +SOCK_REMOTE=unix://commsock2 +IP_LOCAL=10.0.0.1 +IP_REMOTE=10.0.0.2 + +DEBUG=${DEBUG:-false} + +atf_test_case vlan_create_destroy cleanup +vlan_create_destroy_head() +{ + + atf_set "descr" "tests of creation and deletion of vlan interface" + atf_set "require.progs" "rump_server" +} + +vlan_create_destroy_body() +{ + + rump_server_start $SOCK_LOCAL vlan + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig vlan0 down + atf_check -s exit:0 rump.ifconfig vlan0 destroy +} + +vlan_create_destroy_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_basic cleanup +vlan_basic_head() +{ + + atf_set "descr" "tests of communications over vlan interfaces" + atf_set "require.progs" "rump_server" +} + +vlan_basic_body() +{ + + rump_server_start $SOCK_LOCAL vlan + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_start $SOCK_REMOTE vlan + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig shmif0 up + export RUMP_SERVER=$SOCK_REMOTE + atf_check -s exit:0 rump.ifconfig shmif0 up + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24 + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK_REMOTE + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 $IP_REMOTE/24 + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE +} + +vlan_basic_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case vlan_create_destroy + atf_add_test_case vlan_basic +} diff --git a/contrib/netbsd-tests/net/ndp/t_ra.sh b/contrib/netbsd-tests/net/ndp/t_ra.sh index b234570..69f227a 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 } diff --git a/contrib/netbsd-tests/net/net/t_raw.c b/contrib/netbsd-tests/net/net/t_raw.c index ef3262d..5c483a1 100644 --- a/contrib/netbsd-tests/net/net/t_raw.c +++ b/contrib/netbsd-tests/net/net/t_raw.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_raw.c,v 1.1 2011/01/11 10:51:45 pooka Exp $ */ +/* $NetBSD: t_raw.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ #include <sys/socket.h> #include <sys/stat.h> @@ -12,7 +12,7 @@ #include <atf-c.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(PRU_SENSE); ATF_TC_HEAD(PRU_SENSE, tc) |