From e1af3034c71a54af7fb0ec55ab84e368e89bfe76 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Sun, 13 May 2018 08:31:34 -0400 Subject: [PATCH] Fix #362: convertzone produces deprecated NAMESERVER entries (#363) --- cmd/convertzone/main.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/convertzone/main.go b/cmd/convertzone/main.go index bf91e43f4..445c0e1c2 100644 --- a/cmd/convertzone/main.go +++ b/cmd/convertzone/main.go @@ -186,9 +186,17 @@ func rrFormat(zonename string, filename string, recs []dns.RR, defaultTTL uint32 target = strings.Replace(target, " ", "\t", 1) } + var ttlop string + if hdr.Ttl == defaultTTL { + ttlop = "" + } else { + ttlop = fmt.Sprintf(", TTL(%d)", hdr.Ttl) + } + // NS records at the apex should be NAMESERVER() records. if hdr.Rrtype == dns.TypeNS && name == "@" { - typeStr = "NAMESERVER" + fmt.Printf(",\n\tNAMESERVER('%s'%s)", target, ttlop) + continue } if !dsl { // TSV format: @@ -209,12 +217,7 @@ func rrFormat(zonename string, filename string, recs []dns.RR, defaultTTL uint32 default: target = "'" + target + "'" } - if hdr.Ttl == defaultTTL { - ttl = "" - } else { - ttl = fmt.Sprintf(", TTL(%d)", hdr.Ttl) - } - fmt.Printf(",\n\t%s('%s', %s%s)", typeStr, name, target, ttl) + fmt.Printf(",\n\t%s('%s', %s%s)", typeStr, name, target, ttlop) } }