[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tcpdump-workers] Re: problems with libpcap-2000.09.13, pcap-linux.c

Hi Kevin, 

Thanks for the feedback!

On Sat, Sep 16, 2000 at 08:11:33PM -0400, Kevin Septor wrote:

> In the pcap_read function of libpcap-2000.09.13 in pcap-linux.c, I was
> experiencing some problems around line 225 where it tries to sleep using
> a select() statement until a packet becomes available.  It was often
> returning a -1 and setting errno to EINTR (Interrupted System Call.) 

Hmm, why would that happen? Normally that happens on incoming signals
etc. But who is signaling the tcpdump process?

> After a little bit of poking around, I came across a section in the
> GCC-HOWTO about the problem and it suggested wrapping misbehaving
> select()'s in a do-while loop.
> http://www.ict.pwr.wroc.pl/doc/Linux-HOWTO/GCC-HOWTO-4.html -- down in
> the "Interrupted system calls." section of the document.
> I followed the suggestion and the section of code now looks like this:
> --
> do {
> 	status = select(handle->fd + 1, &read_fds, NULL, NULL, &tv);
> } while (status == -1 && errno == EINTR);

Makes sense. 

> Yeah so my fix seems to work for me, but admittedly, I'm not much of a C
> or Linux programmer and I'm afraid I'm burying a more serious underlying
> issue.  I'm running 2.2.17 #1 from a fairly standard lightweight
> Debian-2.2 install, haven't even recompiled the kernel, yet.

Good choice! :)

> Any insight into the matter would be greatly appreciated, and I thank
> you for your time and consideration.

I have to thank you for pointing me to that problem and sending in a fix. 


This is the TCPDUMP workers list. It is archived at
To unsubscribe use mailto:tcpdump-workers-request@tcpdump.org?body=unsubscribe