Redo r274966. Instead of global all-interface all-vnet undocumented sysctl,

use per-interface flag, and document it.

Sponsored by:	Nginx, Inc.
This commit is contained in:
glebius 2015-04-10 09:50:13 +00:00
parent 2af61a7943
commit 50ede929e1
2 changed files with 8 additions and 11 deletions

View File

@ -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

View File

@ -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);