2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 04:58:04 +00:00

Use stale data also if we are not resuming

Before this change, BIND will only fallback to using stale data if
there was an actual attempt to resolve the query. Then on a timeout,
the stale data from cache becomes eligible.

This commit changes this so that on any unexpected error stale data
becomes eligble (you would still have to have 'stale-answer-enable'
enabled of course).

If there is no stale data, this may return in an error again, so don't
loop on stale data lookup attempts. If the DNS_DBFIND_STALEOK flag is
set, this means we already tried to lookup stale data, so if that is
the case, don't use stale again.
This commit is contained in:
Matthijs Mekking 2021-01-19 09:04:29 +01:00
parent c1c7e1ac5c
commit c6fd02aed5

View File

@ -7441,6 +7441,14 @@ root_key_sentinel_return_servfail(query_ctx_t *qctx, isc_result_t result) {
*/
static bool
query_usestale(query_ctx_t *qctx) {
if ((qctx->client->query.dboptions & DNS_DBFIND_STALEOK) != 0) {
/*
* Query was already using stale, if that didn't work the
* last time, it won't work this time either.
*/
return (false);
}
qctx_clean(qctx);
qctx_freedata(qctx);
@ -7548,7 +7556,7 @@ query_gotanswer(query_ctx_t *qctx, isc_result_t res) {
"query_gotanswer: unexpected error: %s",
isc_result_totext(result));
CCTRACE(ISC_LOG_ERROR, errmsg);
if (qctx->resuming && query_usestale(qctx)) {
if (query_usestale(qctx)) {
/*
* If serve-stale is enabled, query_usestale() already
* set up 'qctx' for looking up a stale response.