mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Don't freeze / thaw non-explict in-view zones
This commit is contained in:
parent
ebc92b799b
commit
dcdd9a403a
@ -160,7 +160,7 @@ dns_zt_asyncload(dns_zt_t *zt, bool newonly, dns_zt_allloaded_t alldone,
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_zt_freezezones(dns_zt_t *zt, bool freeze);
|
||||
dns_zt_freezezones(dns_zt_t *zt, dns_view_t *view, bool freeze);
|
||||
/*%<
|
||||
* Freeze/thaw updates to master zones.
|
||||
* Any pending updates will be flushed.
|
||||
|
@ -1855,7 +1855,7 @@ dns_view_freezezones(dns_view_t *view, bool value) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
REQUIRE(view->zonetable != NULL);
|
||||
|
||||
return (dns_zt_freezezones(view->zonetable, value));
|
||||
return (dns_zt_freezezones(view->zonetable, view, value));
|
||||
}
|
||||
|
||||
void
|
||||
|
26
lib/dns/zt.c
26
lib/dns/zt.c
@ -55,6 +55,11 @@ struct dns_zt {
|
||||
dns_rbt_t *table;
|
||||
};
|
||||
|
||||
struct zt_freeze_params {
|
||||
dns_view_t *view;
|
||||
bool freeze;
|
||||
};
|
||||
|
||||
#define ZTMAGIC ISC_MAGIC('Z', 'T', 'b', 'l')
|
||||
#define VALID_ZT(zt) ISC_MAGIC_VALID(zt, ZTMAGIC)
|
||||
|
||||
@ -375,13 +380,14 @@ asyncload(dns_zone_t *zone, void *zt_) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_zt_freezezones(dns_zt_t *zt, bool freeze) {
|
||||
dns_zt_freezezones(dns_zt_t *zt, dns_view_t *view, bool freeze) {
|
||||
isc_result_t result, tresult;
|
||||
struct zt_freeze_params params = { view, freeze };
|
||||
|
||||
REQUIRE(VALID_ZT(zt));
|
||||
|
||||
RWLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
result = dns_zt_apply(zt, false, &tresult, freezezones, &freeze);
|
||||
result = dns_zt_apply(zt, false, &tresult, freezezones, ¶ms);
|
||||
RWUNLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
if (tresult == ISC_R_NOTFOUND) {
|
||||
tresult = ISC_R_SUCCESS;
|
||||
@ -391,7 +397,7 @@ dns_zt_freezezones(dns_zt_t *zt, bool freeze) {
|
||||
|
||||
static isc_result_t
|
||||
freezezones(dns_zone_t *zone, void *uap) {
|
||||
bool freeze = *(bool *)uap;
|
||||
struct zt_freeze_params *params = uap;
|
||||
bool frozen;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
char classstr[DNS_RDATACLASS_FORMATSIZE];
|
||||
@ -406,6 +412,12 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
if (raw != NULL) {
|
||||
zone = raw;
|
||||
}
|
||||
if (params->view != dns_zone_getview(zone)) {
|
||||
if (raw != NULL) {
|
||||
dns_zone_detach(&raw);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
if (dns_zone_gettype(zone) != dns_zone_master) {
|
||||
if (raw != NULL) {
|
||||
dns_zone_detach(&raw);
|
||||
@ -420,7 +432,7 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
}
|
||||
|
||||
frozen = dns_zone_getupdatedisabled(zone);
|
||||
if (freeze) {
|
||||
if (params->freeze) {
|
||||
if (frozen) {
|
||||
result = DNS_R_FROZEN;
|
||||
}
|
||||
@ -428,7 +440,7 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
result = dns_zone_flush(zone);
|
||||
}
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
dns_zone_setupdatedisabled(zone, freeze);
|
||||
dns_zone_setupdatedisabled(zone, params->freeze);
|
||||
}
|
||||
} else {
|
||||
if (frozen) {
|
||||
@ -455,8 +467,8 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
level = (result != ISC_R_SUCCESS) ? ISC_LOG_ERROR : ISC_LOG_DEBUG(1);
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE,
|
||||
level, "%s zone '%s/%s'%s%s: %s",
|
||||
freeze ? "freezing" : "thawing", zonename, classstr, sep,
|
||||
vname, isc_result_totext(result));
|
||||
params->freeze ? "freezing" : "thawing", zonename,
|
||||
classstr, sep, vname, isc_result_totext(result));
|
||||
if (raw != NULL) {
|
||||
dns_zone_detach(&raw);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user