diff --git a/lib/ns/query.c b/lib/ns/query.c index f413ddee19..2248e4b0b3 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -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.