Subject: | Default TTL for non-soa records |
Date: | Thu, 9 Jan 2014 18:13:39 +0800 |
To: | bug-DNS-ZoneParse [...] rt.cpan.org |
From: | Gordon CC Yuen <gdccyuen [...] gmail.com> |
Hi,
I am not sure if this is a bug or just by design.
I found that if some of the non-soa records in original zone file did not
have TTL specified, in the output they just pick up whatever the TTL from
last record that had the TTL set.
I think a more logical behavior should be using the TTL of SOA record as
the default, rather than pick from last one set.
Moreover, if in the same program the TTL of SOA record was changed, it will
not propagate to other non-SOA records even if they all had no TTL set.
Instead, the ORIGINAL TTL value of SOA record was used as default to all
non-SOA records.
Once again, I hope the MODIFIED TTL of SOA record can be propagate to other
non-SOA records as default.
The proper way to do this would be to set MODIFIED TTL of SOA record to all
non-SOA records as default, once it had been changed, but as I am not
familiar to perl object, I only work out how to do it on output.
Here is the code change in ZoneParse.pm (v1.10):
205a206
Show quoted text
> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
212a214
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
219a222
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
225a229
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
231a236
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
237a243
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
243a250
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
249a257
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
255a264
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
261a271
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
267a278
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
275a287
Show quoted text> $o->{ttl}=$dns_soa{$self}->{ttl} if (!$o->{ttl});
947,951d958
< } else {
< if ( !defined $dns_last_ttl{$self} ) {
< die "No ttl defined!\n";
< }
< $record->{'ttl'} = $dns_last_ttl{$self};
Cheers,
Gordon