diff --git a/lib/ns/query.c b/lib/ns/query.c index 5a99454727..e4dfab3317 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -5743,6 +5743,13 @@ ns__query_start(query_ctx_t *qctx) { } } + /* + * If this is a chained query (e.g. CNAME), these bits should be reset + * to not use the settings from the previous query. + */ + qctx->options &= ~DNS_GETDB_STALEFIRST; + qctx->client->query.dboptions &= ~DNS_DBFIND_STALETIMEOUT; + if (!qctx->is_zone && (qctx->view->staleanswerclienttimeout == 0) && dns_view_staleanswerenabled(qctx->view)) { @@ -5762,6 +5769,7 @@ ns__query_start(query_ctx_t *qctx) { * when it completes, this option is not expected to be set. */ qctx->options &= ~DNS_GETDB_STALEFIRST; + qctx->client->query.dboptions &= ~DNS_DBFIND_STALETIMEOUT; cleanup: return result;