mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
Add more logging
Put some more logging in CoreDNS.
This commit is contained in:
@@ -2,6 +2,7 @@ package file
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/miekg/coredns/middleware"
|
||||
|
||||
@@ -21,9 +22,12 @@ func notify(zone string, to []string) error {
|
||||
m.SetNotify(zone)
|
||||
c := new(dns.Client)
|
||||
|
||||
// TODO(miek): error handling? Run this in a goroutine?
|
||||
for _, t := range to {
|
||||
notifyAddr(c, m, t)
|
||||
if err := notifyAddr(c, m, t); err != nil {
|
||||
log.Printf("[ERROR] " + err.Error())
|
||||
} else {
|
||||
log.Printf("[INFO] Sent notify for zone %s to %s", zone, t)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -34,7 +38,6 @@ func notifyAddr(c *dns.Client, m *dns.Msg, s string) error {
|
||||
if err == nil && ret.Rcode == dns.RcodeSuccess || ret.Rcode == dns.RcodeNotImplemented {
|
||||
return nil
|
||||
}
|
||||
// timeout? mean don't want it. should stop sending as well?
|
||||
}
|
||||
return fmt.Errorf("failed to send notify for zone '%s' to '%s'", m.Question[0].Name, s)
|
||||
return fmt.Errorf("Failed to send notify for zone '%s' to '%s'", m.Question[0].Name, s)
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ Transfer:
|
||||
for _, tr := range z.TransferFrom {
|
||||
c, err := t.In(m, tr)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] failed to setup transfer %s with %s: %v", z.name, z.TransferFrom[0], err)
|
||||
log.Printf("[ERROR] Failed to setup transfer %s with %s: %v", z.name, z.TransferFrom[0], err)
|
||||
Err = err
|
||||
continue Transfer
|
||||
}
|
||||
for env := range c {
|
||||
if env.Error != nil {
|
||||
log.Printf("[ERROR] failed to parse transfer %s: %v", z.name, env.Error)
|
||||
log.Printf("[ERROR] Failed to parse transfer %s: %v", z.name, env.Error)
|
||||
Err = env.Error
|
||||
continue Transfer
|
||||
}
|
||||
@@ -44,6 +44,9 @@ Transfer:
|
||||
}
|
||||
}
|
||||
}
|
||||
if Err != nil {
|
||||
log.Printf("[ERROR] Failed to transfer %s", z.name)
|
||||
}
|
||||
return nil
|
||||
return Err // ignore errors for now. TODO(miek)
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ func (x Xfr) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (in
|
||||
return dns.RcodeServerFailure, nil
|
||||
}
|
||||
if state.QType() != dns.TypeAXFR {
|
||||
return 0, fmt.Errorf("file: xfr called with non transfer type: %d", state.QType())
|
||||
return 0, fmt.Errorf("xfr called with non transfer type: %d", state.QType())
|
||||
}
|
||||
if state.Proto() == "udp" {
|
||||
return 0, fmt.Errorf("file: xfr called with udp")
|
||||
return 0, fmt.Errorf("xfr called with udp")
|
||||
}
|
||||
|
||||
records := x.All()
|
||||
@@ -57,5 +57,4 @@ func (x Xfr) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (in
|
||||
return dns.RcodeSuccess, nil
|
||||
}
|
||||
|
||||
//const transferLength = 10e3 // Start a new envelop after message reaches this size.
|
||||
const transferLength = 100 // Start a new envelop after message reaches this size.
|
||||
const transferLength = 100 // Start a new envelop after message reaches this size. Intentionally small to test multi envelope parsing
|
||||
|
||||
@@ -38,6 +38,7 @@ func (z *Zone) TransferAllowed(state middleware.State) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// TODO(miek): future matching against IP/CIDR notations
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user