Skip to content

fix(ipv6-opts): RPL option 0x23 raises AttributeError in _read_opt_unassigned - #1198

Merged
JarryShaw merged 1 commit into
mainfrom
fix/1196-rpl-option
Oct 7, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/1196-rpl-option

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner
  • Searched for similar pull requests

  • Followed the coding style (make pylint, make mypy, make isort) — the tools were run directly, not via make. They found nothing new: pylint E/W shows only the existing W0613/W0622, mypy reports 0 errors in the two files, isort is clean.

  • make test passes, and a test case covers the change — only the modules listed below were run.

  • Added a changelog entry — N/A, added centrally

  • fix — corrects a defect


Closes #1196. The HOPOPT and IPv6_Opts __option__ registries mapped only RPL_Option_0x63 to rpl. Type 0x23, the RFC 9008 code that the RPLOption schema already accepts, fell through to 'none'. This PR registers 0x23 in both registries and their docstring tables. The reader and maker already existed.

Probe HOPOPT(io.BytesIO(bytes.fromhex(h))) (same for IPv6_Opts):

  • before: 3b002304… and 3b00230001020000 → AttributeError: 'RPLOption' object has no attribute 'data'
  • after: 3b00230401020000 → RPLOption(type=0x23, id=2, rank=0); the zero-length 3b00230001020000 → ProtocolError: [OptNo 35] invalid format (same as 0x63)

Tests: the new tests/protocols/internet/test_rpl_option_unit.py gives 3 passed, 10 subtests. With the fix reverted it gives 6 failed (every 0x23 subtest), while the 0x63 controls pass. test_option_roundtrip_unit now generates RPL_Option_0x23 cases for both families, and they round-trip OK (6 passed, 362 subtests). No EXPECTED_FAILURES entry was involved. test_ipv6_ext_unit 30 passed, test_ipv6_extension_unit 61 passed, test_mpl_seed_rebuild_unit 4 passed, tests/project 389 passed / 1 skipped. run_unittest_leg.py protocols/internet: 498 tests, 0 failures, 0 errors.

…assigned

The HOPOPT and IPv6-Opts option registries mapped only RPL_Option_0x63
to the RPL reader and maker. Type 0x23 (the RFC 9008 code) fell through
to the unassigned handler, which read schema.data off the RPL schema.
Register 0x23 alongside 0x63 in both registries and their docstring
tables, and add tests/protocols/internet/test_rpl_option_unit.py.

Closes #1196
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 7, 2026
@JarryShaw JarryShaw added fix Pull requests that fix a defect (fix: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 7, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Cross-review verdict on c43925cd2: GOOD TO GO (Sonnet reviewed; the author ran on Opus).

  • Root cause confirmed: _read_opt_rpl and _make_opt_rpl already existed, but only 0x63 was registered to them. On main, 0x23 raises AttributeError; on this branch it parses as RPLOption.
  • 0x23 is the RFC 9008 code (act 00, chg 1). The reader decodes it as action 0 with change set, and the maker writes the 0x23 type octet back unchanged.
  • Zero-length input: 3b00230001020000 now raises ProtocolError, the same as 0x63. Four octets is the fixed minimum.
  • No other output changed: 22 captures (1579 frames) give byte-identical info digests on main and on this branch.
  • Tests: the new tests fail without the fix (6 subtests). run_unittest_leg.py protocols/internet ran 498 tests with 0 failures.
  • Pre-existing, filed as fix(ipv6-opts): RPL option drops reserved flag bits on rebuild and rejects RFC 6553 sub-TLVs #1199: reserved flag bits are dropped on rebuild (…0401… comes back as …0400…, which I re-ran), and options longer than 4 octets (RFC 6553 sub-TLVs) are rejected. Both behave the same on main for 0x63.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Coverage: 88.90% (unit tier, Python 3.14, c43925cd2, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18757 1034 2342 845 90.24%
pcapkit/corekit 1878 91 580 22 94.34%
pcapkit/dumpkit 142 0 42 0 100.00%
pcapkit/foundation 2442 102 852 39 94.38%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 15759 190 4028 165 98.18%
pcapkit/toolkit 487 65 144 1 85.42%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2359 1006 158 42.84%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit 630f0a5 into main Oct 7, 2026
41 checks passed
@JarryShaw
JarryShaw deleted the fix/1196-rpl-option branch October 7, 2026 17:01
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 7, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(ipv6-opts): RPL option 0x23 raises AttributeError in _read_opt_unassigned

1 participant