diff --git a/bin/named/server.c b/bin/named/server.c index 9ac5147c38..33aab6f1b4 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -225,6 +226,7 @@ static isc_result_t load_all(void) { isc_result_t result = ISC_R_SUCCESS; ns_dbinfo_t *dbi; + dns_view_t *view; result = load_version(); if (result != ISC_R_SUCCESS) @@ -238,6 +240,15 @@ load_all(void) { break; } + if (result == ISC_R_SUCCESS) { + RWLOCK(&ns_g_viewlock, isc_rwlocktype_read); + for (view = ISC_LIST_HEAD(ns_g_viewlist); + view != NULL; + view = ISC_LIST_NEXT(view, link)) + dns_view_freeze(view); + RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read); + } + return (result); } @@ -287,7 +298,6 @@ load_configuration(void) { static void run_server(isc_task_t *task, isc_event_t *event) { - (void)task; printf("server running\n"); @@ -317,6 +327,8 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write); isc_task_detach(&server_task); + ns_rootns_destroy(); + isc_event_free(&event); } @@ -325,6 +337,10 @@ ns_server_init(void) { isc_result_t result; dns_view_t *view, *view_next; + result = ns_rootns_init(); + if (result != ISC_R_SUCCESS) + return (result); + /* * XXXRTH The view management code here will probably move to its * own module when we start using the config file. @@ -335,6 +351,7 @@ ns_server_init(void) { if (result != ISC_R_SUCCESS) goto cleanup_views; ISC_LIST_APPEND(ns_g_viewlist, view, link); + dns_view_sethints(view, ns_g_rootns); view = NULL; result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS", &view); @@ -368,5 +385,7 @@ ns_server_init(void) { dns_view_detach(&view); } + ns_rootns_destroy(); + return (result); }