Subject: kern/8674: bpf ioctl BIOCIMMEDIATE doesn't behave as it should
To: None <email@example.com>
From: None <firstname.lastname@example.org>
Date: 10/24/1999 02:57:43
>Synopsis: bpf ioctl BIOCIMMEDIATE doesn't behave as it should
>Responsible: kern-bug-people (Kernel Bug People)
>Arrival-Date: Sun Oct 24 02:57:01 1999
>Originator: Dave Sainty
Dynamic Technology Services and Products Ltd (NZ)
>Release: Recent NetBSD-current
System: NetBSD tequila.dave.dtsp.co.nz 1.4K NetBSD 1.4K (TEQUILA) #7: Fri Sep 17 23:43:58 NZST 1999 email@example.com:/vol/tequila/userB/u2/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386
The BIOCIMMEDIATE bpf ioctl() basically behaves just like a
non-blocking open. This doesn't match what the man page says, and
certainly doesn't match what you whould expect. According to the man
page, in immediate mode read()'s will still block in this mode, they
will just return immediately on any received packet.
Set "immediate" mode. See read()'s return with EWOULDBLOCK.
The fix appears to be the obvious in sys/net/bpf.c, that is: simply
fall through and block in immediate mode when the buffer is empty.
catchpacket() already has handling for immediate mode that ensures it
is woken early on packet reception.