Repository navigation
fix(protocols): a later IPv6 fragment's data is raw, not an upper-layer header (#1545) - #1552
Merged
Merged
Conversation
…er header (#1545) A Fragment header with a non-zero offset ended the extension header walk (#1539), but the octets after it were still dispatched on its Next Header, so a slice from the middle of a UDP or TCP datagram read as a UDP or TCP header. RFC 8200 section 4.5 puts that header in the first fragment only, so a later fragment's data is now a Raw leaf with no protocol alias. ``protocol`` still names the first fragment's upper layer, and the split that reassembly takes is unchanged.
Owner
Author
|
Verdict: GOOD TO GO at
One reviewer finding I refuted: the review asked for a test pinning the "offset unknown" guard ( Not blocking:
|
4 of 13 tasks
Contributor
|
Coverage: 90.02% (unit tier, Python 3.14,
Per-file detail: the |
This was referenced Oct 10, 2026
JarryShaw
added a commit
that referenced
this pull request
Oct 10, 2026
…er header (#1553) (#1562) A datagram with a non-zero Fragment Offset now passes no next-layer code to _decode_next_layer, so its data is a Raw leaf with no protocol name, as Wireshark shows it, instead of a bogus UDP/TCP header read from mid-datagram octets. info.protocol, the lengths and packet.payload are unchanged, so reassembly and every round trip are too. First fragments and unfragmented datagrams are still dissected. Mirrors #1552's IPv6 fix for #1545.
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
Closes #1545.
After #1540 a Fragment header with a non-zero offset ends the extension-header walk, but
IPv6._decode_next_layerstill dispatched the rest on its Next Header. Soipv6.pcapframes 14–16 read asIPv6-Frag:UDP:Rawwith garbage ports. Now no code is dispatched for a known non-zero offset, and the rest is aRawleaf with no protocol alias. Frames 14–16 readEthernet:IPv6:IPv6-Frag:Raw, which matches tshark (ipv6.fraghdr:data), and'UDP' in frameis false.protocolstill names the first fragment's upper layer, andfragment/hdr_len/raw_lenare unchanged. Reassembled datagrams over every capture underexamples/captures/are identical before and after (IPv6: one 4778-octet datagram from frames 13–16).IPv6_Extstand-in) still dispatches as before, since it is not known to be a later fragment.test_ipv6_later_fragment_raw_unit.pycovers UDP and TCP at four offsets, M set and clear, make→parse, and a first/atomic-fragment guard.test_ipv6_extension_runtime.pycovers frames 14–16; its frame-16 chain pin had encoded the bug. Round trips stay byte-exact.bytesandRaw). NoGaprows cite fix(protocols): a non-first IPv6 fragment's data is dissected as an upper-layer header #1545.