Skip to content

PcapFileWriter does not actually write nanosecond precision files if used with Winpcap backend. #1975

@Dimi1010

Description

@Dimi1010

The latest Winpcap release does not support nanosecond precision pcap files, due to being based on libpcap 1.0.x. Nanosecond precision was added in 1.5.x+.

The currently used tests to confirm functionality are flawed, due to not using a static nanosecond pcap file to compare to, but instead writing a new one and reading from it.

The PcapFileWriter implementation is flawed, due to providing little feedback if a nanosecond precision file is requested, but the runtime does not support it. Only an error message is provided, while the error makes the writer unusable for the requested purpose.

If used it instead silently falls back on using pcap_open_dead which will use the default precision.

Fix recommendation:

  • Add static nanoseconds pcap file to be tested and compared against.
  • Convert the error message in PcapFileWriterDevice's constructor to an exception to fail loudly at construction, as the constructed device instance is ill-formed with respect to its construction parameters otherwise.

Originally posted by @Dimi1010 in #1962 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions