Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nanosecond precision in pcap files #3185

Open
stevenengler opened this issue Sep 27, 2023 · 0 comments
Open

Support nanosecond precision in pcap files #3185

stevenengler opened this issue Sep 27, 2023 · 0 comments
Labels
Status: Help Wanted Well suited for community contributions Type: Enhancement New functionality or improved design

Comments

@stevenengler
Copy link
Contributor

Normal pcap files have microsecond precision, and this is what Shadow outputs:

// timestamp (seconds): 4 bytes
self.writer.write_all(&ts_sec.to_ne_bytes())?;
// timestamp (microseconds): 4 bytes
self.writer.write_all(&ts_usec.to_ne_bytes())?;

There is an official pcap variant that stores nanosecond precision. This would be nice for Shadow since Shadow events occur at nanosecond precision. We'd also want to verify it works with Wireshark, but that shouldn't be a problem.

The one official variant of the pcap format is a version that supports nanosecond-precision time stamps. Libpcap 1.5.0 and later can read files in that format; older versions of libpcap, and all current versions of WinPcap, cannot read it. Older versions of Wireshark cannot read it; current versions can read it and can show the full nanosecond-resolution time stamps.

The magic bytes for this format are 0xa1b23c4d (note the final two bytes). There are no changes to the file or record headers from standard libpcap, apart from the timestamp resolution.

@stevenengler stevenengler added the Type: Enhancement New functionality or improved design label Sep 27, 2023
@stevenengler stevenengler added the Status: Help Wanted Well suited for community contributions label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Help Wanted Well suited for community contributions Type: Enhancement New functionality or improved design
Projects
None yet
Development

No branches or pull requests

1 participant