server.c revision fd70428a03d7e6c351276b3e87e418327c05fa49
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * Copyright (C) 1999-2001 Internet Software Consortium.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * Permission to use, copy, modify, and distribute this software for any
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * purpose with or without fee is hereby granted, provided that the above
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * copyright notice and this permission notice appear in all copies.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington/* $Id: server.c,v 1.280 2001/01/12 00:37:11 bwelling Exp $ */
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * Check an operation for failure. Assumes that the function
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * using it has a 'result' variable and a 'cleanup' label.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (result != ISC_R_SUCCESS) goto cleanup; \
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington } while (0) \
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington } while (0) \
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtontypedef struct {
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonfatal(const char *msg, isc_result_t result);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonns_server_reload(isc_task_t *task, isc_event_t *event);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonns_listenelt_fromconfig(dns_c_lstnon_t *celt, dns_c_ctx_t *cctx,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonns_listenlist_fromconfig(dns_c_lstnlist_t *clist, dns_c_ctx_t *cctx,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isc_mem_t *mctx, ns_listenlist_t **target);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonconfigure_forward(dns_c_ctx_t *cctx, dns_c_zone_t *czone, dns_c_view_t *cview,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * Configure a single view ACL at '*aclp'. Get its configuration by
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * calling 'getvcacl' (for per-view configuration) and maybe 'getscacl'
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * (for a global default).
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * No value available. *aclp == NULL.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington result = ns_acl_fromconfig(cacl, cctx, actx, mctx, aclp);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonconfigure_view_dnsseckey(dns_c_view_t *cview, dns_c_tkey_t *ckey,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington keystruct.common.rdtype = dns_rdatatype_key;
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * The key data in keystruct is not
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * dynamically allocated.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington CHECK(isc_base64_decodestring(mctx, ckey->pubkey->key,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isc_buffer_add(&namebuf, strlen(ckey->domain));
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington CHECK(dns_keytable_add(keytable, &dstkey));
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington "configuring trusted key for '%s': "
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * Configure DNSSEC keys for a view. Currently used only for
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * the security roots.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * The per-view configuration values and their server-global
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * defaults are are read from 'cview' and 'cctx' using
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * the function 'cgetv' and 'cgets', respectively.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * The variable to be configured is '*target'.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonconfigure_view_dnsseckeys(dns_c_view_t *cview,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington CHECK(dns_keytable_create(mctx, &keytable));
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington for (ckey = ISC_LIST_HEAD(ckeys->tkeylist);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington CHECK(configure_view_dnsseckey(cview, ckey,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington *target = keytable; /* Transfer ownership. */
return (result);
static isc_result_t
switch (af) {
case AF_INET:
case AF_INET6:
INSIST(0);
switch (af) {
case AF_INET:
case AF_INET6:
INSIST(0);
return (ISC_R_SUCCESS);
attrs = 0;
switch (af) {
case AF_INET:
case AF_INET6:
attrmask = 0;
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
&pview);
goto cleanup;
max_cache_size = 0;
max_cache_size = 0;
&dispatch4));
&dispatch6));
0, ns_g_dispatchmgr,
goto cleanup;
goto cleanup;
if (p == NULL) {
goto cleanup;
return (result);
static isc_result_t
return (result);
static isc_result_t
char *versiontext;
isc_region_t r;
return (result);
static isc_result_t
static const char *authors[] = {
NULL,
return (result);
static isc_result_t
return (result);
static isc_result_t
if (ns_g_port != 0) {
goto cleanup;
goto cleanup;
return (result);
static isc_result_t
const char *viewname;
return (result);
return (ISC_R_SUCCESS);
return (result);
return (result);
return (ISC_R_SUCCESS);
* is called after parsing each "zone" statement in named.conf.
static isc_result_t
void *uap)
char *corigin;
goto cleanup;
corigin);
goto cleanup;
corigin);
goto cleanup;
goto cleanup;
goto cleanup;
&pview);
goto cleanup;
goto cleanup;
return (result);
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
if (p == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
if (p == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
value); \
static isc_result_t
char *pidfilename;
char *statsfilename;
char *dumpfilename;
char *randomdev;
#ifdef PATH_RANDOMDEV
filename);
&callbacks);
if (ns_g_port != 0) {
cctx,
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
cctx,
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
if (interface_interval == 0) {
if (heartbeat_interval == 0) {
&aclconfctx));
goto cleanup;
if (first_time) {
#ifdef PATH_RANDOMDEV
if (first_time)
* files specified in named.conf get created by the
if (ns_g_logstderr) {
if (first_time) {
else if (ns_g_lwresdonly)
return (result);
static isc_result_t
return (result);
if (ns_g_lwresdonly)
ISC_TRUE),
if (flush)
sizeof(isc_event_t));
if (ns_g_lwresdonly)
char *res;
return (res);
static isc_result_t
const char *zonetxt;
char *classtxt;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
goto fail1;
goto fail1;
goto fail1;
goto fail2;
return (result);
return (result);
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (result);
return (result);
return (ISC_R_SUCCESS);
int ncounters;
for (i = 0; i < ncounters; i++)
char *viewname;
for (i = 0; i < ncounters; i++) {
zonestats[i],
zonename);
return (result);
return (result);