exit server if loading a zone fails during initial startup
(but not if it fails during a subsequent reload)
This commit is contained in:
+28
-18
@@ -551,24 +551,6 @@ load_configuration(const char *filename, ns_server_t *server) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Load zones.
|
||||
*/
|
||||
for (view = ISC_LIST_HEAD(lctx.viewlist);
|
||||
view != NULL;
|
||||
view = view_next) {
|
||||
view_next = ISC_LIST_NEXT(view, link);
|
||||
/* XXX error checking */
|
||||
dns_view_load(view);
|
||||
}
|
||||
|
||||
/*
|
||||
* Force zone maintenance. Do this after loading
|
||||
* so that we know when we need to force AXFR of
|
||||
* slave zones whose master files are missing.
|
||||
*/
|
||||
CHECK(dns_zonemgr_forcemaint(server->zonemgr));
|
||||
|
||||
/*
|
||||
* Swap our new view list with the production one.
|
||||
*/
|
||||
@@ -611,6 +593,31 @@ load_configuration(const char *filename, ns_server_t *server) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
load_zones(ns_server_t *server, isc_boolean_t stop) {
|
||||
isc_result_t result;
|
||||
dns_view_t *view;
|
||||
|
||||
/*
|
||||
* Load zone data from disk.
|
||||
*/
|
||||
for (view = ISC_LIST_HEAD(server->viewlist);
|
||||
view != NULL;
|
||||
view = ISC_LIST_NEXT(view, link))
|
||||
{
|
||||
CHECK(dns_view_load(view, stop));
|
||||
}
|
||||
|
||||
/*
|
||||
* Force zone maintenance. Do this after loading
|
||||
* so that we know when we need to force AXFR of
|
||||
* slave zones whose master files are missing.
|
||||
*/
|
||||
CHECK(dns_zonemgr_forcemaint(server->zonemgr));
|
||||
cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
run_server(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
@@ -631,6 +638,9 @@ run_server(isc_task_t *task, isc_event_t *event) {
|
||||
CHECKFATAL(load_configuration(ns_g_conffile, server),
|
||||
"loading configuration");
|
||||
|
||||
CHECKFATAL(load_zones(server, ISC_TRUE),
|
||||
"loading zones");
|
||||
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
|
||||
ISC_LOG_INFO, "running");
|
||||
}
|
||||
|
||||
@@ -433,10 +433,12 @@ dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zone);
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void
|
||||
dns_view_load(dns_view_t *view);
|
||||
isc_result_t
|
||||
dns_view_load(dns_view_t *view, isc_boolean_t stop);
|
||||
/*
|
||||
* Load all zones attached to this view.
|
||||
* Load all zones attached to this view. If 'stop' is ISC_TRUE,
|
||||
* stop on the first error and return it. If 'stop'
|
||||
* is ISC_FALSE, ignore errors.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
|
||||
@@ -112,10 +112,12 @@ void dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
|
||||
* '*ztp' to be NULL
|
||||
*/
|
||||
|
||||
void dns_zt_load(dns_zt_t *zt);
|
||||
isc_result_t dns_zt_load(dns_zt_t *zt, isc_boolean_t stop);
|
||||
|
||||
/*
|
||||
* Load all zones in the table.
|
||||
* Load all zones in the table. If 'stop' is ISC_TRUE,
|
||||
* stop on the first error and return it. If 'stop'
|
||||
* is ISC_FALSE, ignore errors.
|
||||
*
|
||||
* Requires:
|
||||
* 'zt' to be valid
|
||||
|
||||
+3
-3
@@ -798,12 +798,12 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name,
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
dns_view_load(dns_view_t *view) {
|
||||
isc_result_t
|
||||
dns_view_load(dns_view_t *view, isc_boolean_t stop) {
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
|
||||
dns_zt_load(view->zonetable);
|
||||
return (dns_zt_load(view->zonetable, stop));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
+3
-3
@@ -217,9 +217,9 @@ dns_zt_print(dns_zt_t *zt) {
|
||||
RWUNLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
}
|
||||
|
||||
void
|
||||
dns_zt_load(dns_zt_t *zt) {
|
||||
(void)dns_zt_apply(zt, ISC_FALSE, load, NULL);
|
||||
isc_result_t
|
||||
dns_zt_load(dns_zt_t *zt, isc_boolean_t stop) {
|
||||
return (dns_zt_apply(zt, stop, load, NULL));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
|
||||
Reference in New Issue
Block a user