Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger more name_server errors in more cases #1086

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 17 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,23 @@ 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 => {
let note = "Nameserver responded with NXDomain";
debug!("{}", note);
return Err(ProtoError::from(note));
}
ResponseCode::NoError if response.answers().is_empty() => {
let note = "Nameserver responded with NoError";
debug!("{}", note);
return Err(ProtoError::from(note));
}
_ => (),
}
}

Expand Down