Skip to main content

parse_dns

Function parse_dns 

Source
pub fn parse_dns(
    packet_bytes: &[u8],
    meta: ReplyMeta,
    ctx: &DnsContext,
) -> Option<Reply>
Expand description

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

§Arguments

  • packet_bytes - the bytes of the packet to parse
  • meta - received packet metadata (source address, TTL, kernel receive time)
  • ctx - per-measurement DNS context (sport, m_id, is_chaos)

§Returns

  • Option<Reply> - the received DNS reply (None if invalid)