Skip to content

Snaplen requires BPF filter to be applied #201

@dmiller-nmap

Description

@dmiller-nmap

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):

  1. Set snaplen with pcap_set_snaplen()
  2. Compile any filter, even "" empty string with pcap_compile()
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions