fn validate_nameserver_response(
question: &Question,
response: &Message,
current_match_count: usize,
) -> Option<NameserverResponse>
Expand description
Validate a nameserver response against the question by only keeping valid RRs:
-
RRs matching the query domain (or the name it ends up being after following
CNAME
s) and type (orCNAME
) -
NS
RRs for a superdomain of the query domain (if it matches better than our current nameservers). -
A
RRs corresponding to a selectedNS
RR
Then, decide whether:
-
This is an answer: it has a possibly-empty sequence of CNAME RRs and a record of the right type at the final name.
-
This is a cname to follow: it has a non-empty sequence of CNAME RRs but no final record of the right type.
-
This is a delegation to other nameservers: there’s at least one NS RR.
This makes the simplifying assumption that the question message has a single question in it, because that is how this function is used by this module. If that assumption does not hold, a valid answer may be reported as invalid.