Guy Harris <guy <at> alum.mit.edu> writes:

> ...and if I "#if 0" out the code that puts the pcap into 
> non-blocking mode, packets don't get delivered
> immediately, but they *do* arrive, so it appears to be an 
>issue with non-blocking mode.

Oh, I see. 

I have set the non-blocking mode to 0, expecting
the call to pcap_dispatch to hang when packets are not 
collected. But instead, I can see many printouts (Read 0 packets)
which indicate that the pcap_dispatch has exited when no
packets are dispatched. So, is the non-blocking mode bugged, or
am I understanding the modality in the wrong way?

marco$ sudo ./libpcaptest en1 icmp
Capturing from 'en1' with filter 'icmp'
BIOCGRTIMEOUT = 0x4008426e, t.tv_sec = 1, t.tv_usec = 0
listening on en1, link-type EN10MB (Ethernet), capture size 128 bytes
Packet captured
Read 1 packets
ReceivedPackets 4 DroppedPackets 0 I/F DroppedPackets 0
Read 0 packets
ReceivedPackets 4 DroppedPackets 0 I/F DroppedPackets 0
Read 0 packets
ReceivedPackets 4 DroppedPackets 0 I/F DroppedPackets 0
Read 0 packets
ReceivedPackets 4 DroppedPackets 0 I/F DroppedPackets 0
Read 0 packets
ReceivedPackets 4 DroppedPackets 0 I/F DroppedPackets 0
Packet captured
Read 1 packets
ReceivedPackets 9 DroppedPackets 0 I/F DroppedPackets 0
^C


> If you have an Apple Developer Connection account, go to
> 
>       http://developer.apple.com/bugreporter/
> 

I have an account. I'll file the bug report and send you the code.


-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

Reply via email to