mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-15 23:22:35 -04:00
Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing-v9_18' into 'v9_18'
[9.18] Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t See merge request isc-projects/bind9!7610
This commit is contained in:
commit
ceba260fb8
6 changed files with 474 additions and 504 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,6 +1,9 @@
|
|||
6116. [bug] Fix error path cleanup issues in dns_catz_new_zones()
|
||||
and dns_catz_new_zone() functions. [GL #3900]
|
||||
|
||||
6112. [func] Add reference count tracing for dns_catz_zone_t and
|
||||
dns_catz_zones_t. [GL !7570]
|
||||
|
||||
6105. [bug] Detach 'rpzs' and 'catzs' from the previous view in
|
||||
configure_rpz() and configure_catz(), respectively,
|
||||
just after attaching it to the new view. [GL #3880]
|
||||
|
|
|
|||
|
|
@ -2877,7 +2877,7 @@ cleanup:
|
|||
cfg_obj_destroy(cfg->add_parser, &zoneconf);
|
||||
}
|
||||
dns_catz_entry_detach(ev->origin, &ev->entry);
|
||||
dns_catz_zone_detach(&ev->origin);
|
||||
dns_catz_detach_catz(&ev->origin);
|
||||
dns_view_detach(&ev->view);
|
||||
isc_event_free(ISC_EVENT_PTR(&ev));
|
||||
}
|
||||
|
|
@ -2952,7 +2952,7 @@ cleanup:
|
|||
dns_zone_detach(&zone);
|
||||
}
|
||||
dns_catz_entry_detach(ev->origin, &ev->entry);
|
||||
dns_catz_zone_detach(&ev->origin);
|
||||
dns_catz_detach_catz(&ev->origin);
|
||||
dns_view_detach(&ev->view);
|
||||
isc_event_free(ISC_EVENT_PTR(&ev));
|
||||
}
|
||||
|
|
@ -2994,7 +2994,7 @@ catz_create_chg_task(dns_catz_entry_t *entry, dns_catz_zone_t *origin,
|
|||
event->mod = (type == DNS_EVENT_CATZMODZONE);
|
||||
|
||||
dns_catz_entry_attach(entry, &event->entry);
|
||||
dns_catz_zone_attach(origin, &event->origin);
|
||||
dns_catz_attach_catz(origin, &event->origin);
|
||||
dns_view_attach(view, &event->view);
|
||||
|
||||
isc_task_send(task, ISC_EVENT_PTR(&event));
|
||||
|
|
@ -3161,7 +3161,7 @@ static dns_catz_zonemodmethods_t ns_catz_zonemodmethods = {
|
|||
static isc_result_t
|
||||
configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
|
||||
const cfg_obj_t *catz_obj) {
|
||||
const cfg_listelt_t *zone_element;
|
||||
const cfg_listelt_t *zone_element = NULL;
|
||||
const dns_catz_zones_t *old = NULL;
|
||||
bool pview_must_detach = false;
|
||||
isc_result_t result;
|
||||
|
|
@ -3174,9 +3174,8 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
|
|||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
CHECK(dns_catz_new_zones(&view->catzs, &ns_catz_zonemodmethods,
|
||||
view->mctx, named_g_taskmgr,
|
||||
named_g_timermgr));
|
||||
CHECK(dns_catz_new_zones(view->mctx, named_g_taskmgr, named_g_timermgr,
|
||||
&view->catzs, &ns_catz_zonemodmethods));
|
||||
|
||||
if (pview != NULL) {
|
||||
old = pview->catzs;
|
||||
|
|
@ -3190,9 +3189,9 @@ 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_detach_catzs(&view->catzs);
|
||||
dns_catz_attach_catzs(pview->catzs, &view->catzs);
|
||||
dns_catz_detach_catzs(&pview->catzs);
|
||||
dns_catz_prereconfig(view->catzs);
|
||||
}
|
||||
|
||||
|
|
|
|||
847
lib/dns/catz.c
847
lib/dns/catz.c
File diff suppressed because it is too large
Load diff
|
|
@ -13,6 +13,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* Define this for reference count tracing in the unit
|
||||
*/
|
||||
#undef DNS_CATZ_TRACE
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
@ -144,7 +149,7 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
|
|||
*/
|
||||
|
||||
void
|
||||
dns_catz_entry_copy(dns_catz_zone_t *zone, const dns_catz_entry_t *entry,
|
||||
dns_catz_entry_copy(dns_catz_zone_t *catz, const dns_catz_entry_t *entry,
|
||||
dns_catz_entry_t **nentryp);
|
||||
/*%<
|
||||
* Allocate a new catz_entry and deep copy 'entry' into 'nentryp'.
|
||||
|
|
@ -170,7 +175,7 @@ dns_catz_entry_attach(dns_catz_entry_t *entry, dns_catz_entry_t **entryp);
|
|||
*/
|
||||
|
||||
void
|
||||
dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp);
|
||||
dns_catz_entry_detach(dns_catz_zone_t *catz, dns_catz_entry_t **entryp);
|
||||
/*%<
|
||||
* Detach an entry, free if no further references
|
||||
*
|
||||
|
|
@ -203,34 +208,15 @@ dns_catz_entry_cmp(const dns_catz_entry_t *ea, const dns_catz_entry_t *eb);
|
|||
* \li 'false' if the entries differ.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_catz_zone_attach(dns_catz_zone_t *zone, dns_catz_zone_t **zonep);
|
||||
/*%<
|
||||
* Attach a catzone
|
||||
*
|
||||
* Requires:
|
||||
* \li 'zone' is a valid dns_catz_zone_t.
|
||||
* \li 'zonep' is not NULL and '*zonep' is NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_catz_zone_detach(dns_catz_zone_t **zonep);
|
||||
/*%<
|
||||
* Detach a zone, free if no further references
|
||||
*
|
||||
* Requires:
|
||||
* \li 'zonep' is not NULL and '*zonep' is not NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep,
|
||||
dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **catzp,
|
||||
const dns_name_t *name);
|
||||
/*%<
|
||||
* Allocate a new catz zone on catzs mctx
|
||||
*
|
||||
* Requires:
|
||||
* \li 'catzs' is a valid dns_catz_zones_t.
|
||||
* \li 'zonep' is not NULL and '*zonep' is NULL.
|
||||
* \li 'catzp' is not NULL and '*zonep' is NULL.
|
||||
* \li 'name' is a valid dns_name_t.
|
||||
*
|
||||
*/
|
||||
|
|
@ -334,14 +320,17 @@ struct dns_catz_zonemodmethods {
|
|||
};
|
||||
|
||||
isc_result_t
|
||||
dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
|
||||
isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
||||
isc_timermgr_t *timermgr);
|
||||
dns_catz_new_zones(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
||||
isc_timermgr_t *timermgr, dns_catz_zones_t **catzsp,
|
||||
dns_catz_zonemodmethods_t *zmm);
|
||||
/*%<
|
||||
* Allocate a new catz_zones object, a collection storing all catalog zones
|
||||
* for a view.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'mctx' is not NULL.
|
||||
* \li 'taskmgr' is not NULL.
|
||||
* \li 'timermgr' is not NULL.
|
||||
* \li 'catzsp' is not NULL and '*catzsp' is NULL.
|
||||
* \li 'zmm' is not NULL.
|
||||
*
|
||||
|
|
@ -370,25 +359,6 @@ dns_catz_get_zone(dns_catz_zones_t *catzs, const dns_name_t *name);
|
|||
* \li 'name' is a valid dns_name_t.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_catz_catzs_attach(dns_catz_zones_t *catzs, dns_catz_zones_t **catzsp);
|
||||
/*%<
|
||||
* Attach 'catzs' to 'catzsp'.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'catzs' is a valid dns_catz_zones_t.
|
||||
* \li 'catzsp' is not NULL and *catzsp is NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_catz_catzs_detach(dns_catz_zones_t **catzsp);
|
||||
/*%<
|
||||
* Detach 'catzsp', free if no further references.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'catzsp' is not NULL and *catzsp is not NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_catz_catzs_set_view(dns_catz_zones_t *catzs, dns_view_t *view);
|
||||
/*%<
|
||||
|
|
@ -467,4 +437,43 @@ dns_catz_get_iterator(dns_catz_zone_t *catz, isc_ht_iter_t **itp);
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef DNS_CATZ_TRACE
|
||||
/* Compatibility macros */
|
||||
#define dns_catz_attach_catz(catz, catzp) \
|
||||
dns_catz_zone__attach(catz, catzp, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_detach_catz(catzp) \
|
||||
dns_catz_zone__detach(catzp, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_ref_catz(ptr) \
|
||||
dns_catz_zone__ref(ptr, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_unref_catz(ptr) \
|
||||
dns_catz_zone__unref(ptr, __func__, __FILE__, __LINE__)
|
||||
|
||||
#define dns_catz_attach_catzs(catzs, catzsp) \
|
||||
dns_catz_zones__attach(catzs, catzsp, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_detach_catzs(catzsp) \
|
||||
dns_catz_zones__detach(catzsp, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_ref_catzs(ptr) \
|
||||
dns_catz_zones__ref(ptr, __func__, __FILE__, __LINE__)
|
||||
#define dns_catz_unref_catzs(ptr) \
|
||||
dns_catz_zones__unref(ptr, __func__, __FILE__, __LINE__)
|
||||
|
||||
ISC_REFCOUNT_TRACE_DECL(dns_catz_zone);
|
||||
ISC_REFCOUNT_TRACE_DECL(dns_catz_zones);
|
||||
#else
|
||||
/* Compatibility macros */
|
||||
#define dns_catz_attach_catz(catz, catzp) dns_catz_zone_attach(catz, catzp)
|
||||
#define dns_catz_detach_catz(catzp) dns_catz_zone_detach(catzp)
|
||||
#define dns_catz_ref_catz(ptr) dns_catz_zone_ref(ptr)
|
||||
#define dns_catz_unref_catz(ptr) dns_catz_zone_unref(ptr)
|
||||
|
||||
#define dns_catz_attach_catzs(catzs, catzsp) \
|
||||
dns_catz_zones_attach(catzs, catzsp)
|
||||
#define dns_catz_detach_catzs(catzsp) dns_catz_zones_detach(catzsp)
|
||||
#define dns_catz_ref_catzs(ptr) dns_catz_zones_ref(ptr)
|
||||
#define dns_catz_unref_catzs(ptr) dns_catz_zones_unref(ptr)
|
||||
|
||||
ISC_REFCOUNT_DECL(dns_catz_zone);
|
||||
ISC_REFCOUNT_DECL(dns_catz_zones);
|
||||
#endif /* DNS_CATZ_TRACE */
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ destroy(dns_view_t *view) {
|
|||
dns_rpz_detach_rpzs(&view->rpzs);
|
||||
}
|
||||
if (view->catzs != NULL) {
|
||||
dns_catz_catzs_detach(&view->catzs);
|
||||
dns_catz_detach_catzs(&view->catzs);
|
||||
}
|
||||
for (dlzdb = ISC_LIST_HEAD(view->dlz_searched); dlzdb != NULL;
|
||||
dlzdb = ISC_LIST_HEAD(view->dlz_searched))
|
||||
|
|
@ -680,7 +680,7 @@ view_flushanddetach(dns_view_t **viewp, bool flush) {
|
|||
}
|
||||
}
|
||||
if (view->catzs != NULL) {
|
||||
dns_catz_catzs_detach(&view->catzs);
|
||||
dns_catz_detach_catzs(&view->catzs);
|
||||
}
|
||||
if (view->ntatable_priv != NULL) {
|
||||
dns_ntatable_shutdown(view->ntatable_priv);
|
||||
|
|
|
|||
|
|
@ -1328,7 +1328,7 @@ zone_free(dns_zone_t *zone) {
|
|||
zone->rpz_num = DNS_RPZ_INVALID_NUM;
|
||||
}
|
||||
if (zone->catzs != NULL) {
|
||||
dns_catz_catzs_detach(&zone->catzs);
|
||||
dns_catz_detach_catzs(&zone->catzs);
|
||||
}
|
||||
zone_freedbargs(zone);
|
||||
dns_zone_setparentals(zone, NULL, NULL, NULL, 0);
|
||||
|
|
@ -1981,7 +1981,7 @@ zone_catz_enable(dns_zone_t *zone, dns_catz_zones_t *catzs) {
|
|||
INSIST(zone->catzs == NULL || zone->catzs == catzs);
|
||||
dns_catz_catzs_set_view(catzs, zone->view);
|
||||
if (zone->catzs == NULL) {
|
||||
dns_catz_catzs_attach(catzs, &zone->catzs);
|
||||
dns_catz_attach_catzs(catzs, &zone->catzs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2002,7 +2002,7 @@ zone_catz_disable(dns_zone_t *zone) {
|
|||
if (zone->db != NULL) {
|
||||
dns_zone_catz_disable_db(zone, zone->db);
|
||||
}
|
||||
dns_catz_catzs_detach(&zone->catzs);
|
||||
dns_catz_detach_catzs(&zone->catzs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue