1999-01-19 06:32:53 +00:00
|
|
|
/*
|
1999-03-06 03:55:54 +00:00
|
|
|
* Copyright (C) 1999 Internet Software Consortium.
|
1999-01-19 06:32:53 +00:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
|
|
|
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
|
|
|
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
|
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
|
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <isc/assertions.h>
|
|
|
|
#include <isc/error.h>
|
1999-08-05 22:14:43 +00:00
|
|
|
#include <isc/rwlock.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
#include <isc/mem.h>
|
|
|
|
#include <isc/task.h>
|
|
|
|
#include <isc/thread.h>
|
|
|
|
#include <isc/result.h>
|
|
|
|
#include <isc/socket.h>
|
|
|
|
#include <isc/timer.h>
|
1999-05-27 01:51:31 +00:00
|
|
|
#include <isc/app.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
|
|
|
|
#include <dns/types.h>
|
|
|
|
#include <dns/result.h>
|
1999-08-05 22:14:43 +00:00
|
|
|
#include <dns/master.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
#include <dns/name.h>
|
1999-05-03 19:56:23 +00:00
|
|
|
#include <dns/fixedname.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
#include <dns/rdata.h>
|
|
|
|
#include <dns/rdatalist.h>
|
|
|
|
#include <dns/rdataset.h>
|
1999-05-03 19:56:23 +00:00
|
|
|
#include <dns/rdatasetiter.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
#include <dns/compress.h>
|
1999-01-31 12:31:31 +00:00
|
|
|
#include <dns/db.h>
|
1999-05-03 19:56:23 +00:00
|
|
|
#include <dns/dbtable.h>
|
1999-04-30 05:42:06 +00:00
|
|
|
#include <dns/message.h>
|
1999-08-20 06:05:07 +00:00
|
|
|
#include <dns/journal.h>
|
1999-08-05 22:14:43 +00:00
|
|
|
#include <dns/view.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
#include <named/types.h>
|
|
|
|
#include <named/globals.h>
|
1999-09-24 01:42:22 +00:00
|
|
|
#include <named/rootns.h>
|
1999-07-24 01:16:38 +00:00
|
|
|
#include <named/server.h>
|
1999-08-27 18:30:00 +00:00
|
|
|
#include <named/xfrin.h>
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-08-05 22:14:43 +00:00
|
|
|
#include "../../isc/util.h" /* XXXRTH */
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
static isc_task_t * server_task;
|
1999-08-05 22:14:43 +00:00
|
|
|
static dns_db_t * version_db;
|
|
|
|
static dns_view_t * version_view;
|
1999-01-31 12:31:31 +00:00
|
|
|
|
1999-05-03 19:56:23 +00:00
|
|
|
static dns_result_t
|
1999-08-05 22:14:43 +00:00
|
|
|
load(ns_dbinfo_t *dbi, char *view_name) {
|
1999-05-03 19:56:23 +00:00
|
|
|
dns_fixedname_t forigin;
|
|
|
|
dns_name_t *origin;
|
|
|
|
dns_result_t result;
|
|
|
|
isc_buffer_t source;
|
|
|
|
size_t len;
|
1999-08-05 22:14:43 +00:00
|
|
|
dns_view_t *view;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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, view->name) == 0) {
|
|
|
|
dns_view_attach(view, &dbi->view);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read);
|
|
|
|
if (view == NULL)
|
|
|
|
return (DNS_R_NOTFOUND);
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
len = strlen(dbi->origin);
|
|
|
|
isc_buffer_init(&source, dbi->origin, len, ISC_BUFFERTYPE_TEXT);
|
1999-05-03 19:56:23 +00:00
|
|
|
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)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto view_detach;
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
result = dns_db_create(ns_g_mctx, "rbt", origin, dbi->iscache,
|
1999-08-05 22:14:43 +00:00
|
|
|
view->rdclass, 0, NULL, &dbi->db);
|
1999-08-05 01:51:32 +00:00
|
|
|
if (result != DNS_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto view_detach;
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
printf("loading %s (%s)\n", dbi->path, dbi->origin);
|
|
|
|
result = dns_db_load(dbi->db, dbi->path);
|
1999-08-20 06:05:07 +00:00
|
|
|
|
1999-08-27 18:30:00 +00:00
|
|
|
if (result != DNS_R_SUCCESS) {
|
|
|
|
if (dbi->isslave) {
|
|
|
|
/* Ignore the error, just leave dbi->db == NULL. */
|
|
|
|
dns_db_detach(&dbi->db);
|
|
|
|
return (DNS_R_SUCCESS);
|
|
|
|
} else {
|
|
|
|
goto db_detach;
|
|
|
|
}
|
|
|
|
}
|
1999-08-05 22:14:43 +00:00
|
|
|
|
1999-05-03 19:56:23 +00:00
|
|
|
printf("loaded\n");
|
1999-08-20 06:05:07 +00:00
|
|
|
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... */
|
|
|
|
}
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-09-22 18:24:35 +00:00
|
|
|
if (dbi->iscache)
|
|
|
|
dns_view_setcachedb(view, dbi->db);
|
1999-09-22 19:46:46 +00:00
|
|
|
else if (dns_view_addzonedb(view, dbi->db) != DNS_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto db_detach;
|
|
|
|
|
|
|
|
return (DNS_R_SUCCESS);
|
|
|
|
|
|
|
|
db_detach:
|
|
|
|
dns_db_detach(&dbi->db);
|
|
|
|
|
|
|
|
view_detach:
|
|
|
|
dns_view_detach(&dbi->view);
|
|
|
|
|
|
|
|
return (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
static isc_result_t
|
|
|
|
load_version(void) {
|
|
|
|
dns_fixedname_t forigin;
|
|
|
|
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;
|
|
|
|
char version_text[1024];
|
|
|
|
|
|
|
|
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) {
|
|
|
|
version_view = NULL;
|
|
|
|
dns_view_attach(view, &version_view);
|
|
|
|
break;
|
1999-05-03 19:56:23 +00:00
|
|
|
}
|
1999-08-05 22:14:43 +00:00
|
|
|
}
|
|
|
|
RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_read);
|
|
|
|
if (view == NULL)
|
|
|
|
return (DNS_R_NOTFOUND);
|
|
|
|
|
|
|
|
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)
|
|
|
|
goto view_detach;
|
|
|
|
|
|
|
|
version_db = NULL;
|
|
|
|
result = dns_db_create(ns_g_mctx, "rbt", origin, ISC_FALSE,
|
|
|
|
view->rdclass, 0, NULL, &version_db);
|
|
|
|
if (result != DNS_R_SUCCESS)
|
|
|
|
goto view_detach;
|
|
|
|
|
|
|
|
dns_rdatacallbacks_init(&callbacks);
|
|
|
|
|
|
|
|
len = strlen(version_text);
|
|
|
|
isc_buffer_init(&source, version_text, len, ISC_BUFFERTYPE_TEXT);
|
|
|
|
isc_buffer_add(&source, len);
|
|
|
|
|
1999-09-22 18:24:35 +00:00
|
|
|
result = dns_db_beginload(version_db, &callbacks.add,
|
|
|
|
&callbacks.add_private);
|
1999-08-05 22:14:43 +00:00
|
|
|
if (result != DNS_R_SUCCESS)
|
|
|
|
return (result);
|
1999-09-22 18:24:35 +00:00
|
|
|
result = dns_master_loadbuffer(&source, &version_db->origin,
|
|
|
|
&version_db->origin,
|
|
|
|
version_db->rdclass, ISC_FALSE,
|
|
|
|
&soacount, &nscount, &callbacks,
|
|
|
|
version_db->mctx);
|
1999-08-05 22:14:43 +00:00
|
|
|
eresult = dns_db_endload(version_db, &callbacks.add_private);
|
|
|
|
if (result == ISC_R_SUCCESS)
|
|
|
|
result = eresult;
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
goto db_detach;
|
|
|
|
|
1999-09-22 19:46:46 +00:00
|
|
|
if (dns_view_addzonedb(version_view, version_db) != DNS_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto db_detach;
|
1999-05-03 19:56:23 +00:00
|
|
|
|
|
|
|
return (DNS_R_SUCCESS);
|
1999-08-05 22:14:43 +00:00
|
|
|
|
|
|
|
db_detach:
|
|
|
|
dns_db_detach(&version_db);
|
|
|
|
|
|
|
|
view_detach:
|
|
|
|
dns_view_detach(&version_view);
|
|
|
|
|
|
|
|
return (result);
|
1999-05-03 19:56:23 +00:00
|
|
|
}
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
static isc_result_t
|
|
|
|
load_all(void) {
|
|
|
|
isc_result_t result = ISC_R_SUCCESS;
|
|
|
|
ns_dbinfo_t *dbi;
|
1999-09-24 01:42:22 +00:00
|
|
|
dns_view_t *view;
|
1999-07-24 01:16:38 +00:00
|
|
|
|
1999-08-05 22:14:43 +00:00
|
|
|
result = load_version();
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
return (result);
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
for (dbi = ISC_LIST_HEAD(ns_g_dbs);
|
|
|
|
dbi != NULL;
|
|
|
|
dbi = ISC_LIST_NEXT(dbi, link)) {
|
1999-08-05 22:14:43 +00:00
|
|
|
result = load(dbi, "default/IN");
|
1999-07-24 01:16:38 +00:00
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-09-24 01:42:22 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
return (result);
|
|
|
|
}
|
|
|
|
|
1999-05-03 19:56:23 +00:00
|
|
|
static void
|
|
|
|
unload_all(void) {
|
1999-07-24 01:16:38 +00:00
|
|
|
ns_dbinfo_t *dbi, *dbi_next;
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
for (dbi = ISC_LIST_HEAD(ns_g_dbs); dbi != NULL; dbi = dbi_next) {
|
1999-05-03 19:56:23 +00:00
|
|
|
dbi_next = ISC_LIST_NEXT(dbi, link);
|
1999-08-05 22:14:43 +00:00
|
|
|
if (dbi->view != NULL) {
|
|
|
|
INSIST(dbi->db != NULL);
|
1999-08-05 01:51:32 +00:00
|
|
|
dns_db_detach(&dbi->db);
|
1999-08-05 22:14:43 +00:00
|
|
|
dns_view_detach(&dbi->view);
|
1999-05-03 19:56:23 +00:00
|
|
|
}
|
1999-08-27 18:30:00 +00:00
|
|
|
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);
|
1999-07-24 01:16:38 +00:00
|
|
|
ISC_LIST_UNLINK(ns_g_dbs, dbi, link);
|
|
|
|
isc_mem_put(ns_g_mctx, dbi, sizeof *dbi);
|
1999-05-03 19:56:23 +00:00
|
|
|
}
|
1999-08-05 22:14:43 +00:00
|
|
|
|
|
|
|
if (version_view != NULL) {
|
|
|
|
INSIST(version_db != NULL);
|
|
|
|
dns_db_detach(&version_db);
|
|
|
|
dns_view_detach(&version_view);
|
|
|
|
}
|
1999-05-03 19:56:23 +00:00
|
|
|
}
|
1999-01-29 06:18:43 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
static void
|
|
|
|
load_configuration(void) {
|
|
|
|
isc_result_t result;
|
1999-01-31 12:31:31 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
/*
|
|
|
|
* XXXRTH loading code below is temporary; it
|
|
|
|
* will be replaced by proper config file processing.
|
|
|
|
*/
|
1999-01-31 12:31:31 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
result = load_all();
|
|
|
|
if (result != ISC_R_SUCCESS) {
|
|
|
|
/* XXXRTH */
|
|
|
|
printf("load_all(): %s\n", isc_result_totext(result));
|
|
|
|
}
|
|
|
|
}
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
static void
|
|
|
|
run_server(isc_task_t *task, isc_event_t *event) {
|
|
|
|
(void)task;
|
|
|
|
printf("server running\n");
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
load_configuration();
|
1999-10-07 19:44:22 +00:00
|
|
|
ns_interfacemgr_scan(ns_g_interfacemgr);
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
isc_event_free(&event);
|
|
|
|
}
|
1999-01-28 05:52:20 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
static void
|
|
|
|
shutdown_server(isc_task_t *task, isc_event_t *event) {
|
1999-08-05 22:14:43 +00:00
|
|
|
dns_view_t *view, *view_next;
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
(void)task;
|
1999-08-05 22:14:43 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
printf("server shutting down\n");
|
1999-08-05 22:14:43 +00:00
|
|
|
|
|
|
|
RWLOCK(&ns_g_viewlock, isc_rwlocktype_write);
|
1999-07-24 01:16:38 +00:00
|
|
|
unload_all();
|
1999-08-05 22:14:43 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
ISC_LIST_INIT(ns_g_viewlist);
|
|
|
|
RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write);
|
1999-07-24 01:16:38 +00:00
|
|
|
isc_task_detach(&server_task);
|
1999-08-05 22:14:43 +00:00
|
|
|
|
1999-09-24 01:42:22 +00:00
|
|
|
ns_rootns_destroy();
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
isc_event_free(&event);
|
|
|
|
}
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
isc_result_t
|
|
|
|
ns_server_init(void) {
|
|
|
|
isc_result_t result;
|
1999-08-05 22:14:43 +00:00
|
|
|
dns_view_t *view, *view_next;
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-09-24 01:42:22 +00:00
|
|
|
result = ns_rootns_init();
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
return (result);
|
|
|
|
|
1999-08-05 22:14:43 +00:00
|
|
|
/*
|
1999-08-12 07:53:05 +00:00
|
|
|
* XXXRTH The view management code here will probably move to its
|
|
|
|
* own module when we start using the config file.
|
1999-08-05 22:14:43 +00:00
|
|
|
*/
|
|
|
|
view = NULL;
|
|
|
|
result = dns_view_create(ns_g_mctx, dns_rdataclass_in, "default/IN",
|
1999-09-22 18:24:35 +00:00
|
|
|
&view);
|
1999-07-24 01:16:38 +00:00
|
|
|
if (result != ISC_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto cleanup_views;
|
|
|
|
ISC_LIST_APPEND(ns_g_viewlist, view, link);
|
1999-09-24 01:42:22 +00:00
|
|
|
dns_view_sethints(view, ns_g_rootns);
|
1999-10-07 19:44:22 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
1999-08-05 22:14:43 +00:00
|
|
|
view = NULL;
|
|
|
|
result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS",
|
1999-09-22 18:24:35 +00:00
|
|
|
&view);
|
1999-08-05 01:51:32 +00:00
|
|
|
if (result != ISC_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto cleanup_views;
|
|
|
|
ISC_LIST_APPEND(ns_g_viewlist, view, link);
|
1999-05-03 19:56:23 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
result = isc_task_create(ns_g_taskmgr, ns_g_mctx, 0, &server_task);
|
|
|
|
if (result != ISC_R_SUCCESS)
|
1999-08-05 22:14:43 +00:00
|
|
|
goto cleanup_views;
|
1999-05-26 06:48:26 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
result = isc_task_onshutdown(server_task, shutdown_server, NULL);
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
goto cleanup_task;
|
1999-05-27 01:51:31 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
result = isc_app_onrun(ns_g_mctx, server_task, run_server, NULL);
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
goto cleanup_task;
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
return (ISC_R_SUCCESS);
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
cleanup_task:
|
|
|
|
isc_task_detach(&server_task);
|
1999-01-19 06:32:53 +00:00
|
|
|
|
1999-08-05 22:14:43 +00:00
|
|
|
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);
|
|
|
|
}
|
1999-05-27 01:51:31 +00:00
|
|
|
|
1999-09-24 01:42:22 +00:00
|
|
|
ns_rootns_destroy();
|
|
|
|
|
1999-07-24 01:16:38 +00:00
|
|
|
return (result);
|
1999-01-19 06:32:53 +00:00
|
|
|
}
|