pub(crate) fn attach_dns_filter(
socket: &Socket,
sport: u16,
dns_identifier: u8,
is_ipv6: bool,
) -> Result<()>Expand description
Attach a filter to a raw UDP socket so the kernel only delivers DNS replies
destined to sport whose DNS transaction ID carries our 6-bit identifier,
dropping all other UDP traffic (e.g. the host’s own DNS resolution).
§Arguments
socket- the raw UDP socket to attach the filter tosport- the worker’s source port (DNS replies carry it as their dport)dns_identifier- the 6-bit DNS identifier encoded in outgoing queriesis_ipv6- whether this is an IPv6 socket