Skip to content

Commit

Permalink
trigger more name_server errors in more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Apr 28, 2020
1 parent c5cc03b commit 8d8d814
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions crates/resolver/src/name_server/name_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,25 @@ impl<C: DnsHandle, P: ConnectionProvider<Conn = C>> NameServer<C, P> {
// TODO: there are probably other return codes from the server we may want to
// retry on. We may also want to evaluate NoError responses that lack records as errors as well
if self.options.distrust_nx_responses {
if let ResponseCode::ServFail = response.response_code() {
let note = "Nameserver responded with SERVFAIL";
debug!("{}", note);
return Err(ProtoError::from(note));
match response.response_code() {
ResponseCode::ServFail => {
let note = "Nameserver responded with SERVFAIL";
debug!("{}", note);
return Err(ProtoError::from(note));
}
ResponseCode::NXDomain => {
dbg!(&response.response_code());
let note = "Nameserver responded with NXDomain";
debug!("{}", note);
return Err(ProtoError::from(note));
}
ResponseCode::NoError if response.answers().is_empty() => {
dbg!(&response.response_code());
let note = "Nameserver responded with NoError";
debug!("{}", note);
return Err(ProtoError::from(note));
}
_ => (),
}
}

Expand Down

0 comments on commit 8d8d814

Please sign in to comment.