tcpdump mailing list archives

Re: Setting the Buffer Size Without Restarting the NIC?


From: Guy Harris <guy () alum mit edu>
Date: Thu, 6 Feb 2014 11:35:36 -0800


On Feb 6, 2014, at 8:13 AM, Michal Sekletar <msekleta () redhat com> wrote:

Activated refers to pcap_t handle. Before you can do capture on the device
you have to have handle and after that capture parameters are set and finally
handle is marked as activated. So it doesn't refer to status of the device in
OS.

Yes.

With pcap_open_live(), there is a fixed set of parameters that can be specified - promiscuous mode, snapshot length, 
and buffering timeout.

Paolo Abeni added support for the memory-mapped capture mode, and wanted the ability to configure the ring buffer size 
from the program.  I wanted one to configure the capture buffer size for other platforms as well; there was already one 
in WinPcap for Windows, but that was a call you make after pcap_open_live(), and that wouldn't work for BPF on *BSD/OS 
X.

I also wanted the ability to add new parameters in the future, rather than just having a 
pcap_open_live_with_buffer_size() call that just added the buffer size, with a new open call having to be added for 
each new parameter.

After some discussion on tcpdump-workers, we came up with a scheme where:

        you create a handle for a device with pcap_create();

        you make calls to routines to set various parameters, handing them that handle;

        when you've set all the parameters, you call pcap_activate() to "activate" the handle, opening the device with 
the specified parameters.
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: