server.c revision 58eb053ed266c0d2fa8d6edc10b39a515afeba6b
e20788e1216ed720aefa84f3295f7899d9f28c22Mark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * copyright notice and this permission notice appear in all copies.
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1fa26403d7679235a30fbf6289f68fed5872df30Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
36e97eb661df71069df2d75f5fd3b5bb0dcf1efeMark Andrews/* $Id: server.c,v 1.294 2001/03/05 17:20:48 halley Exp $ */
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence * Check an operation for failure. Assumes that the function
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence * using it has a 'result' variable and a 'cleanup' label.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence } while (0) \
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence } while (0) \
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrencens_server_reload(isc_task_t *task, isc_event_t *event);
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrencens_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config,
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrencens_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config,
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrenceconfigure_forward(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig,
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrenceconfigure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig,
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * Configure a single view ACL at '*aclp'. Get its configuration by
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * calling 'getvcacl' (for per-view configuration) and maybe 'getscacl'
ecffc3aae3e72c5c65b1911ec3f4e1d180dc4bbcMark Andrews * (for a global default).
ecffc3aae3e72c5c65b1911ec3f4e1d180dc4bbcMark Andrewsconfigure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config,
578f588228f5e04ccf648b6ae596f396ad6a22c9Mark Andrews result = ns_config_get(maps, aclname, &aclobj);
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer * No value available. *aclp == NULL.
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer result = ns_acl_fromconfig(aclobj, config, actx, mctx, aclp);
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayerconfigure_view_dnsseckey(cfg_obj_t *vconfig, cfg_obj_t *key,
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence flags = cfg_obj_asuint32(cfg_tuple_get(key, "flags"));
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence proto = cfg_obj_asuint32(cfg_tuple_get(key, "protocol"));
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence alg = cfg_obj_asuint32(cfg_tuple_get(key, "algorithm"));
4d6329c1b3c80f82880291ae35f68f84c14ad820Francis Dupont keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
36e97eb661df71069df2d75f5fd3b5bb0dcf1efeMark Andrews cfg_obj_t *classobj = cfg_tuple_get(vconfig, "class");
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer CHECK(ns_config_getclass(classobj, &viewclass));
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews * The key data in keystruct is not dynamically allocated.
c213258356638f9af1e1c68425df527b856567a2Francis Dupont isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews keystr = cfg_obj_asstring(cfg_tuple_get(key, "key"));
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer CHECK(isc_base64_decodestring(mctx, keystr, &keydatabuf));
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer isc_buffer_init(&namebuf, keynamestr, strlen(keynamestr));
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayer "configuring trusted key for '%s': %s",
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * Configure DNSSEC keys for a view. Currently used only for
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * the security roots.
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * The per-view configuration values and the server-global defaults are read
6ceca14e5ea7972a9ba8bc1dca0de1f63f669cfdDanny Mayer * from 'vconfig' and 'config'. The variable to be configured is '*target'.
d3243476c280d3a98cadbfd6343437fa2b29356bDanny Mayerconfigure_view_dnsseckeys(cfg_obj_t *vconfig, cfg_obj_t *config,
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews (void)cfg_map_get(voptions, "trusted-keys", &keys);
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews (void)cfg_map_get(config, "trusted-keys", &keys);
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt * Get a dispatch appropriate for the resolver of a given view.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews * Make compiler happy.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews result = ns_config_get(maps, "query-source", &obj);
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews result = ns_config_get(maps, "query-source-v6", &obj);
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * If we don't support this address family, we're done!
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt * Try to find a dispatcher that we can share.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews result = dns_dispatch_getudp(ns_g_dispatchmgr, ns_g_socketmgr,
891b61c3909afdae7e5d7ba14cd12d16186f4a68Mark Andrews isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
891b61c3909afdae7e5d7ba14cd12d16186f4a68Mark Andrews "could not get query source dispatcher");
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Huntconfigure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
INSIST(0);
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
char *str;
actx));
&pview);
goto cleanup;
if (!reused_cache)
value);
goto cleanup;
max_cache_size = 0;
0, ns_g_dispatchmgr,
INSIST(0);
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 (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (result);
static isc_result_t
return (ISC_R_RANGE);
goto cleanup;
INSIST(0);
goto cleanup;
return (result);
static isc_result_t
const char *viewname;
return (ISC_R_EXISTS);
return (result);
return (result);
return (ISC_R_SUCCESS);
* is called after parsing each "zone" statement in named.conf.
static isc_result_t
const char *zname;
const char *ztypestr;
goto cleanup;
return (ISC_R_FAILURE);
zname);
goto cleanup;
zname);
goto cleanup;
goto cleanup;
goto cleanup;
&pview);
goto cleanup;
goto cleanup;
return (result);
static isc_result_t
char *directory;
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);
char *resource;
static isc_result_t
if (first_time) {
&ns_g_defaults) ==
filename);
&config);
* option where the above parsing failed, parse resolv.conf.
if (ns_g_lwresdonly &&
&config);
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
if (interface_interval == 0) {
if (heartbeat_interval == 0) {
&aclconfctx));
if (first_time) {
if (first_time)
* files specified in named.conf get created by the
if (ns_g_logstderr) {
if (first_time) {
char *str;
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 (ISC_R_RANGE);
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);
char *ptr;
char *levelstr;
char *endp;
long newlevel;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);