aboutsummaryrefslogtreecommitdiff
path: root/middleware/file/file.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-04-06 22:29:33 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2016-04-06 22:29:33 +0100
commit225cdd1ca387b409c07269db44100643fccb620c (patch)
tree3e6de7528a1238535d1ef04736b68387de57c816 /middleware/file/file.go
parentb9a6518bb04cf994f1dcef2ee1103c3044964086 (diff)
downloadcoredns-225cdd1ca387b409c07269db44100643fccb620c.tar.gz
coredns-225cdd1ca387b409c07269db44100643fccb620c.tar.zst
coredns-225cdd1ca387b409c07269db44100643fccb620c.zip
Add AXFR test
Test shouldTransfer by upping a testserver and sending the SOA query. Remove state from DefaultErrorHandler and just get it from the request. Add more logging to show what is going on. This also adds the infrastructure for future tests.
Diffstat (limited to 'middleware/file/file.go')
-rw-r--r--middleware/file/file.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/middleware/file/file.go b/middleware/file/file.go
index 7ec690f3c..fcb1ce6e2 100644
--- a/middleware/file/file.go
+++ b/middleware/file/file.go
@@ -47,11 +47,16 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
m.Authoritative, m.RecursionAvailable, m.Compress = true, true, true
w.WriteMsg(m)
- if ok, _ := z.shouldTransfer(); ok {
- log.Printf("[INFO] Valid notify from %s for %s: initiating transfer", state.IP(), zone)
+ log.Printf("[INFO] Notify from %s for %s: checking transfer", state.IP(), zone)
+ ok, err := z.shouldTransfer()
+ if ok {
z.TransferIn()
+ } else {
+ log.Printf("[INFO] Notify from %s for %s: no serial increase seen", state.IP(), zone)
+ }
+ if err != nil {
+ log.Printf("[WARNING] Notify from %s for %s: failed primary check: %s", state.IP(), zone, err)
}
-
return dns.RcodeSuccess, nil
}
log.Printf("[INFO] Dropping notify from %s for %s", state.IP(), zone)