]> git.ipfire.org Git - thirdparty/bind9.git/commit
Consider non-stale data when in serve-stale mode
authorMatthijs Mekking <matthijs@isc.org>
Thu, 17 Nov 2022 13:52:26 +0000 (13:52 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 6 Dec 2022 13:51:07 +0000 (13:51 +0000)
commite6e13c3e62a6ea484b443c2d8d7dfbd116bc7b93
treed68d1ed344804d7f640a674b78e0913f5e711780
parent8fcb333622f233ce2aa0a79932475f2bd7dbf654
Consider non-stale data when in serve-stale mode

With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

(cherry picked from commit 86a80e723fc7b6bdd87174f4a48aa702dbe17c5a)
lib/ns/query.c