Skip to content

fix(pcapng): correct flags-option length messages and IPv6 maker defaults (#2168) - #2179

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2168-pcapng-flags-msg-ipv6-defaults
Oct 25, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2168-pcapng-flags-msg-ipv6-defaults

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — corrects a defect

Description

Closes #2168.

  • Error messages: PCAPNG._read_option_epb_flags and _read_option_pack_flags reject any length other than 4, but their error said "expected 8". On main, a length-8 option gave invalid length (expected 8, got 8). Both now say "expected 4".
  • IPv6 defaults: _make_option_ns_dnsipv6 defaulted to '8.8.8.8' and _make_record_ipv6 to '127.0.0.1', so making either without an address raised FieldValueError: IP version mismatch: 4 != 6. The new defaults mirror the IPv4 ones:
    • 2001:4860:4860::8888 for the option, the IPv6 address of the same public DNS server as 8.8.8.8;
    • ::1 for the record, the IPv6 loopback.
  • Test: tests/protocols/misc/test_pcapng_flags_length_ipv6_defaults_2168_unit.py, tier ALL. It checks both messages, and builds each IPv6 record and option without an address: the parsed address is right and the rebuild is byte for byte. Without the fix it fails 4 tests, on the two messages and on the IP version mismatch twice.
  • Tests run: the PCAP-NG unit, round-trip, flags and NRB tests pass (139), as do the tier guard and the docstring contract (140).

…ults (#2168)

Problem: the epb_flags and pack_flags readers reject any length but 4, yet
their error said "expected 8". The IPv6 NRB makers defaulted to IPv4
addresses, so making an nrb_record_ipv6 record or an ns_dnsIP6addr option
without an address raised FieldValueError (IP version mismatch: 4 != 6).

Fix: both messages say "expected 4". _make_option_ns_dnsipv6 defaults to
2001:4860:4860::8888 and _make_record_ipv6 to ::1. These mirror the IPv4
makers: ns_dnsIP4addr defaults to 8.8.8.8, a public DNS server, and
2001:4860:4860::8888 is that same service's IPv6 address; the IPv4 record
defaults to the 127.0.0.1 loopback, and ::1 is the IPv6 loopback.

Test: test_pcapng_flags_length_ipv6_defaults_2168_unit pins both messages
and makes each IPv6 record and option with its default, then parses and
rebuilds it byte-exactly.
@JarryShaw JarryShaw added the bug Issues reporting a defect (set by the bug report template; a default, not an assessment) label Oct 25, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 25, 2026
@JarryShaw JarryShaw added the review: running A cross-review is in flight against the current head - no verdict yet label Oct 25, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 861e9fe58 (Sonnet): both messages match the != 4 checks, both IPv6 defaults rebuild byte-exact, 4 fail on main; no sibling default or length message is wrong.

@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

Copy link
Copy Markdown
Owner Author

Ready to merge at 861e9fe58. Merging closes #2168.

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 880 2618 866 92.12%
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 17418 219 4574 185 98.14%
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 e66291c into main Oct 25, 2026
65 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/2168-pcapng-flags-msg-ipv6-defaults branch October 25, 2026 14:21
@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(pcapng): flags-option length errors say 'expected 8', and the IPv6 NRB makers default to IPv4 addresses

1 participant