]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Call dns_catz_new_zones() only when it is needed
authorAram Sargsyan <aram@isc.org>
Thu, 23 Feb 2023 14:43:41 +0000 (14:43 +0000)
committerOndřej Surý <ondrej@isc.org>
Fri, 24 Feb 2023 14:00:26 +0000 (15:00 +0100)
The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.

bin/named/server.c

index 54a51b78b7cc726f6b6377d370e5871d503ce38c..a37aa4f378652487bb9fd8eeb473871cb0d07c3b 100644 (file)
@@ -3163,9 +3163,6 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
                return (ISC_R_SUCCESS);
        }
 
-       dns_catz_new_zones(view->mctx, named_g_loopmgr, &view->catzs,
-                          &ns_catz_zonemodmethods);
-
        if (pview != NULL) {
                old = pview->catzs;
        } else {
@@ -3178,10 +3175,12 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
        }
 
        if (old != NULL) {
-               dns_catz_detach_catzs(&view->catzs);
                dns_catz_attach_catzs(pview->catzs, &view->catzs);
                dns_catz_detach_catzs(&pview->catzs);
                dns_catz_prereconfig(view->catzs);
+       } else {
+               dns_catz_new_zones(view->mctx, named_g_loopmgr, &view->catzs,
+                                  &ns_catz_zonemodmethods);
        }
 
        while (zone_element != NULL) {