Repository navigation
fix(dumpkit): a PCAP trace writes the octets it has, not a truncated record's claimed length (#1541) - #1543
Merged
Conversation
…record's claimed length (#1541) PCAPIO._append_value copied frame_info.incl_len into the trace record header. A PCAP record whose incl_len runs past the end of its file, or a PCAP-NG block whose captured length runs past the block (#1405), is kept as captured: the declared length stays in frame_info and the packet is the octets present. The trace then claimed octets it did not hold. It now writes len(packet) as incl_len. The PCAP Frame reader also warns on such a record, as the PCAP-NG reader does, and still keeps it as captured, so parse -> rebuild is byte-exact. Closes #1541
Contributor
|
Coverage: 90.09% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Verdict: GOOD TO GO at
Not blocking:
|
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
Both readers keep a short record as captured. That covers a PCAP record whose
incl_lenruns past EOF, and a PCAP-NG block whose captured length runs past the block (#1405). The declared length stays inframe_info/cap_len, andpacketholds the octets that are actually there.PCAPIO._append_valuecopied that declared length into the trace. It now writeslen(packet), so every trace record holds exactlyincl_lenoctets. A record held whole is written byte-for-byte as before.Frame.readnow warns, in the same wording as the PCAP-NG reader. Until now, parsing such a record raised no warning at all. Parse then rebuild was already byte-exact, from bothinfoandto_dict(), and stays so./tmp/r1511/badlen.pcapthe trace record now readsincl_len 0x249(585) and ends at EOF.KNOWN_FAILURESrows change, and no sample capture holds a truncated record.The two new
*_1541_unit.pymodules fail onmain: 6 of 8 tests, with every subtest failing. Ran one at a time, all green:tests/dumpkit,tests/protocols/misc,tests/foundation/traceflow, the fivetests/protocols/test_*roundtrip*,tests/project,tests/test_docstring_contract.pyandtests/test_tier_guard.py.Closes #1541