I've been a happy Ethereal user for a while. Sometime this year
Ethereal started behaving badly for me, mainly hanging/locking up if I
specified any capture filters. After digging around for a bit I found
some code/comments in capture.c as extracted below.
I commented out the FreeBSD check and Ethereal seems to be back to the
old, better behavior. I wanted to send out this message for a few
reasons:
- to document the behavior for the BSDs in case anyone is searching
for data on this behavior
- I have the question - how do you tell if select() on a bpf device is
OK? The comment says "doesn't work correctly on BPF devices on at *
least some releases of some flavors of BSD" but that sure seems to
punish those of us where select() does work properly....
- Might an additonal flag, like USE_SELECT_WITH_BSD or something be
added to this configuration check so that people who make packages
or ports, or who are building on there own system can override this
check without modifying the source?
I am using FreeBSD 4.10, I don't know if the bpf/select works on other
versions of FreeBSD... I am not absolutely sure if it works for 4.10,
but it sure seems to.
Thanks for providing Ethereal, a really great network tool....
- Mike H.
(from capture.c)
...
/*
* We don't want to do a "select()" on the pcap_t's file descriptor on
* BSD (because "select()" doesn't work correctly on BPF devices on at
* least some releases of some flavors of BSD), and we don't want to do
* it on Windows (because "select()" is something for sockets, not for
* arbitrary handles). (Note that "Windows" here includes Cygwin;
* even in its pretend-it's-UNIX environment, we're using WinPcap, not
* a UNIX libpcap.)
*
* We *do* want to do it on other platforms, as, on other platforms (with
* the possible exception of Ultrix and Digital UNIX), the read timeout
* doesn't expire if no packets have arrived, so a "pcap_dispatch()" call
* will block until packets arrive, causing the UI to hang.
*
* XXX - the various BSDs appear to define BSD in <sys/param.h>; we don't
* want to include it if it's not present on this platform, however.
*/
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \
!defined(__bsdi__) && !defined(__APPLE__) && !defined(_WIN32) && \
!defined(__CYGWIN__)
# define MUST_DO_SELECT
...