summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tap.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-04-10 09:50:13 +0000
committerglebius <glebius@FreeBSD.org>2015-04-10 09:50:13 +0000
commit50ede929e1b024ffe6c3ec07e9f30f135b94fd3f (patch)
treee59d9aebd24a502960b629878c0b7345e03f85f3 /sys/net/if_tap.c
parent2af61a79430e5883b90364af5c6bb01654c6e613 (diff)
downloadFreeBSD-src-50ede929e1b024ffe6c3ec07e9f30f135b94fd3f.zip
FreeBSD-src-50ede929e1b024ffe6c3ec07e9f30f135b94fd3f.tar.gz
Redo r274966. Instead of global all-interface all-vnet undocumented sysctl,
use per-interface flag, and document it. Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/net/if_tap.c')
-rw-r--r--sys/net/if_tap.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 5f6f0aa..b23ab34 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);
OpenPOWER on IntegriCloud