tcpdump mailing list archives

Re: Headroom


From: Stephen Donnelly <stephen () endace com>
Date: Mon, 09 Oct 2006 09:04:02 +1300

On Fri, 2006-10-06 at 13:46 -0400, Harley Stenzel wrote:
Greetings--

Has the idea of headroom for libpcap-based stack applications been
discussed before?  The idea is to have a known amount of empty/usable
space in front of the buffer given to the application by the
pcap_dispatch callback, pcap_next(), or pcap_next_ex().

It looks like it'd be a ((pcap_t *)p)->headroom, which would be added
to p->offset and p->bufsize for malloc.

p->offset would still have to guarantee alignment for for the data,
not for the beginning of the buffer.

Headroom would have to be specified at pcap_open_live() or
pcap_open_offline() time, so it could alter the pcap_t initialization
logic. I suppose the best approach would be to make an additional
variant of those functions, so the prototype changes don't ripple to
other apps.  Possibly have it be an additional options structure,
which may be null to get the current behavior.

Any thoughts?

Wouldn't work with Endace DAG cards, as libpcap accesses memory mapped
packet buffers directly.

If this feature is accepted into libpcap there would need to be a way to
'reject' the option, perhaps via a specific function call like
pcap_setnonblock()?

Stephen.
-- 
-----------------------------------------------------------------------
    Stephen Donnelly BCMS PhD           email: sfd () endace com
    Endace Technology Ltd               phone: +64 7 839 0540
    Hamilton, New Zealand               cell:  +64 21 1104378
-----------------------------------------------------------------------

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


Current thread: