Skip to content

fix(ipx): stop dispatching IPX payloads through the IP protocol registry (#2169) - #2187

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2169-ipx-next-layer
Oct 25, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2169-ipx-next-layer

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — corrects a defect

Description

Closes #2169.

  • Defect: IPX inherited Internet.__proto__, which is keyed by IP protocol number. Its Packet Type was therefore looked up as one: type 17 parsed as UDP, 4 as IPv4, 6 as TCP. Type 0 also counted towards EXTENSION_HEADER_LIMIT as a Hop-by-Hop header.
  • Fix:
    • IPX keeps its own __proto__, keyed by Packet Type and falling back to Raw, as Loopback does for its address family. IPX.register(Packet.X, …) works through the inherited register.
    • _next_exthdr_depth returns 0.
    • IPX.protocol is annotated Enum_Packet.
    • ipx.rst documents __proto__.
  • Behaviour change: an IPX payload is Raw unless an IPX-native protocol is registered. It used to be mis-dissected as whatever IP protocol shared the number.
  • Test: tests/protocols/internet/test_ipx_next_layer_2169_unit.py. Without the fix it fails 6 tests, e.g. UDP is not Raw.
  • Tests run: the IPX, round-trip, short-read, dispatch and registry tests pass, as do the docstring contract, tier guard, public API and docs xref tests. The IPX round trips stay byte-exact.

…try (#2169)

IPX.read handed the IPX Packet Type to the next-layer lookup inherited
from Internet, keyed by IP protocol number, so Packet Type 17 parsed as
UDP, 4 as IPv4 and 6 as TCP, and Packet Type 0 counted towards
EXTENSION_HEADER_LIMIT as a Hop-by-Hop Options header.

IPX keeps a __proto__ of its own, keyed by Packet Type and falling back
to Raw, as Loopback does for its address family; _next_exthdr_depth
returns 0; IPX.protocol is annotated Enum_Packet.

Test: test_ipx_next_layer_2169_unit covers the three collisions with a
byte-exact rebuild, a registered IPX-native protocol, Packet Type 0 at
an extension-header limit of 0, and the annotation.
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 25, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at e97b5e90b (Sonnet): 6 fail on main, IPX.__proto__ is its own table with no leak into Internet's, the IPX round trips stay byte-exact, and .protocol's runtime value is unchanged. Not breaking: only mis-parses change.

@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 25, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 25, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at e97b5e90b. Merging closes #2169.

  • Review: Sonnet GOOD TO GO.
  • CI: Required checks passed SUCCESS, 0 failed. Only the board's Sync Status is still open.
  • KTLO: 12 legs, no warnings.
  • Ordering: protocols/internet leg merged into main: 725 tests, 0 failures.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.55% (unit tier, Python 3.15, e97b5e90b, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 881 2618 867 92.11%
pcapkit/corekit 2589 75 816 37 96.48%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2971 23 1036 25 98.80%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17423 219 4574 185 98.15%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 504 7 146 5 98.15%
pcapkit/vendor 4432 1988 1018 167 51.87%

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

@JarryShaw
JarryShaw merged commit 7b4419e into main Oct 25, 2026
67 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 25, 2026
@JarryShaw
JarryShaw deleted the fix/2169-ipx-next-layer branch October 25, 2026 14:47
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 25, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(ipx): the next layer is chosen by IPX Packet Type, looked up as an IP protocol number

1 participant