Lines 229-234
tap_clone_destroy(struct ifnet *ifp)
Link Here
|
229 |
{ |
229 |
{ |
230 |
struct tap_softc *tp = ifp->if_softc; |
230 |
struct tap_softc *tp = ifp->if_softc; |
231 |
|
231 |
|
|
|
232 |
sysctl_ctx_free(&tp->ctx); |
232 |
mtx_lock(&tapmtx); |
233 |
mtx_lock(&tapmtx); |
233 |
SLIST_REMOVE(&taphead, tp, tap_softc, tap_next); |
234 |
SLIST_REMOVE(&taphead, tp, tap_softc, tap_next); |
234 |
mtx_unlock(&tapmtx); |
235 |
mtx_unlock(&tapmtx); |
Lines 399-404
tapcreate(struct cdev *dev)
Link Here
|
399 |
int unit; |
400 |
int unit; |
400 |
char *name = NULL; |
401 |
char *name = NULL; |
401 |
u_char eaddr[6]; |
402 |
u_char eaddr[6]; |
|
|
403 |
char num[14]; /* sufficient for 32 bits */ |
404 |
struct sysctl_oid *oid; |
402 |
|
405 |
|
403 |
dev->si_flags &= ~SI_CHEAPCLONE; |
406 |
dev->si_flags &= ~SI_CHEAPCLONE; |
404 |
|
407 |
|
Lines 433-438
tapcreate(struct cdev *dev)
Link Here
|
433 |
ifp = tp->tap_ifp = if_alloc(IFT_ETHER); |
436 |
ifp = tp->tap_ifp = if_alloc(IFT_ETHER); |
434 |
if (ifp == NULL) |
437 |
if (ifp == NULL) |
435 |
panic("%s%d: can not if_alloc()", name, unit); |
438 |
panic("%s%d: can not if_alloc()", name, unit); |
|
|
439 |
|
440 |
sysctl_ctx_init(&tp->ctx); |
441 |
snprintf(num, sizeof(num), "%u", unit); |
442 |
tp->keep_up = 0; |
443 |
oid = SYSCTL_ADD_NODE(&tp->ctx, &SYSCTL_NODE_CHILDREN(_net_link, tap), |
444 |
OID_AUTO, num, CTLFLAG_RD, NULL, ""); |
445 |
SYSCTL_ADD_INT(&tp->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, |
446 |
"keep_up", CTLTYPE_INT|CTLFLAG_RW, &tp->keep_up, tp->keep_up, |
447 |
"Keep interface up on close"); |
448 |
|
436 |
ifp->if_softc = tp; |
449 |
ifp->if_softc = tp; |
437 |
if_initname(ifp, name, unit); |
450 |
if_initname(ifp, name, unit); |
438 |
ifp->if_init = tapifinit; |
451 |
ifp->if_init = tapifinit; |
Lines 528-534
tapclose(struct cdev *dev, int foo, int
Link Here
|
528 |
* interface, if we are in VMnet mode. just close the device. |
541 |
* interface, if we are in VMnet mode. just close the device. |
529 |
*/ |
542 |
*/ |
530 |
|
543 |
|
531 |
if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { |
544 |
if (!tp->keep_up && |
|
|
545 |
((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { |
532 |
mtx_unlock(&tp->tap_mtx); |
546 |
mtx_unlock(&tp->tap_mtx); |
533 |
if_down(ifp); |
547 |
if_down(ifp); |
534 |
mtx_lock(&tp->tap_mtx); |
548 |
mtx_lock(&tp->tap_mtx); |