diff options
author | 2017-07-31 10:48:50 -0700 | |
---|---|---|
committer | 2017-07-31 10:48:50 -0700 | |
commit | 78db9fbb1068a683a07c12c097160f952f46237c (patch) | |
tree | 5ba391e8250de3dba731de63a6ef33f40b013265 | |
parent | ea0a7d007620e7c1a99b3a9b198f660e4056f105 (diff) | |
download | coredns-78db9fbb1068a683a07c12c097160f952f46237c.tar.gz coredns-78db9fbb1068a683a07c12c097160f952f46237c.tar.zst coredns-78db9fbb1068a683a07c12c097160f952f46237c.zip |
middleware/backend: send proper reponse on NODATA (#804)
SOA would blindly add "." + zone, which when using the root
zone would create a unparseable packet with "name.."
-rw-r--r-- | middleware/backend_lookup.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/middleware/backend_lookup.go b/middleware/backend_lookup.go index 3d67ef375..7621851c9 100644 --- a/middleware/backend_lookup.go +++ b/middleware/backend_lookup.go @@ -380,16 +380,22 @@ func NS(b ServiceBackend, zone string, state request.Request, opt Options) (reco func SOA(b ServiceBackend, zone string, state request.Request, opt Options) ([]dns.RR, []msg.Service, error) { header := dns.RR_Header{Name: zone, Rrtype: dns.TypeSOA, Ttl: 300, Class: dns.ClassINET} + Mbox := hostmaster + "." + Ns := "ns.dns." + if zone[0] != '.' { + Mbox += zone + Ns += zone + } + soa := &dns.SOA{Hdr: header, - Mbox: hostmaster + "." + zone, - Ns: "ns.dns." + zone, + Mbox: Mbox, + Ns: Ns, Serial: uint32(time.Now().Unix()), Refresh: 7200, Retry: 1800, Expire: 86400, Minttl: minTTL, } - // TODO(miek): fake some msg.Service here when returning? return []dns.RR{soa}, nil, nil } |