aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-01-23 10:35:31 +0000
committerGravatar GitHub <noreply@github.com> 2018-01-23 10:35:31 +0000
commit9575789c363d9fc72eb96f3263e94d2037142335 (patch)
tree152e41f0ce61ce94818ad1fc844dd01cfcaf5cb4
parent85457cf50dd45a4b3cbf9425007831ee07d34916 (diff)
downloadcoredns-9575789c363d9fc72eb96f3263e94d2037142335.tar.gz
coredns-9575789c363d9fc72eb96f3263e94d2037142335.tar.zst
coredns-9575789c363d9fc72eb96f3263e94d2037142335.zip
plugin/secondary: don't duplicate apex records (#1413)
See #1400 and the discussion in that bug. Fixes #1400
-rw-r--r--plugin/file/secondary.go2
-rw-r--r--plugin/file/zone.go10
2 files changed, 11 insertions, 1 deletions
diff --git a/plugin/file/secondary.go b/plugin/file/secondary.go
index 83887c9ed..0d8f70069 100644
--- a/plugin/file/secondary.go
+++ b/plugin/file/secondary.go
@@ -16,7 +16,7 @@ func (z *Zone) TransferIn() error {
m := new(dns.Msg)
m.SetAxfr(z.origin)
- z1 := z.Copy()
+ z1 := z.CopyWithoutApex()
var (
Err error
tr string
diff --git a/plugin/file/zone.go b/plugin/file/zone.go
index 1cef9dc3a..540c65f0b 100644
--- a/plugin/file/zone.go
+++ b/plugin/file/zone.go
@@ -67,6 +67,16 @@ func (z *Zone) Copy() *Zone {
return z1
}
+// CopyWithoutApex copies zone z without the Apex records.
+func (z *Zone) CopyWithoutApex() *Zone {
+ z1 := NewZone(z.origin, z.file)
+ z1.TransferTo = z.TransferTo
+ z1.TransferFrom = z.TransferFrom
+ z1.Expired = z.Expired
+
+ return z1
+}
+
// Insert inserts r into z.
func (z *Zone) Insert(r dns.RR) error {
r.Header().Name = strings.ToLower(r.Header().Name)