bpf/pcap are weird

Brian Fundakowski Feldman green at FreeBSD.org
Wed Nov 5 11:25:31 PST 2003

Okay, this is goofy stuff and breaks a lot of code that otherwise makes 
certain assumptions about pcap/bpf that don't work on FreeBSD.  Our bpf(4)
doesn't actually care about the non-blocking fd flag, and our pcap(3) 
doesn't care at all about BIOCIMMEDIATE.  Why do we have BIOCIMMEDIATE?  It 
seems like it's what SHOULD be implemented with the non-blocking I/O flag 
with the exception that if using O_NONBLOCK/FIONBIO you could actually query 
for the status, whereas you can't query for BIOCIMMEDIATE since it's only a 
SET and not a GET ioctl.

What's up with this?  Software that knows about pcap(3) but not bpf(4) on 
FreeBSD can't put the interface in the mode it wants to, and the 
non-blocking flag is settable and gettable but doesn't do anything.  
Wouldn't it be better to get rid of at least one of the interfaces, and 
provide a way to check what mode the bpf descriptor is in, either way?

Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green at FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\

More information about the freebsd-arch mailing list