diff --git a/sys/dev/virtual/vkernel/net/if_vke.c b/sys/dev/virtual/vkernel/net/if_vke.c index c09b36d..d123c0c 100644 --- a/sys/dev/virtual/vkernel/net/if_vke.c +++ b/sys/dev/virtual/vkernel/net/if_vke.c @@ -300,7 +300,6 @@ vke_init(void *xsc) sc->cotd_tx_exit = sc->cotd_rx_exit = VKE_COTD_RUN; sc->cotd_tx = cothread_create(vke_tx_thread, vke_tx_intr, sc, "vke_tx"); sc->cotd_rx = cothread_create(vke_rx_thread, vke_rx_intr, sc, "vke_rx"); - if (sc->sc_addr != 0) { in_addr_t addr, mask; @@ -655,7 +654,7 @@ vke_tx_thread(cothread_t cotd) { struct mbuf *m; struct vke_softc *sc = cotd->arg; - /*struct ifnet *ifp = &sc->arpcom.ac_if;*/ + struct ifnet *ifp = &sc->arpcom.ac_if; int count = 0; while (sc->cotd_tx_exit == VKE_COTD_RUN) { @@ -673,6 +672,10 @@ vke_tx_thread(cothread_t cotd) /* no mycpu in cothread */ /*IFNET_STAT_INC(ifp, oerrors, 1);*/ ++sc->cotd_oerrors; + if (errno == EPIPE) { + printf("%s: link down\n", ifp->if_xname); + ifp->if_flags |= IFF_VKEDOWN; + } } else { /* no mycpu in cothread */ /*IFNET_STAT_INC(ifp, opackets, 1);*/ diff --git a/sys/net/if.h b/sys/net/if.h index 35f6bb6..d1eac16 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -138,6 +138,7 @@ struct if_data { #define IFF_MONITOR 0x40000 /* user-requested monitor mode */ #define IFF_STATICARP 0x80000 /* static ARP */ #define IFF_NPOLLING 0x100000 /* interface is in polling mode */ +#define IFF_VKEDOWN 0x2000000 /* flags set internally only: */ #define IFF_CANTCHANGE \ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 65e71b0..f30b50e 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -227,6 +227,11 @@ ether_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, ASSERT_IFNET_NOT_SERIALIZED_ALL(ifp); + if (ifp->if_flags & IFF_VKEDOWN) { + ifp->if_link_state = LINK_STATE_DOWN; + if_link_state_change(ifp); + gotoerr(ENETDOWN); + } if (ifp->if_flags & IFF_MONITOR) gotoerr(ENETDOWN); if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING)) diff --git a/sys/platform/vkernel64/x86_64/exception.c b/sys/platform/vkernel64/x86_64/exception.c index b80ef27..73f1baa 100644 --- a/sys/platform/vkernel64/x86_64/exception.c +++ b/sys/platform/vkernel64/x86_64/exception.c @@ -167,6 +167,7 @@ init_exceptions(void) sigaction(SIGSEGV, &sa, NULL); sigaction(SIGTRAP, &sa, NULL); sigaction(SIGFPE, &sa, NULL); + signal(SIGPIPE, SIG_IGN); sa.sa_flags &= ~SA_NODEFER;