mirror of
https://github.com/golang/go.git
synced 2025-11-10 05:31:03 +00:00
net: don't require recursion be available in DNS responses
Fixes #12778 Change-Id: I2ca53180d46180b951749abe453fd560d0f1d9d6 Reviewed-on: https://go-review.googlesource.com/16950 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
a29113f609
commit
f4a9bd87ba
3 changed files with 29 additions and 2 deletions
|
|
@ -182,7 +182,11 @@ func tryOneName(cfg *dnsConfig, name string, qtype uint16) (string, []dnsRR, err
|
|||
continue
|
||||
}
|
||||
cname, rrs, err := answer(name, server, msg, qtype)
|
||||
if err == nil || msg.rcode == dnsRcodeSuccess || msg.rcode == dnsRcodeNameError && msg.recursion_available {
|
||||
// If answer errored for rcodes dnsRcodeSuccess or dnsRcodeNameError,
|
||||
// it means the response in msg was not useful and trying another
|
||||
// server probably won't help. Return now in those cases.
|
||||
// TODO: indicate this in a more obvious way, such as a field on DNSError?
|
||||
if err == nil || msg.rcode == dnsRcodeSuccess || msg.rcode == dnsRcodeNameError {
|
||||
return cname, rrs, err
|
||||
}
|
||||
lastErr = err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue