mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Prepare a zone for shutting down when deleting it from a view
Afterb171cacf4f
, a zone object can remain in the memory for a while, until garbage collection is run. Setting the DNS_ZONEFLG_EXITING flag should prevent the zone maintenance function from running while it's in that state. Otherwise, a secondary zone could initiate a zone transfer after it had been deleted. (cherry picked from commit874ca5ca2f
)
This commit is contained in:
committed by
Ondřej Surý
parent
f09bb8b88c
commit
80a43c9241
@@ -1757,6 +1757,20 @@ dns_zone_findkeys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver,
|
|||||||
*\li Error
|
*\li Error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
dns_zone_prepare_shutdown(dns_zone_t *zone);
|
||||||
|
/*%<
|
||||||
|
* Prepare a zone for shutdown by setting the DNS_ZONEFLG_EXITING flag even
|
||||||
|
* before the final reference is detached. Useful, because the zone object can
|
||||||
|
* be kept around with a valid reference from the zonetable until qp garbage
|
||||||
|
* collector runs, and we don't want, for example, zone maintenance to happen
|
||||||
|
* while waiting for it. Note that the zone can not be used normally again after
|
||||||
|
* this function is called.
|
||||||
|
*
|
||||||
|
* Requires:
|
||||||
|
*\li 'zone' to be a valid initialised zone.
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
dns_zonemgr_create(isc_mem_t *mctx, isc_nm_t *netmgr, dns_zonemgr_t **zmgrp);
|
dns_zonemgr_create(isc_mem_t *mctx, isc_nm_t *netmgr, dns_zonemgr_t **zmgrp);
|
||||||
/*%<
|
/*%<
|
||||||
|
@@ -785,6 +785,8 @@ dns_view_delzone(dns_view_t *view, dns_zone_t *zone) {
|
|||||||
|
|
||||||
REQUIRE(DNS_VIEW_VALID(view));
|
REQUIRE(DNS_VIEW_VALID(view));
|
||||||
|
|
||||||
|
dns_zone_prepare_shutdown(zone);
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
zonetable = rcu_dereference(view->zonetable);
|
zonetable = rcu_dereference(view->zonetable);
|
||||||
if (zonetable != NULL) {
|
if (zonetable != NULL) {
|
||||||
|
@@ -6401,6 +6401,15 @@ failure:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dns_zone_prepare_shutdown(dns_zone_t *zone) {
|
||||||
|
REQUIRE(DNS_ZONE_VALID(zone));
|
||||||
|
|
||||||
|
LOCK_ZONE(zone);
|
||||||
|
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_EXITING);
|
||||||
|
UNLOCK_ZONE(zone);
|
||||||
|
}
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Find DNSSEC keys used for signing zone with dnssec-policy. Load these keys
|
* Find DNSSEC keys used for signing zone with dnssec-policy. Load these keys
|
||||||
* into 'keys'. Requires KASP to be locked.
|
* into 'keys'. Requires KASP to be locked.
|
||||||
|
Reference in New Issue
Block a user