core: block CH queries earlier (#973)

block chaos queries, unless the chaos or proxy middleware is loaded. We
respond with REFUSED.

This removes the need for each middleware to do this class != ClassINET
if-then.

Also make config.Registry non-public.
This commit is contained in:
Miek Gieben 2017-08-25 08:55:53 +01:00 committed by GitHub
parent 932639ac99
commit 55dafe6f59
8 changed files with 18 additions and 29 deletions

View file

@ -1,8 +1,6 @@
package kubernetes
import (
"errors"
"github.com/coredns/coredns/middleware"
"github.com/coredns/coredns/middleware/pkg/dnsutil"
"github.com/coredns/coredns/request"
@ -14,9 +12,6 @@ import (
// ServeDNS implements the middleware.Handler interface.
func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
state := request.Request{W: w, Req: r}
if state.QClass() != dns.ClassINET {
return dns.RcodeServerFailure, middleware.Error(k.Name(), errors.New("can only deal with ClassINET"))
}
m := new(dns.Msg)
m.SetReply(r)