-/* $OpenBSD: if_tun.c,v 1.232 2022/02/15 04:16:10 dlg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.233 2022/02/15 04:19:52 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
CLR(sc->sc_flags, stayup);
/* automatically mark the interface running on open */
+ NET_LOCK();
SET(ifp->if_flags, IFF_UP | IFF_RUNNING);
+ NET_UNLOCK();
tun_link_state(ifp, LINK_STATE_FULL_DUPLEX);
if_put(ifp);
/*
* junk all pending output
*/
+ NET_LOCK();
CLR(ifp->if_flags, IFF_UP | IFF_RUNNING);
+ NET_UNLOCK();
ifq_purge(&ifp->if_snd);
CLR(sc->sc_flags, TUN_ASYNC);
destroy = 1;
strlcpy(name, ifp->if_xname, sizeof(name));
} else {
- CLR(ifp->if_flags, IFF_UP | IFF_RUNNING);
tun_link_state(ifp, LINK_STATE_DOWN);
}
}