Repository navigation
fix(pcapng): rebuilt blocks keep their lengths and padding (#1276, #1279, #1280, #1282, #1283, #1284) - #1373
Merged
Merged
Conversation
, #1280, #1282, #1283, #1284) - String options count UTF-8 octets, not characters, in Option Length. - The Decryption Secrets Block pads its secrets data; Secrets Length stays unpadded, and the ZigBee NWK/APS secrets no longer count the block padding. - The systemd Journal Export Block zero-pads its entry to 32 bits. - EPB, PB, SPB and PCAP records cut a packet longer than the captured length (snaplen) instead of writing it whole; a snaplen of zero means no limit. - A custom option shorter than its 4-octet PEN raises ProtocolError.
Merged
3 of 5 tasks
This was referenced Oct 7, 2026
Closed
Owner
Author
|
Cross-review verdict on
Follow-ups filed (pre-existing or edge, not blocking): #1384 — an SPB longer than snaplen is silently truncated on parse; #1385 — a PCAP frame built with snaplen 0 writes no data. A DSB whose Secrets Length counted the padding (20) rebuilds as 18 — pcapng-06 is silent on which writers do. |
Contributor
|
Coverage: 88.98% (unit tier, Python 3.14,
Per-file detail: the |
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.
isort --check-onlyflags these files onorigin/maintoomake testpasses, and a test case covers the change — the modules below, not the full suiteWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #1276
Closes #1279
Closes #1280
Closes #1282
Closes #1283
Closes #1284
Spec claims checked against draft-ietf-opsawg-pcapng-06 (and draft-richardson-opsawg-pcapng-extras-01 for #1280).
opt_commentérebuilds01000100 c300000001000200 c3a90000, byte-exactinvalid length: 23invalid length: 26padding_dataad0b0300 61626300parses aspen=6513249ProtocolError: [opt_custom] invalid lengthChanges beyond the issue text:
captured_lento 0. Without this change, the new data clipping would empty those packets.test_pcapng_unit.py:2206pinned the unpadded journal entryb'raw'. It now expectsb'raw\x00'.EXPECTED_FAILURES: bothpcapng-secrets/*entries are deleted.ZigBeeNWKKey/ZigBeeAPSKeyschemas lose theirpaddingfield. A custom option with length < 4 now raises.The new tests are in
tests/protocols/misc/test_pcapng_roundtrip2_unit.py. Withorigin/main's three source files written back over the fix, it reports10 failed, 1 passed(every test fails) and the option round-trip reports2 failed. With the fix, it reports8 passed, 3 subtests passed.All 165 blocks of the six
examples/captures/*.pcapngfixtures rebuild byte-exactly, except the big-endian SHB (#1272, in the follow-up PR). Test results:test_pcapng_unit97 passedtest_pcapng_roundtrip_unit8 passedtest_option_roundtrip_unit6 passed / 362 subteststest_pcapng_regression11 passedtest_pcapng_end_to_end6 passedrun_unittest_leg.py protocols --exclude protocols/internet: 929 tests, 0 failurestests/project: 389 passedtest_runtime_engines.py::test_pcap_run_writes_global_header…fails identically onorigin/main, so this PR does not cause it.