tcpdump mailing list archives

Re: libpcap on Mac Os X 10.6 Snow Leopard


From: Guy Harris <guy () alum mit edu>
Date: Fri, 12 Feb 2010 16:52:05 -0800


On Feb 12, 2010, at 11:02 AM, Marco De Angelis wrote:

Guy Harris <guy <at> alum.mit.edu> writes:

Can you cut your application down to the smallest code 
snippet that shows the problem, and send that to me? 

I managed to extrapolate the core. It's a little messy because
of the many tests I made recently and the 80-chars line 
limitation, but it show the original  problem. 
If you uncomment the call to ioctl with
BIOCIMMEDIATE setting, packets get delivered immediately.

...and if I "#if 0" out the code that puts the pcap into non-blocking mode, packets don't get delivered immediately, 
but they *do* arrive, so it appears to be an issue with non-blocking mode.

From looking at both the FreeBSD and OS X BPF code path in the kernel, I suspect the problem would also show up on 
FreeBSD 7.x and 8.x, at least, as well as 9.0-CURRENT; there are probably older versions that have it as well.  
However, if you use select() to wait for packets, it probably won't occur on FreeBSD, but would still occur on OS X.  
Top-of-tree NetBSD looks as if it fixes this, and I don't know if OpenBSD ever had it (the top-of-tree code looks as 
if the change that introduced this was never added).  DragonFly BSD appears to be the same as FreeBSD here.

If you have an Apple Developer Connection account, go to

        http://developer.apple.com/bugreporter/

and log in to Apple Bug Reporter and file a bug; please send me the bug number when you do so.  If you don't have an 
ADC account, that page has a "Sign up to become a free ADC Member" link.

This problem was introduced in Snow Leopard as a result of picking up from FreeBSD a fix to another bug; the existence 
in FreeBSD of that fix is the reason why I suspect the same problem would show up there (and the existence in FreeBSD 
of a fix to the way BPF works with select() is the reason why I suspect using select() to wait for packets would 
prevent the bug from appearing there - that fix is *not* in OS X).

Anybody else seeing this problem should also file a bug and send me the bug number.  (The more bugs filed, the more 
likely I suspect it'll be to get fixed in a software update.)

If it shows up in FreeBSD, I'll look at submitting fixes for it and DragonFly BSD as well.  (If it doesn't, I need to 
think about this a little more.)-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: