[9.20] fix: usr: Fix RPZ race condition during a reconfiguration

With RPZ in use, `named` could terminate unexpectedly because of a race condition when a reconfiguration command was received using `rndc`. This has been fixed.

Closes #5146

Backport of MR !10079

Merge branch 'backport-5146-rpz-reconfig-bug-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10144
This commit is contained in:
Arаm Sаrgsyаn 2025-02-21 12:45:27 +00:00
commit eca9a3279e

View file

@ -6765,14 +6765,13 @@ query_resume(query_ctx_t *qctx) {
/*
* Has response policy changed out from under us?
*/
if (qctx->rpz_st->rpz_ver != qctx->view->rpzs->rpz_ver) {
if (qctx->view->rpzs == NULL ||
qctx->rpz_st->rpz_ver != qctx->view->rpzs->rpz_ver)
{
ns_client_log(qctx->client, NS_LOGCATEGORY_CLIENT,
NS_LOGMODULE_QUERY, DNS_RPZ_INFO_LEVEL,
"query_resume: RPZ settings "
"out of date "
"(rpz_ver %d, expected %d)",
qctx->view->rpzs->rpz_ver,
qctx->rpz_st->rpz_ver);
"query_resume: RPZ settings out of date "
"after of a reconfiguration");
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
return ns_query_done(qctx);
}