Skip to main content

parse_trace

Function parse_trace 

Source
pub fn parse_trace(
    packet_bytes: &[u8],
    m_id: u32,
    meta: ReplyMeta,
) -> Option<Reply>
Expand description

Parse ICMP Time Exceeded (and Destination Unreachable) packets into a trace Reply.

Supports traceroute probes sent via ICMP, UDP, or TCP. The original protocol is detected from the IP header embedded in the Time Exceeded payload, and probe identification is decoded accordingly:

  • ICMP: identifier (worker_hi + timestamp) + sequence (TTL + worker_lo)
  • UDP (Paris): IP identification / IPv6 flow label (worker_hi + timestamp) + UDP checksum (TTL + worker_lo)
  • TCP: seq number (worker_id + TTL + timestamp)

Falls back to parse_icmp for Echo Reply packets (destination reached in ICMP traceroute).

§Arguments

  • packet_bytes - the bytes of the packet to parse (excluding the Ethernet header)
  • m_id - measurement ID encoded in ICMP payload.
  • meta - received packet metadata (hop address, TTL, kernel receive time)

§Returns

  • Option<Reply> - the received trace reply (None if not a valid trace response)