Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-26 Thread Guy Harris
Eloy Paris wrote: However, I think the reason that I am not seeing any broken behavior is because I use BIOCIMMEDIATE. Right. There you mentioned "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

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-26 Thread Eloy Paris
Hi Guy, On Thu, Oct 26, 2006 at 03:20:35AM -0700, Guy Harris wrote: > >How would one notice that select() is not working correctly on a BPF > >device on some of the BSDs? > > By compiling and running the attached program (compile with -lpcap) > in one window, with "-i" used to select an interface

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-26 Thread Guy Harris
Eloy Paris wrote: Guy, On Wed, Oct 18, 2006 at 04:12:04PM -0700, Guy Harris wrote: [...] Note that in some systems with BPF (older versions of {Free,Net,Open,Dragonfly}BSD, current versions of Mac OS X), select() (and poll()) don't work correctly on BPF devices, and so you have to work a

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-25 Thread Eloy Paris
Guy, On Wed, Oct 18, 2006 at 04:12:04PM -0700, Guy Harris wrote: [...] > Note that in some systems with BPF (older versions of > {Free,Net,Open,Dragonfly}BSD, current versions of Mac OS X), select() > (and poll()) don't work correctly on BPF devices, and so you have to > work around that.

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-18 Thread Guy Harris
On Oct 18, 2006, at 3:41 PM, Alexander Dupuy wrote: You really want to use select() (or poll() if your operating system doesn't support select()) instead of a CPU polling loop. You can use pcap_get_selectable_fd() to get the underlying file descriptor on a Unix system (won't work on Windo

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-18 Thread rh
After playing around with this for a while, the solution I've used is to open two pcap_t * handles, set them non-blocking, and then call pcap_dispatch() on each of them within a while(1) loop. This sucks for (at least) two reasons: First, it's basically brain-dead and a CPU hog. Second, for

Re: [tcpdump-workers] forcing pcap_loop() failures

2006-10-18 Thread Alexander Dupuy
rh wrote: After playing around with this for a while, the solution I've used is to open two pcap_t * handles, set them non-blocking, and then call pcap_dispatch() on each of them within a while(1) loop. You really want to use select() (or poll() if your operating system doesn't support sele