Re: [tcpdump-workers] pcap_read_linux_mmap is always blocking

2009-07-06 Thread Guy Harris
On Jul 6, 2009, at 11:08 AM, Dragos Ilie wrote: My application is not setting the timeout. This corresponds to the case where p->md.timeout == 0. The function pcap_setnonblock_mmap first checks the nonblock flag and if it is set *and* if p->md.timeout > 0 it maps the value to p->md.timeou

Re: [tcpdump-workers] pcap_read_linux_mmap is always blocking

2009-07-06 Thread Dragos Ilie
Guy Harris wrote: > > On Jul 6, 2009, at 9:39 AM, Dragos Ilie wrote: > >> I traced the issue to pcap-linux.c:pcap_read_linux_mmap(), which is the >> read handler selected when HAVE_PACKET_RING is defined. The handler >> calls poll() with a negative value, which means an infinite timeout. >> This oc

Re: [tcpdump-workers] pcap_read_linux_mmap is always blocking

2009-07-06 Thread Guy Harris
On Jul 6, 2009, at 9:39 AM, Dragos Ilie wrote: I traced the issue to pcap-linux.c:pcap_read_linux_mmap(), which is the read handler selected when HAVE_PACKET_RING is defined. The handler calls poll() with a negative value, which means an infinite timeout. This occurs when the libpcap variable

[tcpdump-workers] pcap_read_linux_mmap is always blocking

2009-07-06 Thread Dragos Ilie
I have an application that uses libpcap in non-blocking mode (pcap_setnonblock). The application reads one packet at a time using pcap_dispatch(). My understanding is that pcap_dispatch should return immediately when no packets are available. However, this is not happening. Instead, pcap_dispatch(