Repository navigation
fix: parse IPv6 extension headers in quoted error payloads (LAN-144) - #114
Merged
Merged
Conversation
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
force-pushed
the
fix/ipv6-ext-headers
branch
from
July 6, 2026 14:42
3a32df7 to
0e47665
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_quotedwalks 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
cargo clippy --all-targets -- -D warningscleantest_parse_time_exceeded_v6_with_ext_headers— Hop-by-Hop ext header before ICMPv6 Echo Requesttest_parse_time_exceeded_v6_with_routing_ext_header— Routing ext headertest_parse_v6_error_quoted_fragment_rejected— Fragment ext header rejectedCloses LAN-144.