Repository navigation
fix(udp)!: keep the octets past the UDP Length field as captured (#1461) - #1467
Merged
Merged
Conversation
- The payload now stops at Length rather than at the end of the capture, and the octets after it are info.trailer, present only when non-empty, as IPv4/IPv6 (#1209) and IPX (#1433) do; make() accepts trailer= and writes it outside the length it declares. A Length below 8 still lets the payload take the rest, so it rebuilds exactly. - tests/protocols/transport/test_udp_trailer_kept_unit.py pins the rebuild through from_data(info) and from_data(info.to_dict()).
JarryShaw
force-pushed
the
fix/1461-udp-trailer
branch
from
October 9, 2026 03:49
81c2aee to
71b7a21
Compare
Contributor
|
Coverage: 89.56% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Verdict: GOOD TO GO at
|
3 of 5 tasks
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 pylintnot run; mypy is clean on the three UDP files; isort flags twoTransportProtocolimport lines that were already onmainand that this PR leaves as ismake testpasses, and a test case covers the change — the whole suite was not run (see below); a new test module 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
Closes #1461
UDP's payload now stops at its Length field, and the octets after it are
info.trailer(present only when non-empty), as IPv4/IPv6 (#1431), IPX (#1435) and L2TPv2/OSPF (#1460) do.make(trailer=)writes them outside the declared length.!: on a datagram with excess octets, the payload no longer includes them.Repro
0035003500080000+pp: before,from_data(info)gave 8 of 10 octets; now 10/10, throughinfoand throughinfo.to_dict(). A Length below 8, of 0, or past the data still rebuilds exactly with no trailer. pcapkit does not compute the UDP checksum, so that path is unchanged.examples/captures: per-frameinfois identical on all 1616 frames, and none gains a trailer.Tests:
tests/protocols/transport/test_udp_trailer_kept_unit.pyfails 5 cases before the fix. On94ae9664c+ this commit:protocols --exclude protocols/internetleg 1156 tests, 0 failures, 0 errors;test_capture_roundtrip_runtime.py+tests/project+ the new module 427 passed, 1 skipped.