Repository navigation
fix(ipv4,ipv6)!: keep the octets past Total Length or Payload Length as captured (#1209) - #1431
Merged
Merged
Conversation
…as captured (#1209) Ethernet and the VLAN tags hand the rest of the frame to IP, which read only its own length, so the octets after it (most often minimum-frame padding) were kept by no info and dropped on rebuild: a 60-octet frame rebuilt as 42. - IPv4 and IPv6 schemas gain a trailing `trailer` payload field, which takes what the payload leaves on unpack and writes it verbatim on pack. - `read()` records it as `info.trailer` when non-empty; `make()` takes a `trailer=` keyword written outside the declared length; `_make_data` passes it through. The IP layer owns the octets because its length field is what excludes them, so the bare IP packet rebuilds exactly too, and every link carrier (Ethernet, C-Tag, Q-in-Q) follows without change.
Owner
Author
|
Verdict: GOOD TO GO at
Follow-ups:
|
This was referenced Oct 8, 2026
Contributor
|
Coverage: 89.45% (unit tier, Python 3.14,
Per-file detail: the |
This was referenced Oct 8, 2026
This was referenced Oct 9, 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.
Searched for similar pull requests
Followed the coding style — pylint/mypy/isort run on the 6 files: isort clean, mypy 4 errors same as
main, pylint only addsunused-argumenton theTYPE_CHECKING__init__stub, as every sibling argument already hasmake testpasses, and a test case covers the change — new module plusrun_unittest_leg.py protocols --exclude protocols/internet(1081 OK),protocols/internet(576 OK),tests/project(397 passed)Changelog entry — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657
fix— corrects a defectCloses #1209
IP read only its own length, so octets past it (Ethernet padding or junk) were dropped. IPv4/IPv6 now keep them as
info.trailer, present only when non-empty, andmake(trailer=...)writes them outside the declared length. Breaking: for these packets the data shape gainstrailer. IP owns the octets because its length field is what excludes them. That makes the bare packet exact too, and Ethernet, C-Tag and Q-in-Q follow unchanged.tests/protocols/link/test_link_trailer_kept_unit.py: 5 passed, 14 subtests; 12 fail without the fix.examples/captures/has no padded IP frame, so per-frame digests matchmain. Left for follow-up: IPX behind Ethernet still drops its pad (60 → 44), ininternet/ipx.py, which this PR does not own.