Commit 9575789c authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

plugin/secondary: don't duplicate apex records (#1413)

See #1400 and the discussion in that bug.

Fixes #1400
parent 85457cf5
...@@ -16,7 +16,7 @@ func (z *Zone) TransferIn() error { ...@@ -16,7 +16,7 @@ func (z *Zone) TransferIn() error {
m := new(dns.Msg) m := new(dns.Msg)
m.SetAxfr(z.origin) m.SetAxfr(z.origin)
z1 := z.Copy() z1 := z.CopyWithoutApex()
var ( var (
Err error Err error
tr string tr string
......
...@@ -67,6 +67,16 @@ func (z *Zone) Copy() *Zone { ...@@ -67,6 +67,16 @@ func (z *Zone) Copy() *Zone {
return z1 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. // Insert inserts r into z.
func (z *Zone) Insert(r dns.RR) error { func (z *Zone) Insert(r dns.RR) error {
r.Header().Name = strings.ToLower(r.Header().Name) r.Header().Name = strings.ToLower(r.Header().Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment