tcpdump mailing list archives

Re: libpcap linux mmap patch


From: "Abeni Paolo" <paolo.abeni () telecomitalia it>
Date: Thu, 31 Jan 2008 14:39:11 +0100

hello,

on Thu 1/31/2008 10:37 AM Alexander 'Leo' Bergolth wrote:
I just gave your new linux mmap patch a try

thanks for the review :-)

*) There is a typo in the macro RING_GET_FRAME(h) (handle instead of h).
The attached patch fixes that.

Your patch looks good to me. I hope that Guy Harris or some other may apply it. 
BTW it's funny that the current cvs works regardless of the typo :-)

*) If pcap_loop is called with cnt=0 (ngrep erroneously does that), it
will busy-loop forever. pcap_read_linux_mmap doesn't handle that case,
it returns 0, which is asymmetric to pcap_read_linux's behavior, which
reads one packet.

I think there is a little confusion about the 'cnt' parameter. According to man page a value of 0 should cause no 
packet to be read, but into pcap_loop a value of '0' is handled like negative values (i.e. loop forever). If the 
behavior described into the man page is the preferred one, than also your second patch looks correct to me (but it can 
break application which 'misused' the pcap API using a value of cnt == 0 to loop forever).

Paolo

--------------------------------------------------------------------

CONFIDENTIALITY NOTICE

This message and its attachments are addressed solely to the persons above and may contain confidential information. If 
you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it 
immediately to the sender and delete the message. Should you have any questions, please contact us by replying to 
webmaster () telecomitalia it.

        Thank you

                                        www.telecomitalia.it

--------------------------------------------------------------------
                        

<<winmail.dat>>

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

Current thread: