mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
plugin/hosts: Modifies NODATA handling (#3536)
* Modifies NODATA handling Signed-off-by: ykhr53 <ykhr53@yokohei.com> * fix some comments Signed-off-by: ykhr53 <ykhr53@yokohei.com> * fix test code to take care NODATA Signed-off-by: ykhr53 <ykhr53@yokohei.com> * add if statement to avoid nil pointer Signed-off-by: ykhr53 <ykhr53@yokohei.com> * Modifies NODATA handling Signed-off-by: ykhr53 <ykhr53@yokohei.com> * fix some comments Signed-off-by: ykhr53 <ykhr53@yokohei.com> * fix test code to take care NODATA Signed-off-by: ykhr53 <ykhr53@yokohei.com> * add if statement to avoid nil pointer Signed-off-by: ykhr53 <ykhr53@yokohei.com>
This commit is contained in:
@@ -52,15 +52,15 @@ func (h Hosts) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||
answers = aaaa(qname, h.options.ttl, ips)
|
||||
}
|
||||
|
||||
if len(answers) == 0 {
|
||||
// Only on NXDOMAIN we will fallthrough.
|
||||
if len(answers) == 0 && !h.otherRecordsExist(qname) {
|
||||
if h.Fall.Through(qname) {
|
||||
return plugin.NextOrFailure(h.Name(), h.Next, ctx, w, r)
|
||||
}
|
||||
// We want to send an NXDOMAIN, but because of /etc/hosts' setup we don't have a SOA, so we make it REFUSED
|
||||
|
||||
// We want to send an NXDOMAIN, but because of /etc/hosts' setup we don't have a SOA, so we make it SERVFAIL
|
||||
// to at least give an answer back to signals we're having problems resolving this.
|
||||
if !h.otherRecordsExist(qname) {
|
||||
return dns.RcodeServerFailure, nil
|
||||
}
|
||||
return dns.RcodeServerFailure, nil
|
||||
}
|
||||
|
||||
m := new(dns.Msg)
|
||||
|
||||
Reference in New Issue
Block a user