scapy icon indicating copy to clipboard operation
scapy copied to clipboard

Add way to specify snapshot length and buffer size when using pcap

Open saiarcot895 opened this issue 10 months ago • 1 comments

When using pcap and a ring buffer for receiving packets, it can be useful to specify the snapshot length and the buffer size when receiving packets. For example, if you know that you'll only want to be processing small packets, then it could be worth setting the snapshot length to be a small value. This has a benefit on systems where libpcap uses TPACKET_V2, where the number of packets that can fit in the ring buffer depends on the size of the ring buffer and the snapshot length; smaller snapshot lengths means more packets can fit there.

Similarly, if you know you might want to handle large packets, then having an option to increase the buffer size could be beneficial.

saiarcot895 avatar Mar 01 '25 08:03 saiarcot895

To add to that, if my read of TPACKET_V3 is correct, then setting the snapshot length might also be useful there, but I'm not 100% certain that this is true (setting the buffer size explicitly would be true regardless because of memory consumption).

saiarcot895 avatar Mar 05 '25 22:03 saiarcot895