MFC:
Add a sysctl net.link.tap.up_on_open which defaults to zero; when it is non-zero, tap(4) instances will be marked IFF_UP on attach. 1.71 +6 -1 src/sys/net/if_tap.c 1.19 +8 -1 src/share/man/man4/tap.4 PR: 110383 Requested by: Frank Behrens
This commit is contained in:
parent
f27a453111
commit
127ead92a0
@ -1,7 +1,7 @@
|
||||
.\" $FreeBSD$
|
||||
.\" Based on PR#2411
|
||||
.\"
|
||||
.Dd February 4, 2007
|
||||
.Dd March 19, 2007
|
||||
.Os
|
||||
.Dt TAP 4
|
||||
.Sh NAME
|
||||
@ -117,6 +117,13 @@ and is restricted to the super-user, unless the
|
||||
variable
|
||||
.Va net.link.tap.user_open
|
||||
is non-zero.
|
||||
If the
|
||||
.Xr sysctl 8
|
||||
variable
|
||||
.Va net.link.tap.up_on_open
|
||||
is non-zero, the tunnel device will be marked
|
||||
.Dq up
|
||||
when the control device is opened.
|
||||
A
|
||||
.Fn read
|
||||
call will return an error
|
||||
|
@ -149,7 +149,8 @@ static struct cdevsw tap_cdevsw = {
|
||||
*/
|
||||
static struct mtx tapmtx;
|
||||
static int tapdebug = 0; /* debug flag */
|
||||
static int tapuopen = 0; /* allow user open() */
|
||||
static int tapuopen = 0; /* allow user open() */
|
||||
static int tapuponopen = 0; /* IFF_UP on open() */
|
||||
static int tapdclone = 1; /* enable devfs cloning */
|
||||
static SLIST_HEAD(, tap_softc) taphead; /* first device */
|
||||
static struct clonedevs *tapclones;
|
||||
@ -163,6 +164,8 @@ SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0,
|
||||
"Ethernet tunnel software network interface");
|
||||
SYSCTL_INT(_net_link_tap, OID_AUTO, user_open, CTLFLAG_RW, &tapuopen, 0,
|
||||
"Allow user to open /dev/tap (based on node permissions)");
|
||||
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_RW, &tapdclone, 0,
|
||||
"Enably legacy devfs interface creation");
|
||||
SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tapdebug, 0, "");
|
||||
@ -501,6 +504,8 @@ tapopen(struct cdev *dev, int flag, int mode, struct thread *td)
|
||||
s = splimp();
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if (tapuponopen)
|
||||
ifp->if_flags |= IFF_UP;
|
||||
splx(s);
|
||||
|
||||
TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
|
||||
|
Loading…
x
Reference in New Issue
Block a user