aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-12-22 08:55:35 +0000
committerGravatar GitHub <noreply@github.com> 2017-12-22 08:55:35 +0000
commitc655589fa3b33a28306fd501d3001374af60f9cd (patch)
tree2d25444d72c51532a1a68e98d81303a1a5fb733c
parent1f81d154ed0c5dbebdc3395425d2f54783da6094 (diff)
downloadcoredns-c655589fa3b33a28306fd501d3001374af60f9cd.tar.gz
coredns-c655589fa3b33a28306fd501d3001374af60f9cd.tar.zst
coredns-c655589fa3b33a28306fd501d3001374af60f9cd.zip
core: Fix no handler crash (#1328)
If you have no handlers for any zone CoreDNS would crash, this is very *uncommon*, because it makes your server a bit unusable. Example config: ~~~ . { #forward . tls://9.9.9.9 8.8.8.8 { # health_check 5s # tls_servername dns.quad9.net #} pprof debug } ~~~ It this does nothing and doesn't setup you plugin chain because pprof and debug don't handle queries
-rw-r--r--core/dnsserver/server.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go
index 6fe26e7dc..83c9c6168 100644
--- a/core/dnsserver/server.go
+++ b/core/dnsserver/server.go
@@ -255,7 +255,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
}
}
- if r.Question[0].Qtype == dns.TypeDS && dshandler != nil {
+ if r.Question[0].Qtype == dns.TypeDS && dshandler != nil && dshandler.pluginChain != nil {
// DS request, and we found a zone, use the handler for the query.
rcode, _ := dshandler.pluginChain.ServeDNS(ctx, w, r)
if !plugin.ClientWrite(rcode) {
@@ -265,7 +265,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
}
// Wildcard match, if we have found nothing try the root zone as a last resort.
- if h, ok := s.zones["."]; ok {
+ if h, ok := s.zones["."]; ok && h.pluginChain != nil {
rcode, _ := h.pluginChain.ServeDNS(ctx, w, r)
if !plugin.ClientWrite(rcode) {
DefaultErrorFunc(w, r, rcode)