Skip to content

fix(ipv6): _read_ip_hextet slices include the version nibble - #1109

Merged
JarryShaw merged 1 commit into
mainfrom
fix/1094-ipv6-read-ip-hextet
Oct 6, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/1094-ipv6-read-ip-hextet

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner
  • 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
  • Added a changelog entry under docs/source/changelog/ and regenerated CHANGELOG.md, if the change is user-visible — N/A, added centrally after the wave

What is the purpose of your pull request?

  • fix — corrects a defect

Description of your pull request and other information

Closes #1094. IPv6._read_ip_hextet read the traffic class from hex[0:2] and the flow label from hex[2:], so both included the version nibble. It now reads them from hex[1:3] and hex[3:]. The parser has used the schema since 45ebc600d, so the helper's only caller is a test, and that test pinned the wrong values. I fixed the method rather than deleting it because it is a method on a public class. The bug was first reported in #389 and was never filed.

Probe (6abcdef0): before (6, 0x6a, 0xbcdef0), after (6, 0xab, 0xcdef0).

Tests: I corrected the pinned values at test_ipv6_unit.py:131. The new module test_ipv6_read_ip_hextet_unit.py checks the issue's bytes, and also checks the helper against the bytes that IPv6.make(...).pack() produces.

  • With the fix reverted: new module 2 failed, test_ipv6_unit.py 1 failed, 9 passed.
  • With the fix: 2 passed and 10 passed, 5 subtests passed. tests/project: 379 passed, 1 skipped, 1285 subtests passed.
  • Style: I ran pylint, mypy and isort on ipv6.py. None of their findings are on the edited lines. Every finding is in code this PR does not change.

The traffic class was read from hex[0:2] and the flow label from hex[2:],
so both included the version nibble. Read them from hex[1:3] and hex[3:].

Correct the pinned values in test_ipv6_unit.py, and add
test_ipv6_read_ip_hextet_unit.py, which also checks the helper against
the schema's own packing.

Closes #1094
@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 6, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Cross-review verdict on e5cdc74ac: GOOD TO GO (reviewed on Sonnet; authored on Opus)

  • Fix: the slices now follow RFC 8200: version at nibble 0, traffic class at [1:3], flow label at [3:]. A probe gives 6abcdef0 → (6, 0xab, 0xcdef0), plus three other asymmetric patterns.
  • Return shape: unchanged, a 3-tuple of int.
  • Independent check: the make().pack() test uses the schema's bit-field packer, not the slicing code under test.
  • Fails without the fix: with ipv6.py taken from the base commit, the new module fails 2 and test_ipv6_unit fails 1. With the fix, both pass.
  • Callers: there are none outside the two tests.

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

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Coverage: 88.74% (unit tier, Python 3.14, e5cdc74ac, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18757 1035 2342 846 90.23%
pcapkit/corekit 1874 91 578 22 94.33%
pcapkit/dumpkit 136 0 40 0 100.00%
pcapkit/foundation 2422 143 842 34 92.62%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 15653 187 3942 162 98.19%
pcapkit/toolkit 487 71 144 3 84.15%
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 7cc49e5 into main Oct 6, 2026
41 checks passed
@JarryShaw
JarryShaw deleted the fix/1094-ipv6-read-ip-hextet branch October 6, 2026 20:29
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 6, 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): _read_ip_hextet slices include the version nibble

1 participant