aboutsummaryrefslogtreecommitdiff
path: root/plugin/backend_lookup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/backend_lookup.go')
-rw-r--r--plugin/backend_lookup.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go
index 096cf806b..9e5c9eeec 100644
--- a/plugin/backend_lookup.go
+++ b/plugin/backend_lookup.go
@@ -372,6 +372,8 @@ func NS(ctx context.Context, b ServiceBackend, zone string, state request.Reques
// ... and reset
state.Req.Question[0].Name = old
+ seen := map[string]bool{}
+
for _, serv := range services {
what, ip := serv.HostType()
switch what {
@@ -380,8 +382,13 @@ func NS(ctx context.Context, b ServiceBackend, zone string, state request.Reques
case dns.TypeA, dns.TypeAAAA:
serv.Host = msg.Domain(serv.Key)
- records = append(records, serv.NewNS(state.QName()))
extra = append(extra, newAddress(serv, serv.Host, ip, what))
+ ns := serv.NewNS(state.QName())
+ if _, ok := seen[ns.Ns]; ok {
+ continue
+ }
+ seen[ns.Ns] = true
+ records = append(records, ns)
}
}
return records, extra, nil