From 2336c6a4bd17b8fa0b59bfc8d85c2f0ff5f51fd5 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 2 Sep 2015 16:12:22 +0200 Subject: [PATCH] No NXDOMAIN when the answer is empty --- command/agent/dns.go | 1 - command/agent/dns_test.go | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/command/agent/dns.go b/command/agent/dns.go index 2356866c4..5c4a53adc 100644 --- a/command/agent/dns.go +++ b/command/agent/dns.go @@ -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 } } diff --git a/command/agent/dns_test.go b/command/agent/dns_test.go index cdd5c3609..b4d7018a2 100644 --- a/command/agent/dns_test.go +++ b/command/agent/dns_test.go @@ -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) @@ -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) + } + }