[ldns-users] ldns & TTL

Willem Toorop willem at nlnetlabs.nl
Thu Nov 25 10:04:29 UTC 2021


Andreas,

Printing TTLs unsigned is fixed in:

	https://github.com/NLnetLabs/ldns/commit/42b57cb1

The commit does not error on TTLs larger than 4294967295 but simply
wraps around.  It would be a less trivial patch to error on TTLs larger
than 4294967295, which I'd like to give more attention that 1 day before
release allows :).  If it is necessary to error on that at all anyway,
because... garbage in == garbage out?  WDYT?

Cheers,
-- Willem

Op 24-11-2021 om 17:05 schreef Willem Toorop via ldns-users:
> Hi Andreas,
> 
> Op 24-11-2021 om 16:54 schreef A. Schulze via ldns-users:
>> Hello,
>>
>> in a discussion about valid TTL values I noted unexpected output while feeding different TTL into ldns-read-zone.
>>
>> To reproduce use something like this:
>> TTL=$( echo 'value' | bc ); echo "foo $TTL TXT \"TTL=$TTL\"" | ldns-read-zone 
>>
>> value       output
>> ------------------------------------------------------------------
>> 2^31 - 1    foo.    2147483647      IN      TXT     "TTL=2147483647"
>> 2^31        foo.    -2147483648     IN      TXT     "TTL=2147483648"
>> 2^31 + 1    foo.    -2147483647     IN      TXT     "TTL=2147483649"
>>
>> 2^32 - 1    foo.    -1              IN      TXT     "TTL=4294967295"
>> 2^32        foo.    0               IN      TXT     "TTL=4294967296"
>> 2^32 + 1    foo.    1               IN      TXT     "TTL=4294967297"
>>
>> RFC 1035 define a TTL as "positive values of a signed 32 bit number"
>> which mean to me, anything larger then 2^31 - 1 is invalid.
> 
> There has been an errata (in 2012) changing this to an unsigned 32 bit
> number: https://www.rfc-editor.org/errata/eid2130
> 
> So ldns is printing it wrong! I'll fix that.
> Just in time for the 1.8.0 release!
> 
> Thanks,
> -- Willem
> 
> 
>>
>> Could the readers please clarify about
>>  - the maximum value per RFC
>>  - whether these output of ldns-read-zone is correct
>>
>> Btw: I used ldns-1.8.0-rc.2
>>
>> Thanks,
>> Andreas
>>
>>
>> _______________________________________________
>> ldns-users mailing list
>> ldns-users at lists.nlnetlabs.nl
>> https://lists.nlnetlabs.nl/mailman/listinfo/ldns-users
>>
> _______________________________________________
> ldns-users mailing list
> ldns-users at lists.nlnetlabs.nl
> https://lists.nlnetlabs.nl/mailman/listinfo/ldns-users
> 


More information about the ldns-users mailing list