Skip to content

feat(internet)!: dissect Neighbor Discovery in ICMPv6 (#2934) - #3142

Merged
JarryShaw merged 1 commit into
developfrom
feat/2934-icmpv6-ndp
Nov 27, 2026
Merged

JarryShaw merged 1 commit into
developfrom
feat/2934-icmpv6-ndp

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Please follow the guide below

  • Put an x into every box [ ] that applies to your pull request (like this: [x])

  • Use the Preview tab to see how your pull request will look

  • Searched for similar pull requests

  • Followed the coding style (make pylint, make mypy, make isort)

  • make test passes, and a test case covers the change

  • Described the user-visible change below and left its changelog entry to the maintainer, keeping docs/source/changelog/ and CHANGELOG.md out of the diff, if the change is user-visible: N/A — centralised

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect

  • feat — adds a feature

  • perf — changes performance, not behaviour

  • refactor — changes neither behaviour nor performance

  • test — tests only

  • docs — documentation only

  • ci — workflows or build tooling

  • release — bumps the version or rolls up a distribution

  • chore — anything else

  • Also tick if it regenerates constant or registry tables, members keeping their numeric values (the const label)


Description of your pull request and other information

ICMPv6 decodes Neighbor Discovery types 133–137 (RFC 4861 §4) into their own schemas and data models, with flags as IANA's RA and PIO flag registries assign them.

Their options go through a new ICMPv6.__option__, with register_icmpv6_option and the icmpv6-nd-option family: RFC 4861's five (§4.6), Route Information (RFC 4191), RDNSS and DNSSL (RFC 8106), RA Flags Extension (RFC 5175), Captive-Portal (RFC 8910), PREF64 (RFC 8781), Advertisement Interval and Home Agent Information (RFC 6275), and Nonce (RFC 3971). Every other type keeps its octets. A Length of zero, or one a layout does not fill, is refused.

New crawled enums: NDOption (IANA ND option formats) and RouterPreference (RFC 4191 §2.1).

DNSSL reuses DNS's name codec, so read_name, make_name, name_to_text and text_to_labels move to pcapkit.corekit.schema.domain_name and POINTER_LIMIT to pcapkit.corekit.const.domain_name, with no re-export: the old paths, shipped in 1.7.0 through 1.8.1, carry versionremoved:: 1.9.0.

Every message and option round-trips byte-exact, whole and cut at every octet, on its own and behind IPv6. tests/protocols/internet/test_icmpv6_nd_2934_unit.py fails on an origin/develop export.

Closes #2934

@JarryShaw JarryShaw added feat Pull requests that add a new capability (feat: subject prefix) breaking Breaks public-facing behaviour or API (apply alongside the type label) review: running A cross-review is in flight against the current head - no verdict yet needs: decision Waiting on the maintainer to decide — not blocked by other work labels Nov 27, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.9 milestone Nov 27, 2026
@JarryShaw JarryShaw changed the title feat(internet): dissect Neighbor Discovery in ICMPv6 (#2934) feat(internet)!: dissect Neighbor Discovery in ICMPv6 (#2934) Nov 27, 2026
@JarryShaw JarryShaw linked an issue Nov 27, 2026 that may be closed by this pull request
@JarryShaw

Copy link
Copy Markdown
Owner Author

This needs your decision: where DNS's name codec should live. To decode RFC 8106's DNS Search List option, this PR moves read_name, make_name, name_to_text and text_to_labels from dns.schema, and POINTER_LIMIT from dns.const, into pcapkit.corekit. It does so under the 2+-readers ruling, with no re-export and with versionremoved:: 1.9.0 on the old paths. Those paths shipped in 1.7.0 and 1.8.0, so the move is breaking. #2805's plan had #2934 as non-breaking, and it put this extraction in #2959 (DHCP, 1.10).

I've gone ahead with (A): the title now has ! and the PR is labelled breaking. A Sonnet review is running.

@JarryShaw
JarryShaw force-pushed the feat/2934-icmpv6-ndp branch from 1b6ee7c to be1c32b Compare November 27, 2026 08:44
@JarryShaw JarryShaw moved this to Needs decision in PyPCAPKit Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review verdict: needs changes at be1c32b4b (tree as reviewed at 1b6ee7c2e), from a cross-review on Sonnet.

  1. RDNSS and DNSSL minimum lengths. An RDNSS option with Length 1 and no addresses parses and rebuilds. RFC 8106 §5.1 sets the minimum at 3, and its receiver checks require Length ≥ 3 with (Length − 1) % 2 == 0 for RDNSS, and Length ≥ 2 for DNSSL. Refuse both below their minimums, as the other malformed options are refused, and add tests for it.
  2. Test comment. The comment above the new SHIPPED rows in test_no_moved_name_re_exports_1744_unit.py is wrong. The five names shipped in 1.7.0 through 1.8.1, and both moved in 1.9.0. My decision note above also left out 1.8.1.

Confirmed:

  • Five messages built by hand match RFC 4861, 5175, 4191, 6275, 3971, 8106, 8910 and 8781.
  • Round trips are byte-exact, whole and cut, and a 20,000-case fuzz found no mismatch.
  • Malformed options are kept as Raw, quietly.
  • The codec move leaves no copy and no re-export.
  • The crawlers regenerate unchanged from live IANA data.
  • tests/project and tests/protocols/internet pass (3571).

The fix goes to the original worker, and CI on this head is cancelled. The codec decision above stays open.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: running A cross-review is in flight against the current head - no verdict yet labels Nov 27, 2026
@JarryShaw
JarryShaw force-pushed the feat/2934-icmpv6-ndp branch from be1c32b to e988aa5 Compare November 27, 2026 09:12
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Re-review verdict: good to go at e988aa5c5, from a delta re-review on Sonnet.

  • RDNSS and DNSSL lengths: RDNSS now refuses a Length below 3 or an even Length, and DNSSL a Length below 2, as RFC 8106 §5.3.1 requires. On its own the whole message refuses; behind IPv6 it stays Raw and logs nothing. The makers refuse to build either option.
  • Tests: the new tests fail on the old tree, 8 subtests in all. The option generator's families are unaffected. tests/protocols/internet and tests/project pass, 3572 in all.
  • SHIPPED comment: it now reads 1.7.0 through 1.8.1.

The codec decision above is still open. Merging this takes option (A).

@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 Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Coverage: 94.78% (unit tier, Python 3.15, 9b196e21e, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 108 4 20 2 95.31%
pcapkit/const 21881 214 3114 187 98.32%
pcapkit/corekit 3160 83 1058 40 96.85%
pcapkit/dumpkit 423 3 148 5 98.60%
pcapkit/foundation 3930 24 1256 26 99.04%
pcapkit/interface 103 4 34 3 94.89%
pcapkit/protocols 26825 158 7022 129 99.14%
pcapkit/toolkit 994 26 356 8 96.74%
pcapkit/utilities 591 7 162 5 98.41%
pcapkit/vendor 6284 2361 1424 247 59.13%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at e988aa5c5. The verdict is good to go and every required check is green. The KTLO legs carry no annotations, and only GraalPy (experimental, non-blocking) is still running. Merging it takes option (A) above: the codec moves to pcapkit.corekit as a breaking change.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Take recommendations

@JarryShaw

Copy link
Copy Markdown
Owner Author

Taking the recommendation: option (A). DNS's name codec moves to pcapkit.corekit in this PR. The move is breaking, so the title carries ! and the PR is labelled breaking. The old dns.schema and dns.const paths have no re-export and carry versionremoved:: 1.9.0. When #2959 (DHCP, 1.10) arrives, it reuses the shared codec instead of extracting it. I'll note that on #2959 once this merges. The PR is ready to merge at e988aa5c5.

@JarryShaw JarryShaw removed the needs: decision Waiting on the maintainer to decide — not blocked by other work label Nov 27, 2026
@JarryShaw JarryShaw moved this from Needs decision to In review in PyPCAPKit Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

maybe rename domainname to domain_name or dns?

@JarryShaw

Copy link
Copy Markdown
Owner Author

This needs your decision: the module name domainname (for pcapkit.corekit.schema.domainname and pcapkit.corekit.const.domainname).

  • (A) Keep domainname. corekit joins multi-word module names with no underscore: ipheader, tcpheader, extlen, shortread, byteorder, infoclass, protochain. Recommended, for consistency.
  • (B) domain_name. This reads better, but it would be the only underscored module in corekit.
  • (C) dns. This is short, but corekit.schema.dns reads as DNS's own schema, which already lives in protocols.application.dns. The codec is also shared with ICMPv6's DNSSL, and later with DHCP and NetBIOS.

I'm keeping (A), so the PR stays as it is. If you pick (B), it's a rename plus the versionremoved targets, done in this PR before it merges.

@JarryShaw JarryShaw added the needs: decision Waiting on the maintainer to decide — not blocked by other work label Nov 27, 2026
@JarryShaw JarryShaw moved this from In review to Needs decision in PyPCAPKit Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

im considering (B) and rename others who should follow this convention.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Taking (B). This PR now names the modules pcapkit.corekit.schema.domain_name and pcapkit.corekit.const.domain_name. The imports, the versionremoved targets on the old DNS paths, the docs and the tests all move with them. The worker is renaming them now, and I'll check the delta when it lands. The other modules that should follow this convention are tracked in #3153. That issue surveys every multi-word module name and posts a list with a recommendation for each, because each rename is breaking and gets no re-export.

@JarryShaw JarryShaw added review: pending No verdict for the current head - never reviewed, or the head moved since the last one and removed review: good-to-go Cross-review at the current head says ready; CI state is separate needs: decision Waiting on the maintainer to decide — not blocked by other work labels Nov 27, 2026
ICMPv6 decoded MLD but kept Neighbor Discovery, types 133 to 137 (RFC 4861
section 4), and their options as raw message bodies.

* Decode the five messages and, through a new ICMPv6.__option__ map with
  register_icmpv6_option and the icmpv6-nd-option family, the options of
  RFC 4861 section 4.6, RFC 4191, 8106, 5175, 8910, 8781, 6275 and 3971.
  Any other option keeps its octets.
* Crawl IANA's ND option registry into NDOption, and RFC 4191's preference
  values into RouterPreference.
* Move DNS's name codec, which the DNSSL option reads too, to
  pcapkit.corekit.schema.domainname, and POINTER_LIMIT to
  pcapkit.corekit.const.domainname, with no re-export.

Every message and option round-trips byte-exact, whole and cut at every
octet; tests/project and the affected protocol suites pass.
@JarryShaw JarryShaw moved this from Needs decision to In review in PyPCAPKit Nov 27, 2026
@JarryShaw
JarryShaw force-pushed the feat/2934-icmpv6-ndp branch from e988aa5 to 9b196e2 Compare November 27, 2026 16:52
@JarryShaw

Copy link
Copy Markdown
Owner Author

I checked the delta at 9b196e21e: good to go. The commit renames the two modules to pcapkit.corekit.schema.domain_name and pcapkit.corekit.const.domain_name, together with their docs pages. Every import and versionremoved target is updated, and git grep -i domainname on the head finds nothing. The rebase onto develop 974e1f48b applied with no conflicts. The worker's runs pass: tests/protocols/internet 1129, the top-level tests/protocols/*.py 737, tests/project 2494 and the root suites 266. I also updated the PR body to the new names.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Nov 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

any other modules should be renamed to follow this convention? we can still use joined module names if it's something common, like ipaddress, byteorder, etc.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Yes, four. shortread, extlen, ipheader and tcpheader gain underscores in their own PR once this one merges. Each old path gets versionremoved:: 1.9.0, with no re-export. Under your rule, byteorder and multidict stay as common joined names. The full list, including three borderline keeps, is on #3153.

@JarryShaw
JarryShaw merged commit bf51208 into develop Nov 27, 2026
73 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 27, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 27, 2026
@JarryShaw
JarryShaw deleted the feat/2934-icmpv6-ndp branch November 27, 2026 22:11
JarryShaw added a commit that referenced this pull request Nov 27, 2026
…ores (#3153)

Four corekit modules joined their words, where the ruling in review of
#3142 separates them with underscores unless the joined name is a
common one.

* Rename pcapkit.corekit.schema.shortread to short_read and extlen to
  ext_len, and pcapkit.corekit.const.ipheader to ip_header and tcpheader
  to tcp_header, with their docs pages and the ext_len test module. No
  alias stays at the old paths.
* Update every import and reference in pcapkit, tests and docs; the
  changelogs keep the names they shipped with.
* Each module and its page record versionchanged and versionremoved
  1.9.0 for its old path, and the moved-module checks of
  test_no_moved_name_re_exports_1744_unit cover the four.
* utilities-or-corekit.rst gains the rule and the names it keeps:
  byteorder, multidict, infoclass, protochain and traceflow, mirrors of
  standard-library and third-party modules, protocol packages, and the
  generated const and vendor modules.

Closes #3153

BREAKING CHANGE: pcapkit.corekit.schema.shortread,
pcapkit.corekit.schema.extlen, pcapkit.corekit.const.ipheader and
pcapkit.corekit.const.tcpheader no longer import; use
pcapkit.corekit.schema.short_read, pcapkit.corekit.schema.ext_len,
pcapkit.corekit.const.ip_header and pcapkit.corekit.const.tcp_header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks public-facing behaviour or API (apply alongside the type label) feat Pull requests that add a new capability (feat: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(internet)!: dissect Neighbor Discovery in ICMPv6

1 participant