[9.18] 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.18' into 'bind-9.18'

See merge request isc-projects/bind9!10145
This commit is contained in:
Arаm Sаrgsyаn
2025-02-21 12:30:50 +00:00
+5 -6
View File
@@ -6798,14 +6798,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);
}