diff --git a/share/man/man4/tap.4 b/share/man/man4/tap.4 index 6e4299609c7..a95627be783 100644 --- a/share/man/man4/tap.4 +++ b/share/man/man4/tap.4 @@ -1,7 +1,7 @@ .\" $FreeBSD$ .\" Based on PR#2411 .\" -.Dd November 30, 2014 +.Dd April 10, 2015 .Dt TAP 4 .Os .Sh NAME @@ -275,7 +275,9 @@ brought down .Dq ifconfig tap Ns Sy N No down ) unless the device is a .Em VMnet -device. +device, or has +.Dv IFF_LINK0 +flag set. All queued frames are thrown away. If the interface is up when the data device is not open, output frames are thrown away rather than diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 5f6f0aaaade..b23ab34a130 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -156,7 +156,6 @@ static int tapdebug = 0; /* debug flag */ static int tapuopen = 0; /* allow user open() */ static int tapuponopen = 0; /* IFF_UP on open() */ static int tapdclone = 1; /* enable devfs cloning */ -static int tapclosedeladdrs = 1; /* del addrs on close */ static SLIST_HEAD(, tap_softc) taphead; /* first device */ static struct clonedevs *tapclones; @@ -173,9 +172,6 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, up_on_open, CTLFLAG_RW, &tapuponopen, 0, "Bring interface up when /dev/tap is opened"); SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tapdclone, 0, "Enably legacy devfs interface creation"); -SYSCTL_INT(_net_link_tap, OID_AUTO, deladdrs_on_close, CTLFLAG_RW, - &tapclosedeladdrs, 0, "Delete addresses and routes when /dev/tap is " - "closed"); SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tapdebug, 0, ""); DEV_MODULE(if_tap, tapmodevent, NULL); @@ -536,12 +532,11 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td) IF_DRAIN(&ifp->if_snd); /* - * do not bring the interface down, and do not anything with - * interface, if we are in VMnet mode. just close the device. + * Do not bring the interface down, and do not anything with + * interface, if we are in VMnet mode. Just close the device. */ - - if (tapclosedeladdrs == 1 && ((tp->tap_flags & TAP_VMNET) == 0) && - (ifp->if_flags & IFF_UP)) { + if (((tp->tap_flags & TAP_VMNET) == 0) && + (ifp->if_flags & (IFF_UP | IFF_LINK0)) == IFF_UP) { mtx_unlock(&tp->tap_mtx); if_down(ifp); mtx_lock(&tp->tap_mtx);