Module Name: src
Committed By: martin
Date: Sat Aug 24 16:42:26 UTC 2024
Modified Files:
src/distrib/sets/lists/tests [netbsd-10]: mi
src/etc/mtree [netbsd-10]: NetBSD.dist.tests
src/sbin/ifconfig [netbsd-10]: ifconfig.8 ifconfig.c
src/sys/rump/net/lib/libshmif [netbsd-10]: if_shmem.c
src/tests/net [netbsd-10]: Makefile
Added Files:
src/tests/net/if_shmif [netbsd-10]: Makefile t_shmif.sh
Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #811):
tests/net/if_shmif/t_shmif.sh: revision 1.1
sbin/ifconfig/ifconfig.c: revision 1.251
sbin/ifconfig/ifconfig.8: revision 1.130
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.85
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.86
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.87
etc/mtree/NetBSD.dist.tests: revision 1.206
distrib/sets/lists/tests/mi: revision 1.1333
tests/net/if_shmif/Makefile: revision 1.1
tests/net/Makefile: revision 1.42
shmif: change behaviors about link states
- Change the link state to UP on ifconfig linkstr
- This behavior emulates physical devices
- Change the link state to UNKNOWN on ifconfig -linkstr just in case
- Reject sending/receiving packets if the link state is DOWN
- Permit to send/receive packets on UNKNOWN, which is required
to unbreak some ATF tests written in C
shmif: support media
It enables to link-down shmif by ifconfig media none and link-up
again by media auto.
ifconfig: show link state on -v
We could guess it through "media" or "status" output, however, we
sometimes want to know it directly for debugging or testing.
It is shown only if the -v option is specified.
tests: add tests for shmif
The test file is placed under tests/net, not tests/rump/rumpnet,
to leverage utility functions provided for tests in there.
shmem(4): Fix typo in comment: AFT -> ATF.
Also fix grammar (if I understood correctly what this meant: rump
servers written in C, rather than set up via shell scripts around
rump_server invoking ifconfig).
No functional change intended.
To generate a diff of this commit:
cvs rdiff -u -r1.1238.2.8 -r1.1238.2.9 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.197.2.2 -r1.197.2.3 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.249 -r1.249.2.1 src/sbin/ifconfig/ifconfig.c
cvs rdiff -u -r1.84 -r1.84.4.1 src/sys/rump/net/lib/libshmif/if_shmem.c
cvs rdiff -u -r1.41 -r1.41.2.1 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/tests/net/if_shmif/Makefile \
src/tests/net/if_shmif/t_shmif.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1238.2.8 src/distrib/sets/lists/tests/mi:1.1238.2.9
--- src/distrib/sets/lists/tests/mi:1.1238.2.8 Fri Aug 23 18:28:09 2024
+++ src/distrib/sets/lists/tests/mi Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1238.2.8 2024/08/23 18:28:09 martin Exp $
+# $NetBSD: mi,v 1.1238.2.9 2024/08/24 16:42:26 martin Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4282,6 +4282,10 @@
./usr/tests/net/if_pppoe/Kyuafile tests-net-tests atf,rump,kyua
./usr/tests/net/if_pppoe/t_pppoe tests-net-tests atf,rump
./usr/tests/net/if_pppoe/t_pppoe_unnumbered tests-net-tests atf,rump
+./usr/tests/net/if_shmif tests-net-tests compattestfile,atf
+./usr/tests/net/if_shmif/Atffile tests-net-tests atf,rump
+./usr/tests/net/if_shmif/Kyuafile tests-net-tests atf,rump,kyua
+./usr/tests/net/if_shmif/t_shmif tests-net-tests atf,rump
./usr/tests/net/if_tap tests-net-tests compattestfile,atf
./usr/tests/net/if_tap/Atffile tests-net-tests atf,rump
./usr/tests/net/if_tap/Kyuafile tests-net-tests atf,rump,kyua
Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.197.2.2 src/etc/mtree/NetBSD.dist.tests:1.197.2.3
--- src/etc/mtree/NetBSD.dist.tests:1.197.2.2 Fri Aug 23 18:28:09 2024
+++ src/etc/mtree/NetBSD.dist.tests Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.dist.tests,v 1.197.2.2 2024/08/23 18:28:09 martin Exp $
+# $NetBSD: NetBSD.dist.tests,v 1.197.2.3 2024/08/24 16:42:26 martin Exp $
./usr/libdata/debug/usr/tests
./usr/libdata/debug/usr/tests/atf
@@ -376,6 +376,7 @@
./usr/tests/net/if_lagg
./usr/tests/net/if_loop
./usr/tests/net/if_pppoe
+./usr/tests/net/if_shmif
./usr/tests/net/if_tap
./usr/tests/net/if_tun
./usr/tests/net/if_vether
Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.124.2.1 src/sbin/ifconfig/ifconfig.8:1.124.2.2
--- src/sbin/ifconfig/ifconfig.8:1.124.2.1 Thu Apr 18 16:26:47 2024
+++ src/sbin/ifconfig/ifconfig.8 Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: ifconfig.8,v 1.124.2.1 2024/04/18 16:26:47 martin Exp $
+.\" $NetBSD: ifconfig.8,v 1.124.2.2 2024/08/24 16:42:26 martin Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd April 8, 2024
+.Dd August 20, 2024
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -870,8 +870,8 @@ mutually exclusive with all other flags
.Pp
The
.Fl v
-flag prints statistics on packets sent and received on the given
-interface.
+flag prints additional information like statistics on packets sent and received
+on the interface and the link state of the interface.
If
.Fl h
is used in conjunction with
Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.249 src/sbin/ifconfig/ifconfig.c:1.249.2.1
--- src/sbin/ifconfig/ifconfig.c:1.249 Fri Nov 25 08:41:05 2022
+++ src/sbin/ifconfig/ifconfig.c Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ifconfig.c,v 1.249 2022/11/25 08:41:05 knakahara Exp $ */
+/* $NetBSD: ifconfig.c,v 1.249.2.1 2024/08/24 16:42:26 martin Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1983, 1993\
The Regents of the University of California. All rights reserved.");
-__RCSID("$NetBSD: ifconfig.c,v 1.249 2022/11/25 08:41:05 knakahara Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.249.2.1 2024/08/24 16:42:26 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -111,6 +111,8 @@ static long wflag_secs, Wflag_secs;
static char gflags[10 + 26 * 2 + 1] = "AabCdhlNsuvW:w:z";
bool gflagset[10 + 26 * 2];
+static int link_state(prop_dictionary_t);
+static const char *link_state_str(int);
static int carrier(prop_dictionary_t);
static int clone_command(prop_dictionary_t, prop_dictionary_t);
static void do_setifpreference(prop_dictionary_t);
@@ -884,7 +886,7 @@ printall(const char *ifname, prop_dictio
if (uflag && (ifa->ifa_flags & IFF_UP) == 0)
continue;
- if (sflag && carrier(env) == LINK_STATE_DOWN)
+ if (sflag && link_state(env) == LINK_STATE_DOWN)
continue;
idx++;
/*
@@ -1199,17 +1201,43 @@ setifmtu(prop_dictionary_t env, prop_dic
}
static int
-carrier(prop_dictionary_t env)
+link_state(prop_dictionary_t env)
{
struct ifdatareq ifdr = { .ifdr_data.ifi_link_state = 0 };
if (direct_ioctl(env, SIOCGIFDATA, &ifdr) == -1)
- return EXIT_FAILURE;
+ return -1;
+
+ return ifdr.ifdr_data.ifi_link_state;
+}
+
+static const char *
+link_state_str(int state)
+{
- if (ifdr.ifdr_data.ifi_link_state == LINK_STATE_DOWN)
+ switch (state) {
+ case LINK_STATE_UNKNOWN:
+ return "unknown";
+ case LINK_STATE_DOWN:
+ return "down";
+ case LINK_STATE_UP:
+ return "up";
+ default: /* Assume -1 */
+ return "error";
+ }
+}
+
+static int
+carrier(prop_dictionary_t env)
+{
+ switch (link_state(env)) {
+ case -1:
+ case LINK_STATE_DOWN:
return EXIT_FAILURE;
- else /* Assume UP if UNKNOWN */
+ default:
+ /* Assume UP if UNKNOWN */
return EXIT_SUCCESS;
+ }
}
static void
@@ -1333,6 +1361,9 @@ status(prop_dictionary_t env, prop_dicti
free(p);
}
+ if (vflag)
+ printf("\tlinkstate: %s\n", link_state_str(link_state(env)));
+
media_status(env, oenv);
if (!vflag && !zflag)
Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.84 src/sys/rump/net/lib/libshmif/if_shmem.c:1.84.4.1
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.84 Sat Apr 9 23:45:02 2022
+++ src/sys/rump/net/lib/libshmif/if_shmem.c Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.84 2022/04/09 23:45:02 riastradh Exp $ */
+/* $NetBSD: if_shmem.c,v 1.84.4.1 2024/08/24 16:42:26 martin Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.84 2022/04/09 23:45:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.84.4.1 2024/08/24 16:42:26 martin Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_ether.h>
+#include <net/if_media.h>
#include <net/ether_sw_offload.h>
#include <netinet/in.h>
@@ -59,6 +60,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v
static int shmif_clone(struct if_clone *, int);
static int shmif_unclone(struct ifnet *);
+static int shmif_mediachange(struct ifnet *);
+static void shmif_mediastatus(struct ifnet *, struct ifmediareq *);
+
struct if_clone shmif_cloner =
IF_CLONE_INITIALIZER("shmif", shmif_clone, shmif_unclone);
@@ -84,6 +88,7 @@ static void shmif_stop(struct ifnet *, i
struct shmif_sc {
struct ethercom sc_ec;
+ struct ifmedia sc_im;
struct shmif_mem *sc_busmem;
int sc_memfd;
int sc_kq;
@@ -176,6 +181,11 @@ allocif(int unit, struct shmif_sc **scp)
ifp = &sc->sc_ec.ec_if;
+ ifmedia_init(&sc->sc_im, 0, shmif_mediachange, shmif_mediastatus);
+ ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_AUTO, 0, NULL);
+ ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_NONE, 0, NULL);
+ ifmedia_set(&sc->sc_im, IFM_ETHER|IFM_AUTO);
+
snprintf(ifp->if_xname, sizeof(ifp->if_xname), "shmif%d", unit);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -446,6 +456,28 @@ shmif_init(struct ifnet *ifp)
}
static int
+shmif_mediachange(struct ifnet *ifp)
+{
+ struct shmif_sc *sc = ifp->if_softc;
+
+ if (IFM_SUBTYPE(sc->sc_im.ifm_cur->ifm_media) == IFM_NONE &&
+ ifp->if_link_state != LINK_STATE_DOWN) {
+ if_link_state_change(ifp, LINK_STATE_DOWN);
+ } else if (IFM_SUBTYPE(sc->sc_im.ifm_cur->ifm_media) == IFM_AUTO &&
+ ifp->if_link_state != LINK_STATE_UP) {
+ if_link_state_change(ifp, LINK_STATE_UP);
+ }
+ return 0;
+}
+
+static void
+shmif_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
+{
+ struct shmif_sc *sc = ifp->if_softc;
+ imr->ifm_active = sc->sc_im.ifm_cur->ifm_media;
+}
+
+static int
shmif_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct shmif_sc *sc = ifp->if_softc;
@@ -486,6 +518,8 @@ shmif_ioctl(struct ifnet *ifp, u_long cm
ifd = data;
if (ifd->ifd_cmd == IFLINKSTR_UNSET) {
finibackend(sc);
+ /* Back to the default just in case */
+ ifp->if_link_state = LINK_STATE_UNKNOWN;
rv = 0;
break;
} else if (ifd->ifd_cmd != 0) {
@@ -525,7 +559,17 @@ shmif_ioctl(struct ifnet *ifp, u_long cm
sc->sc_backfile = path;
sc->sc_backfilelen = ifd->ifd_len;
+ if_link_state_change(ifp, LINK_STATE_UP);
+ break;
+
+#ifdef OSIOCSIFMEDIA
+ case OSIOCSIFMEDIA:
+#endif
+ case SIOCSIFMEDIA:
+ case SIOCGIFMEDIA:
+ rv = ifmedia_ioctl(ifp, data, &sc->sc_im, cmd);
break;
+
default:
rv = ether_ioctl(ifp, cmd, data);
if (rv == ENETRESET)
@@ -601,6 +645,14 @@ shmif_snd(struct ifnet *ifp, struct mbuf
bpf_mtap(ifp, m0, BPF_D_OUT);
+ /*
+ * Compare with DOWN to allow UNKNOWN (the default value),
+ * which is required by some ATF tests using rump servers
+ * written in C.
+ */
+ if (ifp->if_link_state == LINK_STATE_DOWN)
+ goto dontsend;
+
shmif_lockbus(busmem);
KASSERT(busmem->shm_magic == SHMIF_MAGIC);
busmem->shm_last = shmif_nextpktoff(busmem, busmem->shm_last);
@@ -621,6 +673,7 @@ shmif_snd(struct ifnet *ifp, struct mbuf
}
shmif_unlockbus(busmem);
+dontsend:
m_freem(m0);
if_statinc(ifp, if_opackets);
@@ -790,7 +843,14 @@ shmif_rcv(void *arg)
* Test if we want to pass the packet upwards
*/
eth = mtod(m, struct ether_header *);
- if (sp.sp_sender == sc->sc_uid) {
+ /*
+ * Compare with DOWN to allow UNKNOWN (the default value),
+ * which is required by some ATF tests using rump servers
+ * written in C.
+ */
+ if (ifp->if_link_state == LINK_STATE_DOWN) {
+ passup = false;
+ } else if (sp.sp_sender == sc->sc_uid) {
passup = false;
} else if (memcmp(eth->ether_dhost, CLLADDR(ifp->if_sadl),
ETHER_ADDR_LEN) == 0) {
Index: src/tests/net/Makefile
diff -u src/tests/net/Makefile:1.41 src/tests/net/Makefile:1.41.2.1
--- src/tests/net/Makefile:1.41 Thu Nov 17 08:45:35 2022
+++ src/tests/net/Makefile Sat Aug 24 16:42:26 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.41 2022/11/17 08:45:35 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.41.2.1 2024/08/24 16:42:26 martin Exp $
.include <bsd.own.mk>
@@ -7,7 +7,7 @@ TESTSDIR= ${TESTSBASE}/net
TESTS_SUBDIRS= fdpass in_cksum net sys
.if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
TESTS_SUBDIRS+= altq arp bpf bpfilter can carp icmp if if_bridge if_gif
-TESTS_SUBDIRS+= if_ipsec if_l2tp if_lagg if_loop if_pppoe if_tap
+TESTS_SUBDIRS+= if_ipsec if_l2tp if_lagg if_loop if_pppoe if_shmif if_tap
TESTS_SUBDIRS+= if_tun if_vether if_vlan if_wg inpcb ipsec mcast mpls
TESTS_SUBDIRS+= ndp npf route tcp
.if (${MKSLJIT} != "no")
Added files:
Index: src/tests/net/if_shmif/Makefile
diff -u /dev/null src/tests/net/if_shmif/Makefile:1.1.2.2
--- /dev/null Sat Aug 24 16:42:27 2024
+++ src/tests/net/if_shmif/Makefile Sat Aug 24 16:42:25 2024
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1.2.2 2024/08/24 16:42:25 martin Exp $
+#
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/net/if_shmif
+
+.for name in shmif
+TESTS_SH+= t_${name}
+TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh
+.endfor
+
+.include <bsd.test.mk>
Index: src/tests/net/if_shmif/t_shmif.sh
diff -u /dev/null src/tests/net/if_shmif/t_shmif.sh:1.1.2.2
--- /dev/null Sat Aug 24 16:42:27 2024
+++ src/tests/net/if_shmif/t_shmif.sh Sat Aug 24 16:42:25 2024
@@ -0,0 +1,138 @@
+# $NetBSD: t_shmif.sh,v 1.1.2.2 2024/08/24 16:42:25 martin Exp $
+#
+# Copyright (c) 2024 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_SERVER1=unix://./r1
+RUMP_SERVER2=unix://./r2
+
+TIMEOUT=3
+
+atf_test_case shmif_linkstate cleanup
+shmif_linkstate_head()
+{
+ atf_set "descr" "tests of ifconfig media on shmif"
+ atf_set "require.progs" "rump_server"
+}
+
+shmif_linkstate_body()
+{
+ local auto="Ethernet autoselect"
+ local none="Ethernet none"
+
+ rump_server_start $RUMP_SERVER1
+ rump_server_add_iface $RUMP_SERVER1 shmif0 bus1
+
+ export RUMP_SERVER=$RUMP_SERVER1
+ # After ifconfig linkstr, the state becomes UP
+ atf_check -o match:'linkstate: up' \
+ -o match:"media: $auto" \
+ -o not-match:"<UP" rump.ifconfig -v shmif0
+ atf_check rump.ifconfig shmif0 up
+ atf_check -o match:'linkstate: up' \
+ -o match:"media: $auto" \
+ -o match:"<UP" rump.ifconfig -v shmif0
+ # ifconfig media none makes the state DOWN
+ atf_check rump.ifconfig shmif0 media none
+ atf_check -o match:'linkstate: down' \
+ -o match:"media: $none" \
+ -o match:"<UP" rump.ifconfig -v shmif0
+ # ifconfig media auto makes the state UP
+ atf_check rump.ifconfig shmif0 media auto
+ atf_check -o match:'linkstate: up' \
+ -o match:"media: $auto" \
+ -o match:"<UP" rump.ifconfig -v shmif0
+ atf_check rump.ifconfig shmif0 down
+ atf_check -o match:'linkstate: up' \
+ -o match:"media: $auto" \
+ -o not-match:"<UP" rump.ifconfig -v shmif0
+ # After ifconfig -linkstr, the state becomes UNKNOWN
+ atf_check rump.ifconfig shmif0 -linkstr
+ atf_check -o match:'linkstate: unknown' \
+ -o match:"media: $auto" \
+ -o not-match:"<UP" rump.ifconfig -v shmif0
+
+ rump_server_destroy_ifaces
+}
+
+shmif_linkstate_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case shmif_linkstate_down cleanup
+shmif_linkstate_down_head()
+{
+ atf_set "descr" "tests of behaviors of down shmif"
+ atf_set "require.progs" "rump_server"
+}
+
+shmif_linkstate_down_body()
+{
+
+ rump_server_start $RUMP_SERVER1
+ rump_server_start $RUMP_SERVER2
+ rump_server_add_iface $RUMP_SERVER1 shmif0 bus1
+ rump_server_add_iface $RUMP_SERVER2 shmif0 bus1
+
+ export RUMP_SERVER=$RUMP_SERVER1
+ atf_check rump.sysctl -q -w net.inet.ip.dad_count=0
+ atf_check rump.ifconfig shmif0 10.0.0.1/24 up
+ export RUMP_SERVER=$RUMP_SERVER2
+ atf_check rump.sysctl -q -w net.inet.ip.dad_count=0
+ atf_check rump.ifconfig shmif0 10.0.0.2/24 up
+
+ export RUMP_SERVER=$RUMP_SERVER1
+ atf_check -o ignore rump.ping -c 1 -w $TIMEOUT 10.0.0.2
+
+ atf_check rump.ifconfig shmif0 media none
+ atf_check -o match:'linkstate: down' rump.ifconfig -v shmif0
+
+ # shmif doesn't send any packets on link down
+ atf_check -s not-exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT 10.0.0.2
+
+ atf_check rump.ifconfig shmif0 media auto
+ atf_check -o match:'linkstate: up' rump.ifconfig -v shmif0
+
+ atf_check -o ignore rump.ping -c 1 -w $TIMEOUT 10.0.0.2
+
+ rump_server_destroy_ifaces
+}
+
+shmif_linkstate_down_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case shmif_linkstate
+ atf_add_test_case shmif_linkstate_down
+}