Bug #1674
closednon-blocking BPF reads return -1/EWOULDBLOCK until the store buffer fills up
0%
Description
Non-blocking reads from a BPF device not in immediate mode will not rotate the buffers even if there's data in the store buffer but not in the hold buffer, so, until the store buffer fills up, the reads will return -1 and set errno to EWOULDBLOCK.
To reproduce, compile the attached (C++) program, run it on an adapter with the filter "icmp" on a reasonably quiet network, and then, on the same machine, ping some host the pings to which will go out on the same network. Note that the program doesn't report any packets having been seen.
To fix, apply the attached patch. (A similar bug has been filed against FreeBSD - and will be filed against Mac OS X.)
Files
Updated by dillon almost 15 years ago
:To reproduce, compile the attached (C++) program, run it on an adapter =
:with the filter "icmp" on a reasonably quiet network, and then, on the =
:same machine, ping some host the pings to which will go out on the same =
:network. Note that the program doesn't report any packets having been =
:seen.
:
:To fix, apply the attached patch. (A similar bug has been filed against =
:FreeBSD - and will be filed against Mac OS X.)
Thanks for the bug report Guy! I've committed the patch.
-Matt