From 016326d111130b2810cb453d6bf2ff94f398b050 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 15 Oct 1999 01:51:48 +0000 Subject: [PATCH] overhaul loading; get rid of old load scheme --- bin/named/server.c | 798 ++++++++++++++++++++------------------------- 1 file changed, 351 insertions(+), 447 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 97e019ce22..2c30925ac2 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -59,303 +59,392 @@ #include "../../isc/util.h" /* XXXRTH */ - -static isc_result_t server_config_load(const char *conffile, isc_mem_t *mem); -static isc_result_t server_config_reload(const char *conffile, isc_mem_t *mem); -static isc_result_t zoneload(dns_c_ctx_t *ctx, dns_c_zone_t *zone, - dns_c_view_t *view, void *uap); -static isc_result_t zonereload(dns_c_ctx_t *ctx, dns_c_zone_t *zone, - dns_c_view_t *view, void *uap); -static isc_result_t optionsload(dns_c_ctx_t *ctx, void *uap); -static isc_result_t optionsreload(dns_c_ctx_t *ctx, void *uap); - +typedef struct { + isc_mem_t * mctx; + dns_viewlist_t viewlist; +} ns_load_t; static isc_task_t * server_task; -static dns_db_t * version_db; static dns_view_t * version_view; -static dns_result_t -load(ns_dbinfo_t *dbi, char *view_name) { - dns_fixedname_t forigin; - dns_name_t *origin; - dns_result_t result; - isc_buffer_t source; - size_t len; + +static isc_result_t +create_default_view(isc_mem_t *mctx, dns_rdataclass_t rdclass, + dns_view_t **viewp) +{ dns_view_t *view; + dns_db_t *db; + isc_result_t result; + + REQUIRE(viewp != NULL && *viewp == NULL); /* - * XXXRTH View list code will move to its own module soon. + * View. */ - RWLOCK(&ns_g_viewlock, isc_rwlocktype_read); - for (view = ISC_LIST_HEAD(ns_g_viewlist); - view != NULL; - view = ISC_LIST_NEXT(view, link)) { - if (strcasecmp(view_name, view->name) == 0) { - dns_view_attach(view, &dbi->view); - break; - } - } - RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read); - if (view == NULL) - return (DNS_R_NOTFOUND); + view = NULL; + result = dns_view_create(ns_g_mctx, rdclass, "_default", &view); + if (result != ISC_R_SUCCESS) + return (result); - len = strlen(dbi->origin); - isc_buffer_init(&source, dbi->origin, len, ISC_BUFFERTYPE_TEXT); - isc_buffer_add(&source, len); - dns_fixedname_init(&forigin); - origin = dns_fixedname_name(&forigin); - result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE, - NULL); - if (result != DNS_R_SUCCESS) - goto view_detach; + /* + * Cache. + */ + db = NULL; + result = dns_db_create(mctx, "rbt", dns_rootname, ISC_TRUE, + rdclass, 0, NULL, &db); + if (result != ISC_R_SUCCESS) + goto cleanup; + dns_view_setcachedb(view, db); + dns_db_detach(&db); - if (dbi->iscache) { - result = dns_db_create(ns_g_mctx, "rbt", origin, dbi->iscache, - view->rdclass, 0, NULL, &dbi->db); - if (result != DNS_R_SUCCESS) - goto view_detach; - printf("loading cache %s (%s)\n", dbi->path, dbi->origin); - result = dns_db_load(dbi->db, dbi->path); - if (result != DNS_R_SUCCESS) - goto db_detach; - dns_view_setcachedb(view, dbi->db); - } else { - result = dns_zone_create(&dbi->zone, ns_g_mctx); + /* + * Resolver. + * + * XXXRTH hardwired number of tasks. Also, we'll need to + * see if we are dealing with a shared dispatcher in this view. + */ + result = dns_view_createresolver(view, ns_g_taskmgr, 16, + ns_g_socketmgr, ns_g_timermgr, + NULL); + if (result != ISC_R_SUCCESS) + goto cleanup; - printf("loading %s (%s)\n", dbi->path, dbi->origin); - result = dns_zone_setdatabase(dbi->zone, dbi->path); - if (result != DNS_R_SUCCESS) - goto zone_detach; - result = dns_zone_load(dbi->zone); + /* + * We have default hints for class IN. + */ + if (rdclass == dns_rdataclass_in) + dns_view_sethints(view, ns_g_rootns); - if (result != DNS_R_SUCCESS) { - if (dbi->isslave) { - /* - * Ignore the error. - */ - return (DNS_R_SUCCESS); - } else { - goto zone_detach; - } - } + *viewp = view; - printf("loaded\n"); - printf("journal rollforward\n"); - result = dns_journal_rollforward(ns_g_mctx, dbi->db, "journal"); - if (result != DNS_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "ns_rollforward(): %s", - dns_result_totext(result)); - /* Continue anyway... */ - } + return (ISC_R_SUCCESS); - result = dns_view_addzone(view, dbi->zone); - if (result != DNS_R_SUCCESS) - goto zone_detach; - } - - return (DNS_R_SUCCESS); - - zone_detach: - if (dbi->zone != NULL) - dns_zone_detach(&dbi->zone); - - db_detach: - if (dbi->db != NULL) - dns_db_detach(&dbi->db); - - view_detach: - dns_view_detach(&dbi->view); + cleanup: + dns_view_detach(&view); return (result); } static isc_result_t -load_version(void) { - dns_fixedname_t forigin; +load_zone(dns_c_ctx_t *ctx, dns_c_zone_t *czone, dns_c_view_t *cview, + void *uap) +{ + ns_load_t *lctx; + dns_view_t *view, *tview, *pview; + dns_zone_t *zone, *tzone; + dns_name_t *origin; + isc_result_t result; + isc_boolean_t need_load; + + /* + * Load (or reload) a zone. + */ + + lctx = uap; + + tzone = NULL; + zone = NULL; + pview = NULL; + need_load = ISC_TRUE; + + /* + * Find the view. + */ + view = NULL; + if (cview != NULL) { + result = dns_viewlist_find(&lctx->viewlist, cview->name, + czone->zclass, &view); + if (result != ISC_R_SUCCESS) + return (result); + } else { + result = dns_viewlist_find(&lctx->viewlist, "_default", + czone->zclass, &view); + if (result == ISC_R_NOTFOUND) { + /* + * Create a default view. + */ + tview = NULL; + result = create_default_view(ctx->mem, czone->zclass, + &tview); + if (result != ISC_R_SUCCESS) + return (result); + dns_view_attach(tview, &view); + ISC_LIST_APPEND(lctx->viewlist, view, link); + } else if (result != ISC_R_SUCCESS) + return (result); + } + + /* + * Do we already have a production version of this view? + */ + RWLOCK(&ns_g_viewlock, isc_rwlocktype_read); + result = dns_viewlist_find(&ns_g_viewlist, view->name, view->rdclass, + &pview); + RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read); + if (result != ISC_R_NOTFOUND && result != ISC_R_SUCCESS) + goto cleanup; + + /* + * Create a new zone structure and configure it. + */ + result = dns_zone_create(&zone, lctx->mctx); + if (result != ISC_R_SUCCESS) + return (result); + result = dns_zone_copy(ctx, czone, zone); + if (result != ISC_R_SUCCESS) + return (result); + + if (dns_zone_gettype(zone) == dns_zone_hint) { + INSIST(0); + } else { + /* + * Check for duplicates in the new zone table. + */ + origin = dns_zone_getorigin(zone); + result = dns_view_findzone(view, origin, &tzone); + if (result == ISC_R_SUCCESS) { + /* + * We already have this zone! + */ + result = ISC_R_EXISTS; + goto cleanup; + } + + /* + * Do we have the zone in the production view? + */ + if (pview != NULL) + result = dns_view_findzone(pview, origin, &tzone); + else + result = ISC_R_NOTFOUND; + if (result == ISC_R_SUCCESS) { + /* + * Yes. + * + * If the production zone's configuration is + * the same as the new zone's, we can use the + * production zone. + */ + if (dns_zone_equal(zone, tzone)) { + result = dns_view_addzone(view, tzone); + need_load = ISC_FALSE; + } else + result = dns_view_addzone(view, zone); + } else if (result == ISC_R_NOTFOUND) { + /* + * This is a new zone. + */ + result = dns_view_addzone(view, zone); + } + } + + if (need_load) { + /* + * XXXRTH What should we do about errors? We don't + * want to fail the whole config file load just + * because we couldn't get a zone. + */ + (void)dns_zone_load(zone); + } + + cleanup: + if (tzone != NULL) + dns_zone_detach(&tzone); + if (zone != NULL) + dns_zone_detach(&zone); + if (pview != NULL) + dns_view_detach(&pview); + if (view != NULL) + dns_view_detach(&view); + + return (result); +} + +static isc_result_t +load_configuration(const char *filename) { + isc_result_t result; + ns_load_t lctx; + dns_c_cbks_t callbacks; + dns_c_ctx_t *configctx, *oconfigctx; + dns_view_t *view, *view_next; + dns_viewlist_t oviewlist; + + lctx.mctx = ns_g_mctx; + ISC_LIST_INIT(lctx.viewlist); + + callbacks.zonecbk = load_zone; + callbacks.zonecbkuap = &lctx; + callbacks.optscbk = NULL; + callbacks.optscbkuap = NULL; + + /* XXX should log rather than write to stderr */ + fprintf(stderr, "named: loading config file %s\n", filename); + + configctx = NULL; + result = dns_c_parse_namedconf(NULL, /* XXX isc_log_t to use??? */ + filename, ns_g_mctx, &configctx, + &callbacks); + if (result != ISC_R_SUCCESS) { + /* XXX should log rather than write to stderr */ + fprintf(stderr, "named: failed to load config file %s\n", + filename); + return (result); + } + + /* + * Create default view, if required. + */ + + /* + * Freeze the views. + */ + for (view = ISC_LIST_HEAD(lctx.viewlist); + view != NULL; + view = ISC_LIST_NEXT(view, link)) + dns_view_freeze(view); + + /* + * Attach the version view. + */ + view = NULL; + dns_view_attach(version_view, &view); + ISC_LIST_APPEND(lctx.viewlist, view, link); + + /* + * Load zones. (???) + */ + + /* + * Put the configuration into production. + */ + + RWLOCK(&ns_g_viewlock, isc_rwlocktype_write); + + oviewlist = ns_g_viewlist; + ns_g_viewlist = lctx.viewlist; + + oconfigctx = ns_g_confctx; + ns_g_confctx = configctx; + + RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write); + + /* + * Cleanup old configuration. + */ + + for (view = ISC_LIST_HEAD(oviewlist); + view != NULL; + view = view_next) { + view_next = ISC_LIST_NEXT(view, link); + ISC_LIST_UNLINK(oviewlist, view, link); + dns_view_detach(&view); + } + + if (oconfigctx != NULL) + dns_c_ctx_delete(NULL /* XXX isc_log_t */, &oconfigctx); + + return (ISC_R_SUCCESS); +} + +static void +run_server(isc_task_t *task, isc_event_t *event) { + isc_result_t result; + + (void)task; + + printf("server running\n"); + + result = load_configuration(ns_g_conffile); + if (result != ISC_R_SUCCESS) { + /* XXXRTH Log. */ + fprintf(stderr, "load_configuration failed: %s\n", + isc_result_totext(result)); + isc_app_shutdown(); + } + + ns_interfacemgr_scan(ns_g_interfacemgr); + + isc_event_free(&event); +} + +static isc_result_t +create_version_view(void) { + dns_view_t *view; + dns_zone_t *zone; + dns_db_t *db; dns_name_t *origin; dns_result_t result, eresult; isc_buffer_t source; size_t len; int soacount, nscount; dns_rdatacallbacks_t callbacks; - dns_view_t *view = NULL; char version_text[1024]; - dns_zone_t *version_zone = NULL; - dns_db_t *version_db = NULL; - sprintf(version_text, "version 0 CHAOS TXT \"%s\"\n", ns_g_version); + (void)sprintf(version_text, "version 0 CHAOS TXT \"%s\"\n", + ns_g_version); - /* - * XXXRTH View list code will move to its own module soon. - */ - RWLOCK(&ns_g_viewlock, isc_rwlocktype_read); - for (view = ISC_LIST_HEAD(ns_g_viewlist); - view != NULL; - view = ISC_LIST_NEXT(view, link)) { - if (strcasecmp(view->name, "default/CHAOS") == 0) { - dns_view_attach(view, &version_view); - break; - } - } - RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read); - if (view == NULL) - return (DNS_R_NOTFOUND); + view = NULL; + result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "_version", + &view); + if (result != ISC_R_SUCCESS) + return (result); - len = strlen("bind."); - isc_buffer_init(&source, "bind.", len, ISC_BUFFERTYPE_TEXT); - isc_buffer_add(&source, len); - dns_fixedname_init(&forigin); - origin = dns_fixedname_name(&forigin); - result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE, - NULL); - if (result != DNS_R_SUCCESS) + zone = NULL; + result = dns_zone_create(&zone, ns_g_mctx); + if (result != ISC_R_SUCCESS) goto cleanup; - - version_zone = NULL; - result = dns_zone_create(&version_zone, ns_g_mctx); - if (result != DNS_R_SUCCESS) + result = dns_zone_setorigin(zone, "bind."); + if (result != ISC_R_SUCCESS) goto cleanup; + origin = dns_zone_getorigin(zone); - version_db = NULL; + db = NULL; result = dns_db_create(ns_g_mctx, "rbt", origin, ISC_FALSE, - view->rdclass, 0, NULL, &version_db); - if (result != DNS_R_SUCCESS) + view->rdclass, 0, NULL, &db); + if (result != ISC_R_SUCCESS) goto cleanup; - dns_rdatacallbacks_init(&callbacks); - len = strlen(version_text); isc_buffer_init(&source, version_text, len, ISC_BUFFERTYPE_TEXT); isc_buffer_add(&source, len); - - result = dns_db_beginload(version_db, &callbacks.add, - &callbacks.add_private); + dns_rdatacallbacks_init(&callbacks); + result = dns_db_beginload(db, &callbacks.add, &callbacks.add_private); if (result != DNS_R_SUCCESS) return (result); - result = dns_master_loadbuffer(&source, &version_db->origin, - &version_db->origin, - version_db->rdclass, ISC_FALSE, + result = dns_master_loadbuffer(&source, &db->origin, &db->origin, + db->rdclass, ISC_FALSE, &soacount, &nscount, &callbacks, - version_db->mctx); - eresult = dns_db_endload(version_db, &callbacks.add_private); - if (result == ISC_R_SUCCESS) + ns_g_mctx); + eresult = dns_db_endload(db, &callbacks.add_private); + if (result != ISC_R_SUCCESS) result = eresult; if (result != ISC_R_SUCCESS) goto cleanup; - dns_zone_replacedb(version_zone, version_db, ISC_FALSE); + dns_zone_replacedb(zone, db, ISC_FALSE); - result = dns_view_addzone(version_view, version_zone); + result = dns_view_addzone(view, zone); if (result != DNS_R_SUCCESS) goto cleanup; - return (DNS_R_SUCCESS); + dns_view_freeze(view); + version_view = view; + view = NULL; + + result = ISC_R_SUCCESS; cleanup: - if (version_zone != NULL) - dns_zone_detach(&version_zone); - if (version_db != NULL) - dns_db_detach(&version_db); - if (version_view != NULL) - dns_view_detach(&version_view); + if (db != NULL) + dns_db_detach(&db); + if (zone != NULL) + dns_zone_detach(&zone); + if (view != NULL) + dns_view_detach(&view); return (result); } -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) - return (result); - - for (dbi = ISC_LIST_HEAD(ns_g_dbs); - dbi != NULL; - dbi = ISC_LIST_NEXT(dbi, link)) { - result = load(dbi, "default/IN"); - if (result != ISC_R_SUCCESS) - 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); -} - -static void -unload_all(void) { - ns_dbinfo_t *dbi, *dbi_next; - - for (dbi = ISC_LIST_HEAD(ns_g_dbs); dbi != NULL; dbi = dbi_next) { - dbi_next = ISC_LIST_NEXT(dbi, link); - if (dbi->view != NULL) { - INSIST(dbi->db != NULL); - dns_db_detach(&dbi->db); - dns_view_detach(&dbi->view); - } - isc_mem_free(ns_g_mctx, dbi->path); - isc_mem_free(ns_g_mctx, dbi->origin); - if (dbi->master != NULL) - isc_mem_free(ns_g_mctx, dbi->master); - ISC_LIST_UNLINK(ns_g_dbs, dbi, link); - isc_mem_put(ns_g_mctx, dbi, sizeof *dbi); - } - - if (version_view != NULL) { - INSIST(version_db != NULL); - dns_db_detach(&version_db); - dns_view_detach(&version_view); - } -} - -static void -load_configuration(void) { - isc_result_t result; - - result = server_config_load("/etc/named.conf", ns_g_mctx); - if (result != ISC_R_SUCCESS) { - printf("server_config_load(): %s\n", - isc_result_totext(result)); - /* XXX How do we make things die here? shutdown_server()?*/ - } - -#if 0 - /* - * XXXRTH loading code below is temporary; it - * will be replaced by proper config file processing. - */ - - result = load_all(); - if (result != ISC_R_SUCCESS) { - /* XXXRTH */ - printf("load_all(): %s\n", isc_result_totext(result)); - } -#endif -} - -static void -run_server(isc_task_t *task, isc_event_t *event) { - (void)task; - printf("server running\n"); - - load_configuration(); - ns_interfacemgr_scan(ns_g_interfacemgr); - - isc_event_free(&event); -} - static void shutdown_server(isc_task_t *task, isc_event_t *event) { dns_view_t *view, *view_next; @@ -365,7 +454,7 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { printf("server shutting down\n"); RWLOCK(&ns_g_viewlock, isc_rwlocktype_write); - unload_all(); + for (view = ISC_LIST_HEAD(ns_g_viewlist); view != NULL; view = view_next) { @@ -373,10 +462,18 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { ISC_LIST_UNLINK(ns_g_viewlist, view, link); dns_view_detach(&view); } - ISC_LIST_INIT(ns_g_viewlist); + + /* + * XXXRTH Is this the right place to do this? + */ + dns_c_ctx_delete(NULL /* XXX isc_log_t */, &ns_g_confctx); + RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write); + isc_task_detach(&server_task); + dns_view_detach(&version_view); + ns_rootns_destroy(); isc_event_free(&event); @@ -385,47 +482,28 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { isc_result_t ns_server_init(void) { isc_result_t result; - dns_view_t *view, *view_next; + /* + * Setup default root server hints. + */ 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. - */ - view = NULL; - result = dns_view_create(ns_g_mctx, dns_rdataclass_in, "default/IN", - &view); + result = create_version_view(); if (result != ISC_R_SUCCESS) - goto cleanup_views; - ISC_LIST_APPEND(ns_g_viewlist, view, link); - dns_view_sethints(view, ns_g_rootns); - /* - * XXXRTH hardwired number of tasks. Also, we'll need to see - * if we are dealing with a shared dispatcher in this view. - */ - result = dns_view_createresolver(view, ns_g_taskmgr, 16, - ns_g_socketmgr, ns_g_timermgr, - NULL); - if (result != ISC_R_SUCCESS) - goto cleanup_views; - view = NULL; - result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS", - &view); - if (result != ISC_R_SUCCESS) - goto cleanup_views; - ISC_LIST_APPEND(ns_g_viewlist, view, link); + return (result); + /* + * Setup the server task, which is responsible for coordinating + * startup and shutdown of the server. + */ result = isc_task_create(ns_g_taskmgr, ns_g_mctx, 0, &server_task); if (result != ISC_R_SUCCESS) - goto cleanup_views; - + goto cleanup_rootns; result = isc_task_onshutdown(server_task, shutdown_server, NULL); if (result != ISC_R_SUCCESS) goto cleanup_task; - result = isc_app_onrun(ns_g_mctx, server_task, run_server, NULL); if (result != ISC_R_SUCCESS) goto cleanup_task; @@ -435,182 +513,8 @@ ns_server_init(void) { cleanup_task: isc_task_detach(&server_task); - cleanup_views: - for (view = ISC_LIST_HEAD(ns_g_viewlist); - view != NULL; - view = view_next) { - view_next = ISC_LIST_NEXT(view, link); - ISC_LIST_UNLINK(ns_g_viewlist, view, link); - dns_view_detach(&view); - } - + cleanup_rootns: ns_rootns_destroy(); return (result); } - -static isc_result_t -server_config_load(const char *conffile, isc_mem_t *mem) -{ - dns_c_cbks_t callbacks; - dns_c_ctx_t *configctx = NULL; - isc_result_t res; - - - /* Set up callbacks for the parser. - * - * If zonecbk field is non-NULL, then the function it points to - * will be called after each zone statement is completely - * parsed. The zone will be passed in as a paramater, and also - * installed in the config structure, but after the zonecbk - * function returns it will be removed from the config - * structure. The zonecbkuap value will be passed through to the - * zonecbk function as a parameter. - * - * If the optscbk function is non-NULL, then it is called after the - * options statement is completely parsed. - * - * These functions must return ISC_R_SUCCESS, or the parser will - * consider that a failure and will terminate. The functions should - * not modify their parameters. - */ - - callbacks.zonecbk = zoneload; - callbacks.optscbk = NULL; - callbacks.zonecbkuap = NULL; - callbacks.optscbkuap = NULL; - - /* XXX should log rather than write to stderr */ - fprintf(stderr, "named: loading config file %s\n", conffile); - res = dns_c_parse_namedconf(NULL, /* XXX isc_log_t to use??? */ - conffile, mem, &configctx, - &callbacks); - - if (res != ISC_R_SUCCESS) { - /* XXX should log rather than write to stderr */ - fprintf(stderr, "named: failed to load config file %s\n", - conffile); - return (ISC_R_FAILURE); - } - - RWLOCK(&ns_g_confctxlock, isc_rwlocktype_write); - if (ns_g_confctx != NULL) { - dns_c_ctx_delete(NULL /* XXX isc_log_t */, &ns_g_confctx); - } - - ns_g_confctx = configctx; - - RWUNLOCK(&ns_g_confctxlock, isc_rwlocktype_write); - - return (ISC_R_SUCCESS); -} - - - -/* Function to be called whenever server must reload the config file, - e.g. on a SIGHUP. */ -static isc_result_t -server_config_reload(const char *conffile, isc_mem_t *mem) -{ - dns_c_cbks_t callbacks; - dns_c_ctx_t *configctx = NULL; - isc_result_t res; - - - /* Set up callbacks for the parser. See the comment in - * server_config_load() for usage. - */ - - callbacks.zonecbk = zonereload; - callbacks.optscbk = optionsreload; - callbacks.zonecbkuap = NULL; - callbacks.optscbkuap = NULL; - - /* XXX should log rather than write to stderr */ - fprintf(stderr, "named: reloading config file %s\n", conffile); - res = dns_c_parse_namedconf(NULL, /* XXX isc_log_t to use??? */ - conffile, mem, &configctx, &callbacks); - - if (res != ISC_R_SUCCESS) { - /* XXX should log rather than write to stderr */ - fprintf(stderr, "named: failed to reload config file %s\n", - conffile); - return (ISC_R_FAILURE); - } - - - RWLOCK(&ns_g_confctxlock, isc_rwlocktype_write); - if (ns_g_confctx != NULL) { - dns_c_ctx_delete(NULL /* XXX isc_log_t */, &ns_g_confctx); - } - - ns_g_confctx = configctx; - RWUNLOCK(&ns_g_confctxlock, isc_rwlocktype_write); - - return (ISC_R_SUCCESS); -} - - - -/* Called during first time config file is loaded. Called after each zone - * statement is parsed. - */ -static isc_result_t -zoneload(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) -{ - - /* - * returning anything other than ISC_R_SUCCESS will cause parsing to - * fail. - */ - return (dns_zone_callback(ctx, zone, view, uap)); -} - -static isc_result_t -zonereload(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) -{ - (void) ctx; (void) zone; (void) view; (void) uap; /* lint */ - - - /* - * returning anything other than ISC_R_SUCCESS will cause parsing to - * fail. - */ - - return (ISC_R_NOTIMPLEMENTED); -} - - - -/* Called the first time the config file is loaded after the options - * statment is parsed - */ -static isc_result_t -optionsload(dns_c_ctx_t *ctx, void *uap) -{ - (void) ctx; (void) uap; /* lint */ - - /* returning anything other than ISC_R_SUCCESS will cause parsing to - * fail. - */ - return (ISC_R_SUCCESS); -} - - - -/* Called the subsequent times the config file is loaded after the options - * statment is parsed - */ -static isc_result_t -optionsreload(dns_c_ctx_t *ctx, void *uap) -{ - (void) ctx; (void) uap; /* lint */ - - /* returning anything other than ISC_R_SUCCESS will cause parsing to - * fail. - */ - return (ISC_R_SUCCESS); -} - - -