[plugin/route53]: Do not return NXDOMAIN where it should be NODATA. (#2734)

* [plugin/route53]: Do not return NXDOMAIN where it should be NODATA.

Signed-off-by: Dmitry Ilyevskiy <dmitry.ilyevskiy@getcruise.com>

* Fix bad merge.

Signed-off-by: Dmitry Ilyevskiy <dmitry.ilyevskiy@getcruise.com>
This commit is contained in:
dilyevsky
2019-03-31 10:12:33 -07:00
committed by Yong Tang
parent db34c10589
commit 1e150674c5
2 changed files with 62 additions and 45 deletions

View File

@@ -119,12 +119,15 @@ func (h *Route53) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
h.zMu.RLock()
m.Answer, m.Ns, m.Extra, result = hostedZone.z.Lookup(ctx, state, qname)
h.zMu.RUnlock()
if len(m.Answer) != 0 {
// Take the answer if it's non-empty OR if there is another
// record type exists for this name (NODATA).
if len(m.Answer) != 0 || result == file.NoData {
break
}
}
if len(m.Answer) == 0 && h.Fall.Through(qname) {
if len(m.Answer) == 0 && result != file.NoData && h.Fall.Through(qname) {
return plugin.NextOrFailure(h.Name(), h.Next, ctx, w, r)
}