Skip to content

Fix MPLS parsing when ICMP lengths omit quote padding - #144

Merged
lance0 merged 2 commits into
masterfrom
fix/icmp-extension-padding
Oct 16, 2026
Merged

lance0 merged 2 commits into
masterfrom
fix/icmp-extension-padding

Conversation

@lance0

@lance0 lance0 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

A router in the capture attached to #134 advertises a 68-byte original datagram but pads it to 128 bytes before the MPLS extension. ttl previously read probe payload bytes as an extension header and displayed no MPLS labels.

Honor RFC 4884's 128-byte minimum when locating extensions, including nonzero lengths that omit padding. Longer advertised quotes retain their actual offset. The reporter's packet is embedded as a regression test and now yields label 416760, TTL 1. IPv6 padding and truncated quotes are also covered; the existing compliant-length fixture now uses a valid 160-byte quote.

Validation: cargo build --locked, cargo test --locked, cargo clippy --locked --all-targets -- -D warnings, and cargo fmt -- --check. The real-packet regression failed before the fix and passes afterward. Live router probing was not needed for this packet-decoding fix.

Refs #134.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted correction preserves bounds checks and longer offsets, with regression coverage and no unresolved findings.

0 open findings

What changed in this PR

Fixes ICMP extension offsets so MPLS labels are decoded when advertised quote lengths omit padding.

Changes:

  • Enforces the 128-byte minimum while preserving larger advertised offsets.
  • Adds captured-packet, IPv6, and truncated-quote regression tests.
  • Updates the existing explicit-length fixture to use a 160-byte quote.
File Description
src/​probe/​correlate.rs Corrects extension offsets and adds regression coverage.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

A zero length and a short non-zero length both clamp to the 128-byte
minimum, so the legacy branch is redundant.
@lance0
lance0 marked this pull request as ready for review October 16, 2026 15:40
@lance0
lance0 merged commit a46e104 into master Oct 16, 2026
6 checks passed
@lance0
lance0 deleted the fix/icmp-extension-padding branch October 16, 2026 15:40
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.

2 participants