]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check if catz is active in dns__catz_update_cb()
authorAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 13:32:21 +0000 (13:32 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 18:57:16 +0000 (18:57 +0000)
A reconfiguration can deactivate the catalog zone, while the
offloaded update process was preparing to run.

(cherry picked from commit 6980e3b354778e3ff628d8e72ddf357cb0d8b2a0)

lib/dns/catz.c

index b45dbcb239b585ad69aece1ed8f687a5fb3514f3..58942dcda9061c9f0a3dcb4ce36870427fcbd29b 100644 (file)
@@ -2248,6 +2248,7 @@ dns__catz_update_cb(void *data) {
        char bname[DNS_NAME_FORMATSIZE];
        char cname[DNS_NAME_FORMATSIZE];
        bool is_vers_processed = false;
+       bool is_active;
        uint32_t vers;
        uint32_t catz_vers;
 
@@ -2271,6 +2272,7 @@ dns__catz_update_cb(void *data) {
        dns_name_toregion(&updb->origin, &r);
        LOCK(&catzs->lock);
        result = isc_ht_find(catzs->zones, r.base, r.length, (void **)&oldcatz);
+       is_active = (result == ISC_R_SUCCESS && oldcatz->active);
        UNLOCK(&catzs->lock);
        if (result != ISC_R_SUCCESS) {
                /* This can happen if we remove the zone in the meantime. */
@@ -2280,6 +2282,15 @@ dns__catz_update_cb(void *data) {
                goto exit;
        }
 
+       if (!is_active) {
+               /* This can happen during a reconfiguration. */
+               isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
+                             DNS_LOGMODULE_MASTER, ISC_LOG_INFO,
+                             "catz: zone '%s' is no longer active", bname);
+               result = ISC_R_CANCELED;
+               goto exit;
+       }
+
        result = dns_db_getsoaserial(updb, oldcatz->updbversion, &vers);
        if (result != ISC_R_SUCCESS) {
                /* A zone without SOA record?!? */