aboutsummaryrefslogtreecommitdiff
path: root/middleware/file/file.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-04-04 15:45:17 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2016-04-04 15:45:17 +0100
commit6445a3f2f019bd951ffc02b5ec86d73157f512c2 (patch)
tree412eb10f7ea2bd27a3592bd3ea6c4a3ce5b177e4 /middleware/file/file.go
parent45ac2dd0c007901ad7557c1f703bf3da87b26b45 (diff)
downloadcoredns-6445a3f2f019bd951ffc02b5ec86d73157f512c2.tar.gz
coredns-6445a3f2f019bd951ffc02b5ec86d73157f512c2.tar.zst
coredns-6445a3f2f019bd951ffc02b5ec86d73157f512c2.zip
Cleanup docs and the chaos middleware
Make the CH middleware actually work. Needs a bit of a hack to route the fake version.bind and friends zone to the correct handler. Fiddle with the order in directive.go so that CH queries get logged as well. Secondly add class rewriting to the rewrite middleware handler and also log the class by default.
Diffstat (limited to 'middleware/file/file.go')
-rw-r--r--middleware/file/file.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/middleware/file/file.go b/middleware/file/file.go
index caf0c5fbc..a647f9d12 100644
--- a/middleware/file/file.go
+++ b/middleware/file/file.go
@@ -1,6 +1,7 @@
package file
import (
+ "fmt"
"io"
"log"
@@ -24,6 +25,10 @@ type (
func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
state := middleware.State{W: w, Req: r}
+ if state.QClass() != dns.ClassINET {
+ return dns.RcodeServerFailure, fmt.Errorf("file: can only deal with ClassINET")
+ }
+
qname := state.Name()
zone := middleware.Zones(f.Zones.Names).Matches(qname)
if zone == "" {