Eloy Paris wrote:
Wow, I feel like an idiot. Looks like I didn't do my homework well.
Further digging on the mailing list archive gave me the answer:
BIOCIMMEDIATE
Doing an ioctl() for BIOCIMMEDIATE on the file descriptor returned
by pcap_get_selectable_fd() completely fixes the problem.
It works around the problem by getting rid of the timeout, so that as
soon as a packet arrives the packet is made available, rather than the
BPF device holding onto the packet until either the timeout expires or
the buffer fills up.
It also works around the problem on older BSDs.
However, it means that you won't get the buffering done, so you will get
woken up more often and will do more reads from the BPF device,
consuming more CPU time.
The workaround I mentioned in my other mail means you still get the
buffering.
(The fix for the problem would be to have the BPF driver start the BPF
timer on a BPF defice when a select() is done on it, as well as when a
read() is done on it as is done now.)
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.