Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 102810
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: tlhackque [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: UPDATE add overrides ttl of zero
The cannonical: $update = Net::DNS::Update->new( $zone, 'IN' ); $update->push( update => rr_add( "$host $ttl $type $address" ) ); $reply = $res->send( $update ); results in a ttl of 86400 when $ttl is explicitly specified as zero. This is not intuitive. The code that does this appears to be in Net::DNS.pm sub rr_add { my $rr = new Net::DNS::RR(shift); $rr->{ttl} ||= 86400; return $rr; } I can't think of a good reason for this. 0 may not be a wise choice for TTL (it's supposed to mean 'don't cache this'), but forcing it to a day is also not wise. The caller said "don't cache", and Net::DNS says "OK, I'll cache for a day". I'd prefer to see: $rr->{ttl} = 86400 unless( defined $rr->{ttl} ); or something along those lines. Is there some history behind the current code that explains why it's forcing a day? BTW, there are use cases for 0 - e.g. when a wireless hotspot gives out false answers to get 'google.com' to go to their login page. Or when one is debugging, er, CAA and really, really doesn't want corrupt records cached :-)
From: rwfranks [...] acm.org
On Mon Mar 16 17:17:36 2015, tlhackque wrote: Show quoted text
> The cannonical: > $update = Net::DNS::Update->new( $zone, 'IN' ); > $update->push( update => rr_add( "$host $ttl $type $address" ) ); > $reply = $res->send( $update ); > > results in a ttl of 86400 when $ttl is explicitly specified as zero. > > This is not intuitive.
and very obviously incorrect. Show quoted text
> I'd prefer to see: > $rr->{ttl} = 86400 unless( defined $rr->{ttl} );
agree The code has moved about, but the bug was present in 0.12!!