Skip to content

Commit

Permalink
Merge pull request #1217 from 42wim/fix-rfc2308-part3
Browse files Browse the repository at this point in the history
No NXDOMAIN when the answer is empty
  • Loading branch information
ryanbreen committed Sep 4, 2015
2 parents 9d24405 + 2701bb5 commit 446c640
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion command/agent/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ RPC:
// If the answer is empty, return not found
if len(resp.Answer) == 0 {
d.addSOA(d.domain, resp)
resp.SetRcode(req, dns.RcodeNameError)
return
}
}
Expand Down
9 changes: 9 additions & 0 deletions command/agent/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,10 @@ func TestDNS_NonExistingLookupEmptyAorAAAA(t *testing.T) {
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
m.SetQuestion("webv6.service.consul.", dns.TypeA)

Expand All @@ -2081,4 +2085,9 @@ func TestDNS_NonExistingLookupEmptyAorAAAA(t *testing.T) {
if soaRec.Hdr.Ttl != 0 {
t.Fatalf("Bad: %#v", in.Ns[0])
}

if in.Rcode != dns.RcodeSuccess {
t.Fatalf("Bad: %#v", in)
}

}

0 comments on commit 446c640

Please sign in to comment.