tcpdump mailing list archives

Re: select()ing on a pcap descriptor in Solaris


From: Guy Harris <guy () alum mit edu>
Date: Thu, 14 Aug 2014 15:01:33 -0700


On Aug 14, 2014, at 1:34 PM, Fernando Gont <fernando () gont com ar> wrote:

While trying to select() on a pcap descriptor in solaris

Which version?  Solaris 11 (in which pcap descriptors should refer to BPF devices), or earlier (in which pcap 
descriptors should refer to DLPI STREAMS devices)?

I found the following:

1) It seems that pcap descriptors are never readable or writeable. (--
This is different from *BSD and Linux, where at least you seem to be
able to check for readability)

2) It would seem that even trying to select() on such descriptors causes
trouble. For example, I get a kind of random "Bad file number" error
from select when I try to check for readability/writeability.

I wouldn't expect that prior to Solaris 11 - select() and poll() Just Work on STREAMS devices, as I remember.

It could, however, be that Sun^WOracle screwed up with BPF; unfortunately, Solaris 11 is ClosedSolaris, so I can't just 
look at the source and see what they did wrong.

I'll try this on my Solaris 11 virtual machine.

Is the above assessment correct? Should I not even try to call select()
on pcap descriptors in Solaris?

If they screwed up on Solaris 11, you probably shouldn't try to call select(); instead, you should try to call Oracle 
and report this as a bug (and tell them that, if they fix this, they should fix it so that if you have a timeout set 
with BIOCSRTIMEOUT, the timer should start as soon as a select() or poll() is done, so that, when the timeout expires, 
it can report the descriptor as readable - the original BPF didn't do that, and all the *BSDs and OS X eventually fixed 
it).
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: