without this, something using a kevent to monitor a bpf fd on an
idle interface never has the event fire, which means it never
realises the interface goes away. with this, the read event goes
off and the next read fails with EIO, like pretty much every other
driver when the underlying device is removed.
ok claudio@ visa@ jmatthew@
-/* $OpenBSD: bpf.c,v 1.203 2021/01/21 12:33:14 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.204 2021/04/23 03:43:19 dlg Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
if (cdevsw[maj].d_open == bpfopen)
break;
- while ((bd = SMR_SLIST_FIRST_LOCKED(&bp->bif_dlist)))
+ while ((bd = SMR_SLIST_FIRST_LOCKED(&bp->bif_dlist))) {
vdevgone(maj, bd->bd_unit, bd->bd_unit, VCHR);
+ klist_invalidate(&bd->bd_sel.si_note);
+ }
for (tbp = bpf_iflist; tbp; tbp = tbp->bif_next) {
if (tbp->bif_next == bp) {