Drop received packets unless IFF_RUNNING is set. When hvn(4) attaches
authorpatrick <patrick@openbsd.org>
Fri, 11 Jun 2021 12:47:15 +0000 (12:47 +0000)
committerpatrick <patrick@openbsd.org>
Fri, 11 Jun 2021 12:47:15 +0000 (12:47 +0000)
it sends commands and waits for replies to come back in.  The receive
pipe seems to contain both command completions and data packets.  When
waiting for command completion during hvn(4) attach, it's possible for
packets to show up as well.  We shouldn't call if_input() if hvn(4) is
not set up, so drop them when we're not running.

ok mikeb@

sys/dev/pv/if_hvn.c

index 621c78a..c6c21da 100644 (file)
@@ -1470,7 +1470,10 @@ hvn_rndis_input(struct hvn_softc *sc, uint64_t tid, void *arg)
        }
        hvn_nvs_ack(sc, tid);
 
-       if_input(ifp, &ml);
+       if (ifp->if_flags & IFF_RUNNING)
+               if_input(ifp, &ml);
+       else
+               ml_purge(&ml);
 }
 
 static inline struct mbuf *