]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Detach rpzs and catzs from the previous view
authorAram Sargsyan <aram@isc.org>
Fri, 17 Feb 2023 12:41:29 +0000 (12:41 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 21 Feb 2023 09:04:19 +0000 (09:04 +0000)
When switching to a new view during a reconfiguration (or reverting
to the old view), detach the 'rpzs' and 'catzs' from the previuos view.

The 'catzs' case was earlier solved slightly differently, by detaching
from the new view when reverting to the old view, but we can not solve
this the same way for 'rpzs', because now in BIND 9.19 and BIND 9.18
a dns_rpz_shutdown_rpzs() call was added in view's destroy() function
before detaching the 'rpzs', so we can not leave the 'rpzs' attached to
the previous view and let it be shut down when we intend to continue
using it with the new view.

Instead, "re-fix" the issue for the 'catzs' pointer the same way as
for 'rpzs' for consistency, and also because a similar shutdown call
is likely to be implemented for 'catzs' in the near future.

(cherry picked from commit 121a095a22302472bc545476ea64f6b79bef9da6)

bin/named/server.c

index 9de935a67ad6da9f6503ae9c4791f05cf7e745df..f21745f4bcf559e725d7f46cf38ba2e5895aa302 100644 (file)
@@ -2641,6 +2641,7 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t **maps,
                dns_rpz_shutdown_rpzs(view->rpzs);
                dns_rpz_detach_rpzs(&view->rpzs);
                dns_rpz_attach_rpzs(pview->rpzs, &view->rpzs);
+               dns_rpz_detach_rpzs(&pview->rpzs);
        } else if (old != NULL && pview != NULL) {
                ++pview->rpzs->rpz_ver;
                view->rpzs->rpz_ver = pview->rpzs->rpz_ver;
@@ -3191,6 +3192,7 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
        if (old != NULL) {
                dns_catz_catzs_detach(&view->catzs);
                dns_catz_catzs_attach(pview->catzs, &view->catzs);
+               dns_catz_catzs_detach(&pview->catzs);
                dns_catz_prereconfig(view->catzs);
        }
 
@@ -6046,9 +6048,6 @@ cleanup:
                            named_config_get(maps, "catalog-zones", &obj) ==
                                    ISC_R_SUCCESS)
                        {
-                               if (pview->catzs != NULL) {
-                                       dns_catz_catzs_detach(&pview->catzs);
-                               }
                                /*
                                 * We are swapping the places of the `view` and
                                 * `pview` in the function's parameters list