Repository navigation
fix(ipv6): keep the extension-header chain in from_data rebuilds (#1177) - #1182
Merged
Merged
Conversation
IPv6._make_data rebuilt the payload from the upper layer alone, so every extension header between the IPv6 header and that layer was dropped: a 48-octet packet with an 8-octet Routing header rebuilt as 40 octets. _decode_next_layer now records the chain in wire order as a hidden __exthdr__ info key (parser class, info), excluded from to_dict and iteration like __next_type__. The per-header keys cannot carry it, since a repeated header overwrites its predecessor's key. _make_data re-emits each header ahead of the upper-layer payload. Adds tests/protocols/internet/test_ipv6_from_data_ext_unit.py.
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.89% (unit tier, Python 3.14,
Per-file detail: the |
4 of 5 tasks
Owner
Author
4 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.
pylint/mypy/isorton the two source files: no new findings (the 4 mypy, isort and pylint hits are on untouched lines and also onmain);maketargets not runmake testpasses, and a test case covers the change — per-module only, listed belowWhat is the purpose of your pull request?
fix— corrects a defectCloses #1177.
_decode_next_layernow records the chain in wire order as a hidden__exthdr__key ((parser class, info)pairs, excluded like__next_type__);_make_datare-emits it ahead of the upper layer. The per-header keys (route,opts, ...) can't carry it, because a repeated header overwrites its key.Probe: Routing (
3b00000000000000): 48 → 40 before, 48 → 48 after; with 4 trailing octets 52 → 44 before, 52 → 52 after.Capture sweep (1609 frames, non-exact): 183 → 51.
IPv6>MH99 → 0,IPv6_Route3 → 0,IPv6_Frag4 → 0,HOPOPT14 → 1,IPv6_Opts14 → 1,HIP49 → 49; no frame regressed. The 51 now raise in the extension classes' ownfrom_data(also onmainstandalone):HIP.aliasreads_infobefore it is set (49), and_make_opt_mplcallsbit_length()on anIPv6Addressinhopopt.py/ipv6_opts.py(2). Out of scope here.Tests: new
test_ipv6_from_data_ext_unit.py(HOPOPT, Routing, Dest Opts, MH, a 4-header chain with a repeated Dest Opts): 7 failed without the fix, 3 passed / 6 subtests with it.test_ipv6_unit,test_ipv6_extension_unit/_runtime,test_ipv6_ext_unit,test_mh_unit,test_hip_unit,test_option_roundtrip_unitall pass;tests/project389 passed, 1 skipped;run_unittest_leg.py protocols/internet475 tests, 0 failures.