Repository navigation
fix(ipv6): IPv6 core headers rebuild byte-exactly (#1230, #1231, #1236, #1235) - #1307
Conversation
#1235) - IPv6_Ext: record the raw Hdr Ext Len octet, the declared next header and the header body (`len`, `declared_next`, `data`), and re-emit them, so a rebuild is byte-exact, an overrun included. `make()` gains `data=`. - IPv6: a layer with no `next` (253/254, or a beholder `Raw`) is no longer recorded in `__exthdr__`; its octets are decoded once, as the upper layer. - IPv6_Route: `make(data=<bytes>)` unpacks the bytes into the routing type's schema, or raises ProtocolError when they do not parse. - IPv6_Frag `Res` bits and the RPL routing header's 20 reserved bits are named `reserved` and carried through info and `make()`. Closes #1230 Closes #1231 Closes #1236 Refs #1235
|
Cross-review verdict on
|
|
Coverage: 88.90% (unit tier, Python 3.14,
Per-file detail: the |
|
The red mark is the #1306 mirror fault, not this PR. From the log: Re-running the job. |
make pylint,make mypy,make isort) — run on the 9 changed source files with the Makefile flags; no new pylint/mypy findings against base, isort cleanmake testpasses, and a test case covers the change — per-module only, listed belowWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #1230
Closes #1231
Closes #1236
Refs #1235 (IPv6-Frag
Resbits and RPL routing reserved bits only; HOPOPT/IPv6-Opts sites are another worker's)IPv6_Extinfo now recordslen,declared_nextanddata(body), and_make_datare-emits them. Before → after:3b00010203040506→3b00/ exact;3b00(overrun) →00ff/3b00; IPv6 next=140 48 → 42 / 48 octets.nextis no longer recorded in__exthdr__. IPv6 next=253/254: 48 → 56 / 48 octets; chainIPv6:Raw:Raw→IPv6:Raw.datais unpacked into the type's schema (orProtocolError). Types 0/2/3/4/5:AttributeError→ builds3b02<t>00+20×00.3b00000712345678→…0112…/ exact; RPL route reserved0xabcde→0/ kept.Contract changes: new required data fields
IPv6_Ext.{declared_next,len,data},IPv6_Frag.reserved,RPL.reserved; schema dictsIPv6_Frag.flags/RPL.padnow need areservedkey; newmake()keywordsIPv6_Ext(data=),IPv6_Frag(reserved=), RPLreserved=. For 253/254,info.protocolis the code (wasNone), and the chain's last layer is named after it.Tests: new
tests/protocols/internet/test_ipv6_core_roundtrip_unit.py, 7 passed; all 7 fail with the source fix reverted. Updated tests that pinned the old behaviour:test_ipv6_ext_unit.py(253 walk) andtest_ipv6_extension_unit.py(schema dicts and data models gainreserved; bytes route data). Also passing:test_ipv6_extension_unit61,test_ipv6_ext_unit30,test_option_roundtrip_unit, the ipv6/ah/mh/esp/reassembly/toolkit modules, andtests/project(all green once isort was fixed).util/run_unittest_leg.py protocols/internet: 510 tests, 0 failures. All 247 IPv6 frames inexamples/captures/*rebuild byte-exactly.