From: dlg Date: Fri, 23 Apr 2021 03:43:19 +0000 (+0000) Subject: call klist_invalidate from bpfsdetach to tell kq listeners what happened. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d0a032833e148e63aad8a4916137e1a84b01c01f;p=openbsd call klist_invalidate from bpfsdetach to tell kq listeners what happened. 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@ --- diff --git a/sys/net/bpf.c b/sys/net/bpf.c index fccc985e6d3..b78067a5428 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -1690,8 +1690,10 @@ bpfsdetach(void *p) 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) {