server.c revision 6a7a69e9f764812872ec2db775be2ac8bb073102
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * 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
1633838b8255282d10af15c5c84cee5a51466712Bob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id: server.c,v 1.331 2001/06/18 20:03:48 gson Exp $ */
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews * Check an operation for failure. Assumes that the function
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews * using it has a 'result' variable and a 'cleanup' label.
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley } while (0) \
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halleyns_server_reload(isc_task_t *task, isc_event_t *event);
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halleyns_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config,
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halleyns_listenlist_fromconfig(cfg_obj_t *listenlist, cfg_obj_t *config,
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrenceconfigure_forward(cfg_obj_t *config, dns_view_t *view, dns_name_t *origin,
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence cfg_obj_t *forwarders, cfg_obj_t *forwardtype);
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrenceconfigure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig,
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * Configure a single view ACL at '*aclp'. Get its configuration by
3740b569ae76295b941d57a724a43beb75b533baBob Halley * calling 'getvcacl' (for per-view configuration) and maybe 'getscacl'
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halley * (for a global default).
4bed2e84a34b37259b85e5c092d51c122ef58c3cBob Halleyconfigure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config,
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence result = ns_config_get(maps, aclname, &aclobj);
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews * No value available. *aclp == NULL.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence result = ns_acl_fromconfig(aclobj, config, actx, mctx, aclp);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrenceconfigure_view_dnsseckey(cfg_obj_t *vconfig, cfg_obj_t *key,
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence flags = cfg_obj_asuint32(cfg_tuple_get(key, "flags"));
94e25967cda41b886e33ec254b917d21df21a187Bob Halley proto = cfg_obj_asuint32(cfg_tuple_get(key, "protocol"));
94e25967cda41b886e33ec254b917d21df21a187Bob Halley alg = cfg_obj_asuint32(cfg_tuple_get(key, "algorithm"));
94e25967cda41b886e33ec254b917d21df21a187Bob Halley keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
afdb3abb9b06ed4070ac9021f1f4427b4cb3a286Bob Halley cfg_obj_t *classobj = cfg_tuple_get(vconfig, "class");
4b87939256ede703385e9cab92d3c58d03c31098Mark Andrews * The key data in keystruct is not dynamically allocated.
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
70ec7dd74103fa9e92a6d56a0e3b0fc30e17af0dMark Andrews keystr = cfg_obj_asstring(cfg_tuple_get(key, "key"));
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence CHECK(isc_base64_decodestring(keystr, &keydatabuf));
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence isc_buffer_init(&namebuf, keynamestr, strlen(keynamestr));
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence "configuring trusted key for '%s': %s",
94e25967cda41b886e33ec254b917d21df21a187Bob Halley * Configure DNSSEC keys for a view. Currently used only for
94e25967cda41b886e33ec254b917d21df21a187Bob Halley * the security roots.
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson * The per-view configuration values and the server-global defaults are read
26f327f1f53afdb8256affa1c197ed138bf3cb2fAndreas Gustafsson * from 'vconfig' and 'config'. The variable to be configured is '*target'.
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrenceconfigure_view_dnsseckeys(cfg_obj_t *vconfig, cfg_obj_t *config,
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence (void)cfg_map_get(voptions, "trusted-keys", &keys);
94e25967cda41b886e33ec254b917d21df21a187Bob Halley (void)cfg_map_get(config, "trusted-keys", &keys);
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence * Get a dispatch appropriate for the resolver of a given view.
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrenceget_view_querysource_dispatch(cfg_obj_t **maps,
4ad9b25e6ddf948ffb3b8198c5540d251f26c52eDavid Lawrence * Make compiler happy.
114d0d1642b5ede0ab154532159fe38c30762d82David Lawrence result = ns_config_get(maps, "query-source", &obj);
585529aaeb95a71cd3d95df2602a4688fc7c3292David Lawrence result = ns_config_get(maps, "query-source-v6", &obj);
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * If we don't support this address family, we're done!
6fa1cb5754695d550a58c6e8978fda65f5146af7David Lawrence * Try to find a dispatcher that we can share.
114d0d1642b5ede0ab154532159fe38c30762d82David Lawrence result = dns_dispatch_getudp(ns_g_dispatchmgr, ns_g_socketmgr,
c8563aaf86c04f0e2284bcc8e444a0651c157ea0Andreas Gustafsson isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
c8563aaf86c04f0e2284bcc8e444a0651c157ea0Andreas Gustafsson "could not get query source dispatcher");
a6f0e9c985220f0e4509777e6528afb64e0ad576Mukund Sivaramanconfigure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews sa = cfg_obj_assockaddr(cfg_map_getname(cpeer));
789252d55f025db52ee02aa933c9f09a4aadfa97Evan Hunt dns_peer_setprovideixfr(peer, cfg_obj_asboolean(obj));
a147de10fe5e19e593d42152ffd6879eca69860dEvan Hunt dns_peer_setrequestixfr(peer, cfg_obj_asboolean(obj));
789252d55f025db52ee02aa933c9f09a4aadfa97Evan Hunt dns_peer_setsupportedns(peer, cfg_obj_asboolean(obj));
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews dns_peer_settransfers(peer, cfg_obj_asuint32(obj));
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews (void)cfg_map_get(cpeer, "transfer-format", &obj);
186e7f37c9fc985a7a7264cc8170e48a25bed434Mark Andrews dns_peer_settransferformat(peer, dns_many_answers);
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;
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);
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;
forwardtype));
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));
&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);
static isc_result_t
return (result);
if (ns_g_lwresdonly)
ISC_TRUE),
if (flush)
sizeof(isc_event_t));
static isc_result_t
return (result);
cleanup: ;
cleanup: ;
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 (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);
return (ISC_R_UNEXPECTEDEND);
goto out;
if (flushed)
out:
return (result);
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);