tcpdump mailing list archives
Re: [PATCH]: pcap and zero copy.
From: "Gisle Vanem" <giva () bgnett no>
Date: Sun, 4 Jan 2004 13:55:21 +0100
"Yoann Vandoorselaere" <yoann () prelude-ids org> said:
here is a patch I made to libpcap, permitting zero copy by allowing the calling application to specify it's own allocation/freeing function for the packet buffer, and the pcap header.
I didn't see any patch for pcap-win32.c, but not sure it's possible with a zero-copy here. Except maybe using shared memory or overlapped I/O.
This patch was done in a way that it won't break the existing libpcap API (except for the pcap_next function, but I could simply remove the
I agree that many args should be 'const'ed, but your patch will break e.g. Ethereal that binds to libpcap functions via dynamic lib-loading and function- pointers. --- libpcap-0.7.2/pcap-int.h 2001-08-24 09:46:52.000000000 +0200 +++ libpcap/pcap-int.h 2003-10-05 23:30:22.000000000 +0200 @@ -117,6 +117,23 @@ struct pcap_timeval { bpf_int32 tv_usec; /* microseconds */ }; + + struct buffer_head { + int refcount; + unsigned char buf[0]; + }; + Not all compilers support zero-sized arrays. --gv - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- [PATCH]: pcap and zero copy. Yoann Vandoorselaere (Jan 04)
- Re: [PATCH]: pcap and zero copy. Gisle Vanem (Jan 04)
- Re: [PATCH]: pcap and zero copy. Yoann Vandoorselaere (Jan 04)
- Re: [PATCH]: pcap and zero copy. Gisle Vanem (Jan 04)
- Re: [PATCH]: pcap and zero copy. Yoann Vandoorselaere (Jan 04)
- Re: [PATCH]: pcap and zero copy. Yoann Vandoorselaere (Jan 04)
- Re: [PATCH]: pcap and zero copy. Guy Harris (Jan 05)
- Re: [PATCH]: pcap and zero copy. Guy Harris (Jan 05)
- Re: [PATCH]: pcap and zero copy. Gisle Vanem (Jan 04)
- Re: [PATCH]: pcap and zero copy. Guy Harris (Jan 05)
- Re: [PATCH]: pcap and zero copy. Yoann Vandoorselaere (Jan 05)
- Re: [PATCH]: pcap and zero copy. Michael Richardson (Jan 05)