Repository navigation
fix(dumpkit): scale a PCAP trace record's fraction to the trace's resolution (#1500) - #1529
Merged
Merged
Conversation
…olution (#1500) - PCAPIO._make_timestamp: frame_info does not say which resolution its ts_usec is in, so take it from time_epoch -- the resolution at which the frame's offset into its second truncates to exactly ts_usec. Written as is at the file's own resolution (octets unchanged) or when neither fits; otherwise recomputed from time_epoch: microseconds x1000, nanoseconds /1000 truncated (as block2frame, Frame.make and libpcap do), with a fraction of a second or more carried into ts_sec. - Covers PCAP-NG input too: block2frame converts at the interface's resolution but carries the exact block timestamp, so engines/pcapng.py is unchanged. - Delete the Gap(1500) rows (32 unit cases, many_interfaces.pcapng). - tests/dumpkit/test_pcap_trace_resolution_unit.py: PCAP and PCAP-NG frames at each resolution, written and re-read through pcapkit. Closes #1500
Owner
Author
|
Verdict: GOOD TO GO at Verified:
Non-blocking:
Merge-order note: #1511 gives the dpkt and scapy engines real PCAP traces. After the second of the two merges, I will re-run a cross-resolution dpkt/scapy trace against this inference. |
Contributor
|
Coverage: 90.09% (unit tier, Python 3.14,
Per-file detail: the |
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
PCAPIOwroteframe_info.ts_usecunscaled, so a trace at the other resolution was 1000× off.frame_infodoesn't record its resolution, so the newPCAPIO._make_timestampworks it out fromtime_epoch: the fraction is in whichever resolution truncates the frame's offset into its second to exactlyts_usec.time_epoch. µs → ns is ×1000. ns → µs divides by 1000 and truncates, likeblock2frame,Frame.makeand libpcap'ssf-pcap.c, so 999,999,999 ns stays in its second. A fraction of a second or more carries intots_sec.block2frameconverts at the interface's resolution. It also keeps the exacttimestamp_epoch, though, so this fixes PCAP-NG too and leavesengines/pcapng.pyalone.Gap(1500)rows: 32 unit cases andmany_interfaces.pcapng.The new
tests/dumpkit/test_pcap_trace_resolution_unit.pyfails onmain: 12 failures, and every cross-resolution subtest fails. With the Gap rows gone, the traceflow modules fail onmaintoo, with 33 failures. Ran one at a time, all green:tests/dumpkit,tests/foundation/traceflow,tests/project,tests/test_docstring_contract.pyandtests/test_tier_guard.py.Closes #1500