[ldns-users] ldns & TTL

A. Schulze sca at andreasschulze.de
Wed Nov 24 15:54:06 UTC 2021


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.

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




More information about the ldns-users mailing list