Skip to content

fix(ipv6): dissect a jumbogram's payload up to its Jumbo Payload Length (#1434) - #1440

Merged
JarryShaw merged 1 commit into
mainfrom
fix/1434-ipv6-jumbogram-payload
Oct 8, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/1434-ipv6-jumbogram-payload

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Closes #1434

A jumbogram (Payload Length 0, Hop-by-Hop Jumbo Payload option) read no payload. The schema now splits payload/trailer at the Jumbo Payload Length, so the payload is dissected and only octets past it are trailer. The option counts only in a Hop-by-Hop header right after the IPv6 header (RFC 8200 §4.1). Beside a non-zero Payload Length (an RFC 2675 error) the Payload Length still governs, as captured, with a ProtocolWarning. make() writes Payload Length 0 when the payload exceeds 65,535 octets. No info key is added or removed; raw_len now counts from the Jumbo length.

case (bytes) main next / trailer this PR next / trailer
jumbo = 32, exact (72; 86 in Ethernet) NoPayload / 32 UDP / —
jumbo = 32, +6 pad (78) NoPayload / 38 UDP / 6
jumbo = 16 < captured (72) NoPayload / 32 UDP / 16
jumbo = 100 > captured (72) NoPayload / 32 UDP / — (raw_len 92)
PL 32 + Jumbo option (72) UDP / — UDP / —, warns
Jumbo in non-leading HBH (80) NoPayload / 40 unchanged

Every case rebuilds byte-exact before and after. 7 of the 9 new tests fail without the fix; the other 2 pin unchanged cases. Per-frame info digests of the 1616 frames in examples/captures/ match main.

…th (#1434)

- An IPv6 jumbogram (Payload Length 0 with a Hop-by-Hop Jumbo Payload
  option, RFC 2675) read no payload, so its next layer was NoPayload and
  the whole jumbo payload landed in info.trailer. The schema now splits
  payload and trailer at the Jumbo Payload Length, and the payload is
  dissected as the next header; only octets beyond it are trailer.
- The option is honoured only in a Hop-by-Hop header immediately after the
  IPv6 header. Beside a non-zero Payload Length it is an RFC 2675 error:
  the Payload Length still governs, and a ProtocolWarning is emitted.
- make() writes Payload Length 0 when the payload exceeds 65,535 octets.

Rebuilds stay byte-exact; tests in test_ipv6_jumbogram_unit.py.
@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 8, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 2465d9642 (Sonnet cross-review; the author ran on Opus).

  • Round-trip: data == raw and Ethernet.from_data(info) are byte-exact across every probe. The probes covered:
    • Jumbo exact, shorter and longer than captured, plus Jumbo 0, 5 and 70000;
    • Jumbo with a non-zero Payload Length;
    • Jumbo in a second Hop-by-Hop header;
    • Pad1/PadN, option length 5, and truncated or over-long Hop-by-Hop headers;
    • all of these bare and inside Ethernet.
  • raw_len: past capture it reports the Jumbo extent. No caller under pcapkit/ slices by IPv6 raw_len.
  • Re-run myself: the new module gives 9 passed, and with the three source files from main it gives 7 failed, 2 passed. Jumbo 0, 5 and 8 parse as NoPayload with raw_len 0, so nothing goes negative.
  • Merged into 16c87f901: conflict-free, and the protocols/internet leg runs 592 OK. On the PR alone, tests/project gives 404 passed, and the per-frame info digests over examples/captures/ match the base.

Nits, no change needed:

  • jumbo_payload_length() accepts a Jumbo value of 65535 or less, which RFC 2675 calls an error. It uses the value silently.
  • make() with a payload over 65535 writes Payload Length 0 but inserts no Jumbo option. The bytes still round-trip, and the old code behaved the same.

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

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Coverage: 89.49% (unit tier, Python 3.14, 2465d9642, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18791 968 2352 869 90.90%
pcapkit/corekit 2043 89 636 25 94.77%
pcapkit/dumpkit 234 2 84 2 98.74%
pcapkit/foundation 2648 98 930 48 94.80%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 16711 219 4510 183 98.07%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2342 1006 157 43.25%

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

@JarryShaw
JarryShaw merged commit 7c62038 into main Oct 8, 2026
41 checks passed
@JarryShaw
JarryShaw deleted the fix/1434-ipv6-jumbogram-payload branch October 8, 2026 23:07
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 8, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 8, 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

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): a jumbogram's payload is not dissected and is reported as trailer

1 participant