diff options
author | 2020-05-11 16:51:02 +0200 | |
---|---|---|
committer | 2020-05-11 07:51:02 -0700 | |
commit | 7aaed71b92cbdddfbc13ddc6ce618bb083502c42 (patch) | |
tree | 43c325298c2b3a5f54b61d7dbddd54a98dd6ace1 /plugin/file/lookup.go | |
parent | 886cdd9dd361310e1e99861ece5bcac1a59f8367 (diff) | |
download | coredns-7aaed71b92cbdddfbc13ddc6ce618bb083502c42.tar.gz coredns-7aaed71b92cbdddfbc13ddc6ce618bb083502c42.tar.zst coredns-7aaed71b92cbdddfbc13ddc6ce618bb083502c42.zip |
Fix query for SOA record for delegated zone (#3875)
Addresses a bug in the file plugin where SOA queries to zone delegations are
inappropriately returned the SOA for the delegating zone, and not a downward
referral to the delegated zone.
Here is an example of what I believe the expected downward referral in response
to a SOA query for a delegated zone should be (note that no SOA record is
returned):
~~~
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @k.root-servers.net. miek.nl. SOA
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58381
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 7
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;miek.nl. IN SOA
;; AUTHORITY SECTION:
nl. 172800 IN NS ns1.dns.nl.
nl. 172800 IN NS ns2.dns.nl.
nl. 172800 IN NS ns3.dns.nl.
;; ADDITIONAL SECTION:
ns1.dns.nl. 172800 IN A 194.0.28.53
ns2.dns.nl. 172800 IN A 194.146.106.42
ns3.dns.nl. 172800 IN A 194.0.25.24
ns1.dns.nl. 172800 IN AAAA 2001:678:2c:0:194:0:28:53
ns2.dns.nl. 172800 IN AAAA 2001:67c:1010:10::53
ns3.dns.nl. 172800 IN AAAA 2001:678:20::24
~~~
See #3852 for the original fix.
Modified clouddns/route53 and removed the faulty tests there.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/file/lookup.go')
-rw-r--r-- | plugin/file/lookup.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index 3d8d899df..28da3d4d0 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -44,13 +44,15 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string) return nil, nil, nil, ServerFailure } - if qtype == dns.TypeSOA { - return ap.soa(do), ap.ns(do), nil, Success - } - if qtype == dns.TypeNS && qname == z.origin { - nsrrs := ap.ns(do) - glue := tr.Glue(nsrrs, do) // technically this isn't glue - return nsrrs, nil, glue, Success + if qname == z.origin { + switch qtype { + case dns.TypeSOA: + return ap.soa(do), ap.ns(do), nil, Success + case dns.TypeNS: + nsrrs := ap.ns(do) + glue := tr.Glue(nsrrs, do) // technically this isn't glue + return nsrrs, nil, glue, Success + } } var ( |