dns-zonefile
dns-zonefile copied to clipboard
Parsing issue with Bind zonefiles
We experienced a weird parsing issue with a normally OK bind zonefile.
The parser expects a SOA record right after the $ORIGIN
definition, but it's not always work.
I've a following zone:
$ORIGIN .
$TTL 3600 ; 1 hour
192.168.2.1 IN A 192.168.2.1
router.domain.com A 192.168.2.1
mydomain.com SOA ns.domain.com. hostmaster.domain.com. (
26 ; serial
900 ; refresh (15 minutes)
600 ; retry (10 minutes)
86400 ; expire (1 day)
3600 ; minimum (1 hour)
)
And it works totally fine with Bind but DNS::Zonefile fails to parse it.
The current zone parsing rule (https://github.com/craigw/dns-zonefile/blob/master/lib/dns/zonefile.treetop#L3) requires a non-optional SOA resource record (RR) to appear after one or more optional variables, space_or_break, or comment non-terminal symbols. I'd like to fix this as well, and I'm in the code now working on support for TTL and class reordering, so I'll see if I can find a way to allow the SOA RR to appear anywhere other RR can.
I was not able to figure out yet how to do away with the separate soa definition that needs to be the first record in a zone. I may be able to come back to it in the future though, so I'll leave this open.