No NXDOMAIN when the answer is empty

This commit is contained in:
Wim 2015-09-02 16:12:22 +02:00
parent 80d26f9156
commit 2701bb5cc2
2 changed files with 9 additions and 1 deletions

View File

@ -532,7 +532,6 @@ RPC:
// If the answer is empty, return not found // If the answer is empty, return not found
if len(resp.Answer) == 0 { if len(resp.Answer) == 0 {
d.addSOA(d.domain, resp) d.addSOA(d.domain, resp)
resp.SetRcode(req, dns.RcodeNameError)
return return
} }
} }

View File

@ -2062,6 +2062,10 @@ func TestDNS_NonExistingLookupEmptyAorAAAA(t *testing.T) {
t.Fatalf("Bad: %#v", in.Ns[0]) t.Fatalf("Bad: %#v", in.Ns[0])
} }
if in.Rcode != dns.RcodeSuccess {
t.Fatalf("Bad: %#v", in)
}
// check for ipv4 records on ipv6 only service // check for ipv4 records on ipv6 only service
m.SetQuestion("webv6.service.consul.", dns.TypeA) m.SetQuestion("webv6.service.consul.", dns.TypeA)
@ -2081,4 +2085,9 @@ func TestDNS_NonExistingLookupEmptyAorAAAA(t *testing.T) {
if soaRec.Hdr.Ttl != 0 { if soaRec.Hdr.Ttl != 0 {
t.Fatalf("Bad: %#v", in.Ns[0]) t.Fatalf("Bad: %#v", in.Ns[0])
} }
if in.Rcode != dns.RcodeSuccess {
t.Fatalf("Bad: %#v", in)
}
} }