Repository navigation
fix(protocols): PCAPNG.register restores the shipped descriptor; a zero snaplen drops SPB padding (#1504, #1558) - #1573
Merged
Conversation
…ro snaplen drops SPB padding (#1504, #1558) - PCAPNG.register shares ProtocolBase._next_layer_entry, as the other six registrars do since #1533, so handing back the shipped ModuleDescriptor stores that object, unresolved. Delete the Gap(1504) row and add PCAPNG to the #1504 per-site tests. - PCAPNG engine: _get_snaplen hands over no limit when interface 0's snaplen is 0, instead of passing the 0 through as a limit of no octets. - PCAPNG.unpack reads a zero __packet__ snaplen as no limit too, so a Simple Packet Block's padding is no longer read as packet data. - New tests for the extracted and parsed SPB, both rebuilding byte-exactly. Closes #1504 Closes #1558
This was referenced Oct 10, 2026
Owner
Author
|
Verdict: GOOD TO GO at
Not this PR's: a truncated SPB (snaplen 10, original length 57) emits |
Contributor
|
Coverage: 89.64% (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.
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) — Makefile flags on the changed modules, no new findingsmake testpasses, and a test case covers the change — narrow selections only, not the full suiteAdded 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
PCAPNG.register(pcapkit/protocols/misc/pcapng.py:1021-1035) resolved a descriptor before storing it. It now sharesProtocolBase._next_layer_entry, as the other six registrars do since fix(protocols): restoring a registration puts back the shipped ModuleDescriptor (#1504) #1533. TheGap(1504)row is deleted, andPCAPNGjoins the fix(protocols): restoring a protocol registration puts back the class, not the shipped ModuleDescriptor #1504 per-site tests.snaplenof 0 through as__packet__['snaplen'](pcapkit/foundation/engines/pcapng.py:209,:413-414)._spb_data_lengththen read it as a limit of no octets and took the whole block body, padding included._get_snaplennow hands over no limit, andPCAPNG.unpackreads a zero snaplen handed in as no limit too. The new tests checkcaptured_len/packet= 57 for snaplen 0 and 65535, and a byte-exact rebuild from bothinfoandinfo.to_dict().pcapkit/foundation/engines/dpkt.py.Closes #1504
Closes #1558