diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 93801f10412b..9123e8c85aae 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -502,6 +502,7 @@ tapopen(struct cdev *dev, int flag, int mode, struct thread *td) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (tapuponopen) ifp->if_flags |= IFF_UP; + if_link_state_change(ifp, LINK_STATE_UP); splx(s); TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -547,6 +548,7 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td) } else mtx_unlock(&tp->tap_mtx); + if_link_state_change(ifp, LINK_STATE_DOWN); funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0); diff --git a/sys/net/route.h b/sys/net/route.h index 6857cb3473dd..66f56b7c93c5 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -319,7 +319,9 @@ struct rt_addrinfo { #ifdef _KERNEL -#define RT_LINK_IS_UP(ifp) ((ifp)->if_link_state == LINK_STATE_UP) +#define RT_LINK_IS_UP(ifp) (((ifp)->if_flags & \ + (IFF_LOOPBACK | IFF_POINTOPOINT)) \ + || (ifp)->if_link_state == LINK_STATE_UP) #define RT_LOCK_INIT(_rt) \ mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)