2 * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * -------------------------------------------------------------------------
29 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
30 * Nottingham University 1987.
34 * $FreeBSD: src/sys/net/if_tap.c,v 1.3.2.3 2002/04/14 21:41:48 luigi Exp $
35 * $DragonFly: src/sys/net/tap/if_tap.c,v 1.41 2008/09/05 17:03:15 dillon Exp $
36 * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $
41 #include <sys/param.h>
43 #include <sys/device.h>
44 #include <sys/filedesc.h>
45 #include <sys/filio.h>
46 #include <sys/kernel.h>
47 #include <sys/malloc.h>
52 #include <sys/signalvar.h>
53 #include <sys/socket.h>
54 #include <sys/sockio.h>
55 #include <sys/sysctl.h>
56 #include <sys/systm.h>
57 #include <sys/thread2.h>
58 #include <sys/ttycom.h>
60 #include <sys/vnode.h>
61 #include <sys/serialize.h>
64 #include <net/ethernet.h>
66 #include <net/ifq_var.h>
67 #include <net/if_arp.h>
68 #include <net/if_clone.h>
69 #include <net/route.h>
71 #include <netinet/in.h>
73 #include "if_tapvar.h"
77 #define CDEV_NAME "tap"
78 #define CDEV_MAJOR 149
79 #define TAPDEBUG if (tapdebug) if_printf
83 #define VMNET_DEV_MASK 0x00010000
86 static int tapmodevent (module_t, int, void *);
89 static void tapcreate (cdev_t);
90 static void tapdestroy(struct tap_softc *);
93 static int tap_clone_create(struct if_clone *, int);
94 static void tap_clone_destroy(struct ifnet *);
97 /* network interface */
98 static void tapifstart (struct ifnet *);
99 static int tapifioctl (struct ifnet *, u_long, caddr_t,
101 static void tapifinit (void *);
102 static void tapifstop(struct tap_softc *, int);
103 static void tapifflags(struct tap_softc *);
105 /* character device */
106 static d_open_t tapopen;
107 static d_close_t tapclose;
108 static d_read_t tapread;
109 static d_write_t tapwrite;
110 static d_ioctl_t tapioctl;
111 static d_poll_t tappoll;
112 static d_kqfilter_t tapkqfilter;
114 static struct dev_ops tap_ops = {
115 { CDEV_NAME, CDEV_MAJOR, 0 },
122 .d_kqfilter = tapkqfilter
125 static int taprefcnt = 0; /* module ref. counter */
126 static int taplastunit = -1; /* max. open unit number */
127 static int tapdebug = 0; /* debug flag */
128 static int tapuopen = 0; /* all user open() */
129 static int tapuponopen = 0; /* IFF_UP */
131 MALLOC_DECLARE(M_TAP);
132 MALLOC_DEFINE(M_TAP, CDEV_NAME, "Ethernet tunnel interface");
133 struct if_clone tap_cloner = IF_CLONE_INITIALIZER("tap",
134 tap_clone_create, tap_clone_destroy,
136 static SLIST_HEAD(,tap_softc) tap_listhead =
137 SLIST_HEAD_INITIALIZER(&tap_listhead);
139 SYSCTL_INT(_debug, OID_AUTO, if_tap_debug, CTLFLAG_RW, &tapdebug, 0, "");
140 SYSCTL_DECL(_net_link);
141 SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0,
142 "Ethernet tunnel software network interface");
143 SYSCTL_INT(_net_link_tap, OID_AUTO, user_open, CTLFLAG_RW, &tapuopen, 0,
144 "Allow user to open /dev/tap (based on node permissions)");
145 SYSCTL_INT(_net_link_tap, OID_AUTO, up_on_open, CTLFLAG_RW, &tapuponopen, 0,
146 "Bring interface up when /dev/tap is opened");
147 SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tapdebug, 0, "");
149 DEV_MODULE(if_tap, tapmodevent, NULL);
154 * module event handler
157 tapmodevent(module_t mod, int type, void *data)
159 static int attached = 0;
160 struct tap_softc *tp, *ntp;
167 dev_ops_add(&tap_ops, 0, 0);
168 SLIST_INIT(&tap_listhead);
169 if_clone_attach(&tap_cloner);
178 if_clone_detach(&tap_cloner);
179 dev_ops_remove(&tap_ops, 0, 0);
181 /* Maintain tap ifs in a local list */
182 SLIST_FOREACH_MUTABLE(tp, &tap_listhead, tap_link, ntp)
199 * to create interface
202 tapcreate(cdev_t dev)
204 struct ifnet *ifp = NULL;
205 struct tap_softc *tp = NULL;
206 uint8_t ether_addr[ETHER_ADDR_LEN];
210 /* allocate driver storage and create device */
211 MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
213 /* select device: tap or vmnet */
214 if (minor(dev) & VMNET_DEV_MASK) {
216 unit = lminor(dev) & 0xff;
217 tp->tap_flags |= TAP_VMNET;
224 tp->tap_dev = make_dev(&tap_ops, minor(dev), UID_ROOT, GID_WHEEL,
225 0600, "%s%d", name, unit);
226 tp->tap_dev->si_drv1 = dev->si_drv1 = tp;
227 reference_dev(tp->tap_dev); /* so we can destroy it later */
229 /* generate fake MAC address: 00 bd xx xx xx unit_no */
230 ether_addr[0] = 0x00;
231 ether_addr[1] = 0xbd;
232 bcopy(&ticks, ðer_addr[2], 3);
233 ether_addr[5] = (u_char)unit;
235 /* fill the rest and attach interface */
239 if_initname(ifp, name, unit);
240 if (unit > taplastunit)
243 ifp->if_init = tapifinit;
244 ifp->if_start = tapifstart;
245 ifp->if_ioctl = tapifioctl;
246 ifp->if_mtu = ETHERMTU;
247 ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
248 ifq_set_maxlen(&ifp->if_snd, ifqmaxlen);
249 ifq_set_ready(&ifp->if_snd);
251 ether_ifattach(ifp, ether_addr, NULL);
253 tp->tap_flags |= TAP_INITED;
254 tp->tap_devq.ifq_maxlen = ifqmaxlen;
256 SLIST_INSERT_HEAD(&tap_listhead, tp, tap_link);
258 TAPDEBUG(ifp, "created. minor = %#x\n", minor(tp->tap_dev));
264 * Create a new tap instance.
267 tap_clone_create(struct if_clone *ifc __unused, int unit)
269 struct tap_softc *tp = NULL;
272 dev = get_dev(CDEV_MAJOR, unit);
276 tp->tap_flags |= TAP_CLONE;
277 TAPDEBUG(&tp->tap_if, "clone created. minor = %#x tap_flags = 0x%x\n",
278 minor(tp->tap_dev), tp->tap_flags);
286 * to open tunnel. must be superuser
289 tapopen(struct dev_open_args *ap)
292 struct tap_softc *tp = NULL;
293 struct ifnet *ifp = NULL;
297 (error = priv_check_cred(ap->a_cred, PRIV_ROOT, 0)) != 0)
301 dev = ap->a_head.a_dev;
306 ifp = &tp->arpcom.ac_if;
308 if (tp->tap_flags & TAP_OPEN) {
312 ifp = &tp->arpcom.ac_if;
314 if ((tp->tap_flags & TAP_CLONE) == 0) {
315 EVENTHANDLER_INVOKE(ifnet_attach_event, ifp);
317 /* Announce the return of the interface. */
318 rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
322 bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr));
324 if (curthread->td_proc)
325 fsetown(curthread->td_proc->p_pid, &tp->tap_sigtd);
326 tp->tap_flags |= TAP_OPEN;
329 if (tapuponopen && (ifp->if_flags & IFF_UP) == 0) {
334 ifnet_serialize_all(ifp);
336 ifnet_deserialize_all(ifp);
339 TAPDEBUG(ifp, "opened. minor = %#x, refcnt = %d, taplastunit = %d\n",
340 minor(tp->tap_dev), taprefcnt, taplastunit);
350 * close the device - mark i/f down & delete routing info
353 tapclose(struct dev_close_args *ap)
355 cdev_t dev = ap->a_head.a_dev;
356 struct tap_softc *tp = dev->si_drv1;
357 struct ifnet *ifp = &tp->tap_if;
360 /* junk all pending output */
363 ifq_purge(&ifp->if_snd);
366 * do not bring the interface down, and do not anything with
367 * interface, if we are in VMnet mode. just close the device.
370 if ((tp->tap_flags & TAP_VMNET) == 0) {
371 if (ifp->if_flags & IFF_UP)
375 ifnet_serialize_all(ifp);
376 tapifstop(tp, clear_flags);
377 ifnet_deserialize_all(ifp);
379 if ((tp->tap_flags & TAP_CLONE) == 0) {
380 if_purgeaddrs_nolink(ifp);
382 EVENTHANDLER_INVOKE(ifnet_detach_event, ifp);
384 /* Announce the departure of the interface. */
385 rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
388 funsetown(tp->tap_sigio);
389 tp->tap_sigio = NULL;
390 selwakeup(&tp->tap_rsel);
392 tp->tap_flags &= ~TAP_OPEN;
393 funsetown(tp->tap_sigtd);
394 tp->tap_sigtd = NULL;
399 if_printf(ifp, "minor = %#x, refcnt = %d is out of sync. "
400 "set refcnt to 0\n", minor(tp->tap_dev), taprefcnt);
403 TAPDEBUG(ifp, "closed. minor = %#x, refcnt = %d, taplastunit = %d\n",
404 minor(tp->tap_dev), taprefcnt, taplastunit);
407 if ((tp->tap_flags & TAP_CLONE) == 0)
418 * Destroy a tap instance.
421 tapdestroy(struct tap_softc *tp)
423 struct ifnet *ifp = &tp->arpcom.ac_if;
425 TAPDEBUG(ifp, "destroyed. minor = %#x, refcnt = %d, taplastunit = %d\n",
426 minor(tp->tap_dev), taprefcnt, taplastunit);
428 ifnet_serialize_all(ifp);
430 ifnet_deserialize_all(ifp);
433 SLIST_REMOVE(&tap_listhead, tp, tap_softc, tap_link);
435 destroy_dev(tp->tap_dev);
444 * Destroy a tap instance.
447 tap_clone_destroy(struct ifnet *ifp)
449 struct tap_softc *tp = ifp->if_softc;
451 TAPDEBUG(&tp->tap_if, "clone destroyed. minor = %#x tap_flags = 0x%x\n",
452 minor(tp->tap_dev), tp->tap_flags);
453 if (tp->tap_flags & TAP_CLONE)
460 * Network interface initialization function (called with if serializer held)
467 struct tap_softc *tp = xtp;
468 struct ifnet *ifp = &tp->tap_if;
470 TAPDEBUG(ifp, "initializing, minor = %#x tap_flags = 0x%x\n",
471 minor(tp->tap_dev), tp->tap_flags);
473 ASSERT_IFNET_SERIALIZED_ALL(ifp);
477 ifp->if_flags |= IFF_RUNNING;
478 ifp->if_flags &= ~IFF_OACTIVE;
480 /* attempt to start output */
488 * Process an ioctl request on network interface (called with if serializer
494 tapifioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr)
496 struct tap_softc *tp = (struct tap_softc *)(ifp->if_softc);
497 struct ifstat *ifs = NULL;
504 dummy = ether_ioctl(ifp, cmd, data);
511 case SIOCADDMULTI: /* XXX -- just like vmnet does */
516 ifs = (struct ifstat *)data;
517 dummy = strlen(ifs->ascii);
518 if ((tp->tap_flags & TAP_OPEN) &&
519 dummy < sizeof(ifs->ascii)) {
520 if (tp->tap_sigtd && tp->tap_sigtd->sio_proc) {
521 ksnprintf(ifs->ascii + dummy,
522 sizeof(ifs->ascii) - dummy,
523 "\tOpened by pid %d\n",
524 (int)tp->tap_sigtd->sio_proc->p_pid);
526 ksnprintf(ifs->ascii + dummy,
527 sizeof(ifs->ascii) - dummy,
528 "\tOpened by <unknown>\n");
544 * Queue packets from higher level ready to put out (called with if serializer
550 tapifstart(struct ifnet *ifp)
552 struct tap_softc *tp = ifp->if_softc;
557 TAPDEBUG(ifp, "starting, minor = %#x\n", minor(tp->tap_dev));
560 * do not junk pending output if we are in VMnet mode.
561 * XXX: can this do any harm because of queue overflow?
564 if (((tp->tap_flags & TAP_VMNET) == 0) &&
565 ((tp->tap_flags & TAP_READY) != TAP_READY)) {
566 TAPDEBUG(ifp, "not ready. minor = %#x, tap_flags = 0x%x\n",
567 minor(tp->tap_dev), tp->tap_flags);
568 ifq_purge(&ifp->if_snd);
572 ifp->if_flags |= IFF_OACTIVE;
575 while ((m = ifq_dequeue(&ifp->if_snd, NULL)) != NULL) {
588 if (tp->tap_flags & TAP_RWAIT) {
589 tp->tap_flags &= ~TAP_RWAIT;
594 KNOTE(&tp->tap_rsel.si_note, 0);
597 if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) {
599 pgsigio(tp->tap_sigio, SIGIO, 0);
604 * selwakeup is not MPSAFE. tapifstart is.
607 selwakeup(&tp->tap_rsel);
611 ifp->if_flags &= ~IFF_OACTIVE;
618 * The ops interface is now pretty minimal. Called via fileops with nothing
624 tapioctl(struct dev_ioctl_args *ap)
626 cdev_t dev = ap->a_head.a_dev;
627 caddr_t data = ap->a_data;
628 struct tap_softc *tp = dev->si_drv1;
629 struct ifnet *ifp = &tp->tap_if;
630 struct tapinfo *tapp = NULL;
635 ifnet_serialize_all(ifp);
640 tapp = (struct tapinfo *)data;
641 ifp->if_mtu = tapp->mtu;
642 ifp->if_type = tapp->type;
643 ifp->if_baudrate = tapp->baudrate;
647 tapp = (struct tapinfo *)data;
648 tapp->mtu = ifp->if_mtu;
649 tapp->type = ifp->if_type;
650 tapp->baudrate = ifp->if_baudrate;
654 tapdebug = *(int *)data;
658 *(int *)data = tapdebug;
663 tp->tap_flags |= TAP_ASYNC;
665 tp->tap_flags &= ~TAP_ASYNC;
671 /* Take a look at devq first */
672 IF_POLL(&tp->tap_devq, mb);
674 mb = ifq_poll(&ifp->if_snd);
677 for(; mb != NULL; mb = mb->m_next)
678 *(int *)data += mb->m_len;
683 error = fsetown(*(int *)data, &tp->tap_sigio);
687 *(int *)data = fgetown(tp->tap_sigio);
690 /* this is deprecated, FIOSETOWN should be used instead */
692 error = fsetown(-(*(int *)data), &tp->tap_sigio);
695 /* this is deprecated, FIOGETOWN should be used instead */
697 *(int *)data = -fgetown(tp->tap_sigio);
700 /* VMware/VMnet port ioctl's */
702 case SIOCGIFFLAGS: /* get ifnet flags */
703 bcopy(&ifp->if_flags, data, sizeof(ifp->if_flags));
706 case VMIO_SIOCSIFFLAGS: /* VMware/VMnet SIOCSIFFLAGS */
709 f &= ~IFF_CANTCHANGE;
711 ifp->if_flags = f | (ifp->if_flags & IFF_CANTCHANGE);
714 case OSIOCGIFADDR: /* get MAC address of the remote side */
716 bcopy(tp->ether_addr, data, sizeof(tp->ether_addr));
719 case SIOCSIFADDR: /* set MAC address of the remote side */
720 bcopy(data, tp->ether_addr, sizeof(tp->ether_addr));
727 ifnet_deserialize_all(ifp);
735 * The ops read interface - reads a packet at a time, or at
736 * least as much of a packet as can be read.
738 * Called from the fileops interface with nothing held.
743 tapread(struct dev_read_args *ap)
745 cdev_t dev = ap->a_head.a_dev;
746 struct uio *uio = ap->a_uio;
747 struct tap_softc *tp = dev->si_drv1;
748 struct ifnet *ifp = &tp->tap_if;
749 struct mbuf *m0 = NULL;
752 TAPDEBUG(ifp, "reading, minor = %#x\n", minor(tp->tap_dev));
754 if ((tp->tap_flags & TAP_READY) != TAP_READY) {
755 TAPDEBUG(ifp, "not ready. minor = %#x, tap_flags = 0x%x\n",
756 minor(tp->tap_dev), tp->tap_flags);
761 tp->tap_flags &= ~TAP_RWAIT;
763 /* sleep until we get a packet */
765 ifnet_serialize_all(ifp);
766 IF_DEQUEUE(&tp->tap_devq, m0);
768 if (ap->a_ioflag & IO_NDELAY) {
769 ifnet_deserialize_all(ifp);
770 return (EWOULDBLOCK);
772 tp->tap_flags |= TAP_RWAIT;
774 tsleep_interlock(tp);
775 ifnet_deserialize_all(ifp);
776 error = tsleep(tp, PCATCH, "taprd", 0);
781 ifnet_deserialize_all(ifp);
783 } while (m0 == NULL);
787 /* xfer packet to user space */
788 while ((m0 != NULL) && (uio->uio_resid > 0) && (error == 0)) {
789 len = min(uio->uio_resid, m0->m_len);
793 error = uiomove(mtod(m0, caddr_t), len, uio);
798 TAPDEBUG(ifp, "dropping mbuf, minor = %#x\n",
809 * The ops write interface - an atomic write is a packet - or else!
811 * Called from the fileops interface with nothing held.
816 tapwrite(struct dev_write_args *ap)
818 cdev_t dev = ap->a_head.a_dev;
819 struct uio *uio = ap->a_uio;
820 struct tap_softc *tp = dev->si_drv1;
821 struct ifnet *ifp = &tp->tap_if;
822 struct mbuf *top = NULL, **mp = NULL, *m = NULL;
823 int error = 0, tlen, mlen;
825 TAPDEBUG(ifp, "writing, minor = %#x\n", minor(tp->tap_dev));
827 if ((tp->tap_flags & TAP_READY) != TAP_READY) {
828 TAPDEBUG(ifp, "not ready. minor = %#x, tap_flags = 0x%x\n",
829 minor(tp->tap_dev), tp->tap_flags);
833 if (uio->uio_resid == 0)
836 if ((uio->uio_resid < 0) || (uio->uio_resid > TAPMRU)) {
837 TAPDEBUG(ifp, "invalid packet len = %d, minor = %#x\n",
838 uio->uio_resid, minor(tp->tap_dev));
842 tlen = uio->uio_resid;
844 /* get a header mbuf */
845 MGETHDR(m, MB_DONTWAIT, MT_DATA);
852 while ((error == 0) && (uio->uio_resid > 0)) {
853 m->m_len = min(mlen, uio->uio_resid);
854 error = uiomove(mtod(m, caddr_t), m->m_len, uio);
857 if (uio->uio_resid > 0) {
858 MGET(m, MB_DONTWAIT, MT_DATA);
873 top->m_pkthdr.len = tlen;
874 top->m_pkthdr.rcvif = ifp;
877 * Ethernet bridge and bpf are handled in ether_input
879 * adjust mbuf and give packet to the ether_input
881 ifnet_serialize_all(ifp);
882 ifp->if_input(ifp, top);
883 ifp->if_ipackets ++; /* ibytes are counted in ether_input */
884 ifnet_deserialize_all(ifp);
892 * The poll interface, this is only useful on reads really. The write
893 * detect always returns true, write never blocks anyway, it either
894 * accepts the packet or drops it
896 * Called from the fileops interface with nothing held.
901 tappoll(struct dev_poll_args *ap)
903 cdev_t dev = ap->a_head.a_dev;
904 struct tap_softc *tp = dev->si_drv1;
905 struct ifnet *ifp = &tp->tap_if;
908 TAPDEBUG(ifp, "polling, minor = %#x\n", minor(tp->tap_dev));
910 if (ap->a_events & (POLLIN | POLLRDNORM)) {
911 if (!IF_QEMPTY(&tp->tap_devq)) {
913 "has data in queue. minor = %#x\n",
916 revents |= (ap->a_events & (POLLIN | POLLRDNORM));
918 TAPDEBUG(ifp, "waiting for data, minor = %#x\n",
922 selrecord(curthread, &tp->tap_rsel);
927 if (ap->a_events & (POLLOUT | POLLWRNORM))
928 revents |= (ap->a_events & (POLLOUT | POLLWRNORM));
929 ap->a_events = revents;
934 * tapkqfilter - called from the fileops interface with nothing held
938 static int filt_tapread(struct knote *kn, long hint);
939 static void filt_tapdetach(struct knote *kn);
940 static struct filterops tapread_filtops =
941 { 1, NULL, filt_tapdetach, filt_tapread };
944 tapkqfilter(struct dev_kqfilter_args *ap)
946 cdev_t dev = ap->a_head.a_dev;
947 struct knote *kn = ap->a_kn;
948 struct tap_softc *tp;
957 switch(kn->kn_filter) {
959 list = &tp->tap_rsel.si_note;
960 kn->kn_fop = &tapread_filtops;
961 kn->kn_hook = (void *)tp;
971 SLIST_INSERT_HEAD(list, kn, kn_selnext);
978 filt_tapread(struct knote *kn, long hint)
980 struct tap_softc *tp = (void *)kn->kn_hook;
982 if (IF_QEMPTY(&tp->tap_devq) == 0) /* XXX serializer */
989 filt_tapdetach(struct knote *kn)
991 struct tap_softc *tp = (void *)kn->kn_hook;
993 SLIST_REMOVE(&tp->tap_rsel.si_note, kn, knote, kn_selnext);
997 tapifstop(struct tap_softc *tp, int clear_flags)
999 struct ifnet *ifp = &tp->tap_if;
1001 ASSERT_IFNET_SERIALIZED_ALL(ifp);
1002 IF_DRAIN(&tp->tap_devq);
1004 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
1008 tapifflags(struct tap_softc *tp)
1010 struct ifnet *ifp = &tp->arpcom.ac_if;
1012 ASSERT_IFNET_SERIALIZED_ALL(ifp);
1013 if ((tp->tap_flags & TAP_VMNET) == 0) {
1015 * Only for non-vmnet tap(4)
1017 if (ifp->if_flags & IFF_UP) {
1018 if ((ifp->if_flags & IFF_RUNNING) == 0)