Skip to content

fix: parse IPv6 extension headers in quoted error payloads (LAN-144) - #114

Merged
lance0 merged 2 commits into
masterfrom
fix/ipv6-ext-headers
Jul 6, 2026
Merged

lance0 merged 2 commits into
masterfrom
fix/ipv6-ext-headers

Conversation

@lance0

@lance0 lance0 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes ICMPv6 error payload correlation when the quoted IPv6 packet contains extension headers (LAN-144).

Problem

ICMPv6 error messages (Time Exceeded, Dest Unreachable, Packet Too Big) quote the original IPv6 packet. If the quoted packet has extension headers (Hop-by-Hop, Routing, Dest Options), the transport header (ICMPv6/UDP/TCP) starts after byte 40, not at it.

The parser sliced at a fixed 40-byte offset, mis-aligning the transport header and mis-correlating probes from routers that add extension headers.

Fix

New helper skip_ipv6_ext_headers_quoted walks extension headers in the quoted IPv6 data and returns (transport_offset, final_next_header). Both the active DGRAM path (parse_icmp_error_payload_v6_dgram) and the raw-socket path (parse_icmp_error_payload_v6_with_mtu) use it.

Fragment headers and unsupported protocols (ESP, AH) are rejected.

Testing

  • All 580 tests pass (including 3 new)
  • cargo clippy --all-targets -- -D warnings clean
  • New tests:
    • test_parse_time_exceeded_v6_with_ext_headers — Hop-by-Hop ext header before ICMPv6 Echo Request
    • test_parse_time_exceeded_v6_with_routing_ext_header — Routing ext header
    • test_parse_v6_error_quoted_fragment_rejected — Fragment ext header rejected

Closes LAN-144.

lance0 added 2 commits July 6, 2026 10:42
ICMPv6 error messages (Time Exceeded, Dest Unreachable, Packet Too Big)
quote the original IPv6 packet that triggered the error. If the quoted
packet contains extension headers (Hop-by-Hop, Routing, Dest Options),
the transport header (ICMPv6/UDP/TCP) starts after byte 40, not at it.

Previously, parse_icmp_error_payload_v6_dgram and the raw-socket
parse_icmp_error_payload_v6_with_mtu sliced at a fixed 40-byte offset,
mis-aligning the transport header and mis-correlating probes.

New helper skip_ipv6_ext_headers_quoted walks extension headers in the
quoted IPv6 data and returns (transport_offset, final_next_header).
Fragment headers and unsupported protocols (ESP, AH) are rejected.

Fixes both the active DGRAM path and the raw-socket path.

Closes LAN-144.
@lance0
lance0 force-pushed the fix/ipv6-ext-headers branch from 3a32df7 to 0e47665 Compare July 6, 2026 14:42
@lance0
lance0 merged commit 44a6f56 into master Jul 6, 2026
5 checks passed
@lance0
lance0 deleted the fix/ipv6-ext-headers branch July 6, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant