Subject: kern/8674: bpf ioctl BIOCIMMEDIATE doesn't behave as it should
To: None <>
From: None <>
List: netbsd-bugs
Date: 10/24/1999 02:57:43
>Number:         8674
>Category:       kern
>Synopsis:       bpf ioctl BIOCIMMEDIATE doesn't behave as it should
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 24 02:57:01 1999
>Originator:     Dave Sainty
Dynamic Technology Services and Products Ltd (NZ)
>Release:        Recent NetBSD-current
i386, NetBSD-current
System: NetBSD 1.4K NetBSD 1.4K (TEQUILA) #7: Fri Sep 17 23:43:58 NZST 1999 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.