Lines 454-483
Link Here
|
454 |
CURVNET_SET(ifp->if_vnet); |
454 |
CURVNET_SET(ifp->if_vnet); |
455 |
IFQ_PURGE(&ifp->if_snd); |
455 |
IFQ_PURGE(&ifp->if_snd); |
456 |
|
456 |
|
457 |
if (ifp->if_flags & IFF_UP) { |
457 |
if ((ifp->if_flags & (IFF_UP | IFF_LINK0)) == IFF_UP) { |
458 |
mtx_unlock(&tp->tun_mtx); |
458 |
mtx_unlock(&tp->tun_mtx); |
459 |
if_down(ifp); |
459 |
if_down(ifp); |
460 |
mtx_lock(&tp->tun_mtx); |
460 |
mtx_lock(&tp->tun_mtx); |
461 |
} |
|
|
462 |
|
461 |
|
463 |
/* Delete all addresses and routes which reference this interface. */ |
462 |
/* Delete all addresses and routes which reference this interface. */ |
464 |
if (ifp->if_drv_flags & IFF_DRV_RUNNING) { |
463 |
if (ifp->if_drv_flags & IFF_DRV_RUNNING) { |
465 |
struct ifaddr *ifa; |
464 |
struct ifaddr *ifa; |
466 |
|
465 |
|
467 |
ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
466 |
ifp->if_drv_flags &= ~IFF_DRV_RUNNING; |
468 |
mtx_unlock(&tp->tun_mtx); |
467 |
mtx_unlock(&tp->tun_mtx); |
469 |
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { |
468 |
CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { |
470 |
/* deal w/IPv4 PtP destination; unlocked read */ |
469 |
/* deal w/IPv4 PtP destination; unlocked read */ |
471 |
if (ifa->ifa_addr->sa_family == AF_INET) { |
470 |
if (ifa->ifa_addr->sa_family == AF_INET) { |
472 |
rtinit(ifa, (int)RTM_DELETE, |
471 |
rtinit(ifa, (int)RTM_DELETE, |
473 |
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); |
472 |
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); |
474 |
} else { |
473 |
} else { |
475 |
rtinit(ifa, (int)RTM_DELETE, 0); |
474 |
rtinit(ifa, (int)RTM_DELETE, 0); |
|
|
475 |
} |
476 |
} |
476 |
} |
|
|
477 |
if_purgeaddrs(ifp); |
478 |
mtx_lock(&tp->tun_mtx); |
477 |
} |
479 |
} |
478 |
if_purgeaddrs(ifp); |
|
|
479 |
mtx_lock(&tp->tun_mtx); |
480 |
} |
480 |
} |
|
|
481 |
|
481 |
if_link_state_change(ifp, LINK_STATE_DOWN); |
482 |
if_link_state_change(ifp, LINK_STATE_DOWN); |
482 |
CURVNET_RESTORE(); |
483 |
CURVNET_RESTORE(); |
483 |
|
484 |
|