Ethereal-users: Re: [Ethereal-users] Select() related issue when using ethereal on a proprietory

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 6 Jul 2004 11:35:06 -0700
On Tue, Jul 06, 2004 at 10:38:47AM +0530, Umesha S Anand wrote:
>    I have modified libpcap library to capture packets from a proprietary
> card. Our
> Device driver does not support select() call

You might want to fix that.   What happens if a "select()" is done on
the device?  Is an error returned, or does no wakeup occur (so that only
a timeout or another descriptor becoming readable or writeable wakes up
the "select()"), or does it always return "input ready to read" (so that
the "select()" wakes up immediately)?

> and hence in the pcap_t
> structure created for our device, I have set the selectable_fd value to -1.
> However, ethereal does not seem to be looking at this value before calling
> select() On our device fd due to the #define MUST_DO_SELECT defined for
> Linux in capture.c File.

Ethereal doesn't use "pcap_get_selectable_fd()", it just uses
"pcap_fileno()", so it doesn't use the "selectable_fd" value at all, it
uses the "fd" value.

Does your device set that value to the file descriptor for the device?
If so, and if the problem is that no wakeup occurs, then any change to
Ethereal to use "pcap_get_selectable_fd()" if available, and skip the
"select()" if "pcap_get_selectable_fd()" returns, could change the
behavior of Ethereal from "blocks until the 'select()' times out
regardless of whether any packets have arrived" to "blocks until a
packet arrives so that Ethereal ignores user input until a packet
arrives".  Is that the behavior you want?  If not, you should seriously
consider modifying the driver to support "select()".