svn commit: r274966 - head/sys/net
Philip Paeps
philip at FreeBSD.org
Mon Nov 24 14:00:28 UTC 2014
Author: philip
Date: Mon Nov 24 14:00:27 2014
New Revision: 274966
URL: https://svnweb.freebsd.org/changeset/base/274966
Log:
Add a sysctl `net.link.tap.deladdrs_on_close' to configure whether tap
should delete configured addresses and routes when the interface is
closed. Default is enabled (preserve current behaviour).
MFC after: 1 week
Modified:
head/sys/net/if_tap.c
Modified: head/sys/net/if_tap.c
==============================================================================
--- head/sys/net/if_tap.c Mon Nov 24 13:02:39 2014 (r274965)
+++ head/sys/net/if_tap.c Mon Nov 24 14:00:27 2014 (r274966)
@@ -156,6 +156,7 @@ static int tapdebug = 0; /* deb
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;
@@ -172,6 +173,9 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, up_o
"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,7 +540,8 @@ tapclose(struct cdev *dev, int foo, int
* interface, if we are in VMnet mode. just close the device.
*/
- if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) {
+ if (tapclosedeladdrs == 1 && ((tp->tap_flags & TAP_VMNET) == 0) &&
+ (ifp->if_flags & IFF_UP)) {
mtx_unlock(&tp->tap_mtx);
if_down(ifp);
mtx_lock(&tp->tap_mtx);
More information about the svn-src-all
mailing list