server.c revision 24e49b2133ef3dd52839c56eab1c6b5c0d559bb0
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeintypedef struct {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeincreate_default_view(isc_mem_t *mctx, dns_rdataclass_t rdclass,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein result = dns_view_create(mctx, rdclass, "_default", &view);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein result = dns_db_create(mctx, "rbt", dns_rootname, ISC_TRUE,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * XXXRTH Temporary support for loading cache contents.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_db_load(view->cachedb, ns_g_cachefile);
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * XXXRTH hardwired number of tasks. Also, we'll need to
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * see if we are dealing with a shared dispatcher in this view.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_view_createresolver(view, ns_g_taskmgr, 16,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * We have default hints for class IN.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graffload_zone(dns_c_ctx_t *ctx, dns_c_zone_t *czone, dns_c_view_t *cview,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Load (or reload) a zone.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Find the view.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_viewlist_find(&lctx->viewlist, cview->name,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_viewlist_find(&lctx->viewlist, "_default",
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Create a default view.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = create_default_view(ctx->mem, czone->zclass,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Do we already have a production version of this view?
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_viewlist_find(&ns_g_viewlist, view->name, view->rdclass,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read);
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff if (result != ISC_R_NOTFOUND && result != ISC_R_SUCCESS)
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Create a new zone structure and configure it.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_zone_copy(ns_g_lctx, ctx, czone, zone);
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff if (dns_zone_gettype(zone) == dns_zone_hint) {
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Check for duplicates in the new zone table.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff result = dns_view_findzone(view, origin, &tzone);
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * We already have this zone!
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Do we have the zone in the production view?
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein result = dns_view_findzone(pview, origin, &tzone);
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * If the production zone's configuration is
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * the same as the new zone's, we can use the
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * production zone.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * This is a new zone.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff ns_server_fatal(NS_LOGMODULE_SERVER, ISC_FALSE,
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * XXXRTH Create default view, if required.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Freeze the views.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Attach the version view.
f9fdb43a912a53c44627449ace57921b143eef60Michael Graff * Load zones.
915723e4007e177b10c0e1c9d1bfe77ac2bfe853Michael Graff * Put the configuration into production.
915723e4007e177b10c0e1c9d1bfe77ac2bfe853Michael Graff RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write);
915723e4007e177b10c0e1c9d1bfe77ac2bfe853Michael Graff * Cleanup old configuration.
(void)task;
static isc_result_t
create_version_view(void) {
&view);
return (result);
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
(void)task;
ns_server_init(void) {
return (result);
return (result);
0, &ns_g_zonetasks);
return (result);
goto cleanup_rootns;
goto cleanup_task;
goto cleanup_task;
return (ISC_R_SUCCESS);
return (result);
const char *format, ...)
abort();