Skip to main content

parse_icmp

Function parse_icmp 

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

Parse ICMP ping packets into a Reply result. Filters out spoofed packets and only parses ICMP echo replies valid for the current measurement.

§Arguments

  • packet_bytes - the bytes of the packet to parse
  • m_id - the ID of the current measurement
  • is_traceroute - handle echo reply as traceroute target reply
  • meta - received packet metadata (source address, TTL, kernel receive time)

§Returns

  • Option<Reply> - the received ping reply, None if invalid

§Remarks

The function returns None if the packet is not an ICMP echo reply or if the packet is too short to contain the necessary information.