]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix nonsensical stale TTL values in cache dump
authorMatthijs Mekking <matthijs@isc.org>
Wed, 10 Mar 2021 11:09:16 +0000 (12:09 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 13 Apr 2021 07:48:20 +0000 (09:48 +0200)
commit2a5e0232ed56233ae047fe1c31fded0d1ea96d77
tree48d65fbd9fd2275e8386292f41dafd72512e152f
parent1941ce99d44e422c847f3f54360fdbaa48d10ead
Fix nonsensical stale TTL values in cache dump

When introducing change 5149, "rndc dumpdb" started to print a line
above a stale RRset, indicating how long the data will be retained.

At that time, I thought it should also be possible to load
a cache from file. But if a TTL has a value of 0 (because it is stale),
stale entries wouldn't be loaded from file. So, I added the
'max-stale-ttl' to TTL values, and adjusted the $DATE accordingly.

Since we actually don't have a "load cache from file" feature, this
is premature and is causing confusion at operators. This commit
changes the 'max-stale-ttl' adjustments.

A check in the serve-stale system test is added for a non-stale
RRset (longttl.example) to make sure the TTL in cache is sensible.

Also, the comment above stale RRsets could have nonsensical
values. A possible reason why this may happen is when the RRset was
marked a stale but the 'max-stale-ttl' has passed (and is actually an
RRset awaiting cleanup). This would lead to the "will be retained"
value to be negative (but since it is stored in an uint32_t, you would
get a nonsensical value (e.g. 4294362497).

To mitigate against this, we now also check if the header is not
ancient. In addition we check if the stale_ttl would be negative, and
if so we set it to 0. Most likely this will not happen because the
header would already have been marked ancient, but there is a possible
race condition where the 'rdh_ttl + serve_stale_ttl' has passed,
but the header has not been checked for staleness.
CHANGES
bin/tests/system/serve-stale/tests.sh
doc/notes/notes-current.rst
lib/dns/masterdump.c
lib/dns/rbtdb.c