aboutsummaryrefslogtreecommitdiff
path: root/plugin/loop/loop.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/loop/loop.go')
-rw-r--r--plugin/loop/loop.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugin/loop/loop.go b/plugin/loop/loop.go
index 45bdc4267..8d29798ad 100644
--- a/plugin/loop/loop.go
+++ b/plugin/loop/loop.go
@@ -19,6 +19,7 @@ type Loop struct {
zone string
qname string
+ addr string
sync.RWMutex
i int
@@ -49,7 +50,7 @@ func (l *Loop) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
}
if l.seen() > 2 {
- log.Fatalf("Forwarding loop detected in \"%s\" zone. Exiting. See https://coredns.io/plugins/loop#troubleshooting. Probe query: \"HINFO %s\".", l.zone, l.qname)
+ log.Fatalf(`Loop (%s -> %s) detected for zone %q, see https://coredns.io/plugins/loop#troubleshooting. Query: "HINFO %s"`, state.RemoteAddr(), l.address(), l.zone, l.qname)
}
return plugin.NextOrFailure(l.Name(), l.Next, ctx, w, r)
@@ -94,3 +95,15 @@ func (l *Loop) disabled() bool {
defer l.RUnlock()
return l.off
}
+
+func (l *Loop) setAddress(addr string) {
+ l.Lock()
+ defer l.Unlock()
+ l.addr = addr
+}
+
+func (l *Loop) address() string {
+ l.RLock()
+ defer l.RUnlock()
+ return l.addr
+}