Inherited problem from WinPcap: snaplen is implemented as a modification to BPF filter in pcap_compile(), which means that the only way to have it work is to follow this procedure (as pcap_open_live() does internally):
- Set snaplen with
pcap_set_snaplen()
- Compile any filter, even
"" empty string with pcap_compile()
- Set that BPF filter with
pcap_setfilter()
Doing this in any other order will not work.
Solution: we need to implement a snaplen set operation, probably as a new IoControl code, and expose it via the existing PacketSetSnapLen() function. Then libpcap has to call PacketSetSnapLen() in the appropriate places, which it currently only does for DAG cards. This would be fine for them to do even with backwards compatibility in mind, since on non-DAG adapters, PacketSetSnapLen() has historically been a no-op.
Inherited problem from WinPcap: snaplen is implemented as a modification to BPF filter in
pcap_compile(), which means that the only way to have it work is to follow this procedure (aspcap_open_live()does internally):pcap_set_snaplen()""empty string withpcap_compile()pcap_setfilter()Doing this in any other order will not work.
Solution: we need to implement a snaplen set operation, probably as a new IoControl code, and expose it via the existing
PacketSetSnapLen()function. Then libpcap has to callPacketSetSnapLen()in the appropriate places, which it currently only does for DAG cards. This would be fine for them to do even with backwards compatibility in mind, since on non-DAG adapters,PacketSetSnapLen()has historically been a no-op.