server.c revision dfbda37366414b6302ad7da2999d0c340705c452
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
fcb54ce0a4f7377486df5bec83b3aa4711bf4131Mark Andrews * Copyright (C) 1999-2003 Internet Software Consortium.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Permission to use, copy, modify, and/or distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
2da53322f30495e9bcf30f3776def2da329d3343Mark Andrews/* $Id: server.c,v 1.574 2010/07/19 04:13:38 marka Exp $ */
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Check an operation for failure. Assumes that the function
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * using it has a 'result' variable and a 'cleanup' label.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence } while (0) \
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence } while (0) \
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence } while (0) \
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Maximum ADB size for views that share a cache. Use this limit to suppress
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * the total of memory footprint, which should be the main reason for sharing
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * a cache. Only effective when a finite max-cache-size is specified.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * This is currently defined to be 8MB.
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews * These zones should not leak onto the Internet.
b6a0341bcb113e93bd0bc41a9f9a1fc117444da6Mark Andrewsstatic const struct {
b6a0341bcb113e93bd0bc41a9f9a1fc117444da6Mark Andrews const char *zone;
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews /* RFC 1918 */
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews /* RFC 5735 and RFC 5737 */
f6407f9a0b890bebbfd5f738d9c4aef3d3315fe9Michael Graff { "0.IN-ADDR.ARPA", ISC_FALSE }, /* THIS NETWORK */
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews { "127.IN-ADDR.ARPA", ISC_FALSE }, /* LOOPBACK */
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews { "254.169.IN-ADDR.ARPA", ISC_FALSE }, /* LINK LOCAL */
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews { "2.0.192.IN-ADDR.ARPA", ISC_FALSE }, /* TEST NET */
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews { "100.51.198.IN-ADDR.ARPA", ISC_FALSE }, /* TEST NET 2 */
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews { "113.0.203.IN-ADDR.ARPA", ISC_FALSE }, /* TEST NET 3 */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "255.255.255.255.IN-ADDR.ARPA", ISC_FALSE }, /* BROADCAST */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews /* Local IPv6 Unicast Addresses */
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews { "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA", ISC_FALSE },
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews { "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA", ISC_FALSE },
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews /* LOCALLY ASSIGNED LOCAL ADDRESS SCOPE */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "8.E.F.IP6.ARPA", ISC_FALSE }, /* LINK LOCAL */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "9.E.F.IP6.ARPA", ISC_FALSE }, /* LINK LOCAL */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "A.E.F.IP6.ARPA", ISC_FALSE }, /* LINK LOCAL */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "B.E.F.IP6.ARPA", ISC_FALSE }, /* LINK LOCAL */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews /* Example Prefix, RFC 3849. */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews /* ORCHID Prefix, RFC 4843. */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsfatal(const char *msg, isc_result_t result) ISC_PLATFORM_NORETURN_POST;
f1cae4bcb7ee3060d893f5ab3ba55c1820bf3e4aBrian Wellingtonns_server_reload(isc_task_t *task, isc_event_t *event);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrewsns_listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
6c29053a20f7614167bafa4388c666644a095349Andreas Gustafsson isc_mem_t *mctx, ns_listenelt_t **target);
5d2026ea7b5ae43bbd69d98b747f75ba3290bef1Mark Andrewsns_listenlist_fromconfig(const cfg_obj_t *listenlist, const cfg_obj_t *config,
6c29053a20f7614167bafa4388c666644a095349Andreas Gustafsson isc_mem_t *mctx, ns_listenlist_t **target);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrewsconfigure_forward(const cfg_obj_t *config, dns_view_t *view, dns_name_t *origin,
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews const cfg_obj_t *forwarders, const cfg_obj_t *forwardtype);
368b37b616234fce3d23099eb180f1dd38e1fb62Mark Andrewsconfigure_alternates(const cfg_obj_t *config, dns_view_t *view,
389c749a5ee18f1c0d6278ae49f2aae5d5f0d2dcMark Andrewsconfigure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
389c749a5ee18f1c0d6278ae49f2aae5d5f0d2dcMark Andrewsadd_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx);
389c749a5ee18f1c0d6278ae49f2aae5d5f0d2dcMark Andrewsend_reserved_dispatches(ns_server_t *server, isc_boolean_t all);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews * Stores config for building zones after the fact
f1cae4bcb7ee3060d893f5ab3ba55c1820bf3e4aBrian Wellington * Configure a single view ACL at '*aclp'. Get its configuration from
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews * 'vconfig' (for per-view configuration) and maybe from 'config'
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrewsconfigure_view_acl(const cfg_obj_t *vconfig, const cfg_obj_t *config,
29c818c7d40fc8898b062903ec703851328a4deaMark Andrews cfg_aclconfctx_t *actx, isc_mem_t *mctx, dns_acl_t **aclp)
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews (void)cfg_map_get(config, "options", &options);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * No value available. *aclp == NULL.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * If the ACL is given in an optional tuple, retrieve it.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * The parser should have ensured that a valid object be
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews result = cfg_acl_fromconfig(aclobj, config, ns_g_lctx,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Configure a sortlist at '*aclp'. Essentially the same as
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * configure_view_acl() except it calls cfg_acl_fromconfig with a
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * nest_level value of 2.
d981ca645597116d227a48bf37cc5edc061c854dBob Halleyconfigure_view_sortlist(const cfg_obj_t *vconfig, const cfg_obj_t *config,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(config, "options", &options);
19d365e4448f1782611280b020987988b7ac3210Mark Andrews (void)ns_config_get(maps, "sortlist", &aclobj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Use a nest level of 3 for the "top level" of the sortlist;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * this means each entry in the top three levels will be stored
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff * as lists of separate, nested ACLs, rather than merged together
d981ca645597116d227a48bf37cc5edc061c854dBob Halley * into IP tables as is usually done with ACLs.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews result = cfg_acl_fromconfig(aclobj, config, ns_g_lctx,
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsconfigure_view_nametable(const cfg_obj_t *vconfig, const cfg_obj_t *config,
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews const char *confname, const char *conftuplename,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews const char *str;
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews (void)cfg_map_get(config, "options", &options);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * No value available. *rbtp == NULL.
7d8cdd869ed2162a5befda7cc1600136110f54d6Mark Andrews result = dns_rbt_create(mctx, NULL, NULL, rbtp);
78838d3e0cd62423c23de5503910e01884d2104bBrian Wellington CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * We don't need the node data, but need to set dummy data to
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews * avoid a partial match with an empty node. For example, if
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halley * we have foo.example.com and bar.example.com, we'd get a match
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * for baz.example.com, which is not the expected result.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * We simply use (void *)1 as the dummy data.
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews result = dns_rbt_addname(*rbtp, name, (void *)1);
693ddf84daa745a0ea8ca311a8154dfa03eabc43Andreas Gustafsson cfg_obj_log(nameobj, ns_g_lctx, ISC_LOG_ERROR,
693ddf84daa745a0ea8ca311a8154dfa03eabc43Andreas Gustafsson "failed to add %s for %s: %s",
693ddf84daa745a0ea8ca311a8154dfa03eabc43Andreas Gustafsson str, confname, isc_result_totext(result));
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halleydstkey_fromconfig(const cfg_obj_t *vconfig, const cfg_obj_t *key,
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff isc_boolean_t managed, dst_key_t **target, isc_mem_t *mctx)
ebfcb6cf66283096ebda1503b6cc042ce86b6bedBrian Wellington flags = cfg_obj_asuint32(cfg_tuple_get(key, "flags"));
7d8cdd869ed2162a5befda7cc1600136110f54d6Mark Andrews proto = cfg_obj_asuint32(cfg_tuple_get(key, "protocol"));
ebfcb6cf66283096ebda1503b6cc042ce86b6bedBrian Wellington alg = cfg_obj_asuint32(cfg_tuple_get(key, "algorithm"));
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
ebfcb6cf66283096ebda1503b6cc042ce86b6bedBrian Wellington initmethod = cfg_obj_asstring(cfg_tuple_get(key, "init"));
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews if (strcasecmp(initmethod, "initial-key") != 0) {
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews "managed key '%s': "
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington "invalid initialization method '%s'",
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington const cfg_obj_t *classobj = cfg_tuple_get(vconfig, "class");
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington CHECK(ns_config_getclass(classobj, dns_rdataclass_in,
f16495732753175e4a9fc144323a12fdcc29b561Brian Wellington keystruct.common.rdtype = dns_rdatatype_dnskey;
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington * The key data in keystruct is not dynamically allocated.
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington keystr = cfg_obj_asstring(cfg_tuple_get(key, "key"));
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington CHECK(isc_base64_decodestring(keystr, &keydatabuf));
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington if ((keystruct.algorithm == DST_ALG_RSASHA1 ||
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington r.length > 1 && r.base[0] == 1 && r.base[1] == 3)
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington cfg_obj_log(key, ns_g_lctx, ISC_LOG_WARNING,
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff "%s key '%s' has a weak exponent",
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews isc_buffer_init(&namebuf, keynamestr, strlen(keynamestr));
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews CHECK(dns_name_fromtext(keyname, &namebuf, dns_rootname, 0, NULL));
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews "ignoring %s key for '%s': no crypto support",
19d365e4448f1782611280b020987988b7ac3210Mark Andrews "skipping %s key for '%s': %s",
b6a0341bcb113e93bd0bc41a9f9a1fc117444da6Mark Andrews "configuring %s key for '%s': %s",
c46f10e4a1702191b003cf8f8fc5059c15d29c48Mark Andrewsload_view_keys(const cfg_obj_t *keys, const cfg_obj_t *vconfig,
93ed317bb43658ed48ee7439f7a36bb9bcf80c94Brian Wellington dns_view_t *view, isc_boolean_t managed, isc_mem_t *mctx)
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = dstkey_fromconfig(vconfig, key, managed,
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews CHECK(dns_keytable_add(secroots, managed, &dstkey));
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews * Configure DNSSEC keys for a view.
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * The per-view configuration values and the server-global defaults are read
7d8cdd869ed2162a5befda7cc1600136110f54d6Mark Andrews * from 'vconfig' and 'config'.
d981ca645597116d227a48bf37cc5edc061c854dBob Halleyconfigure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews const cfg_obj_t *config, const cfg_obj_t *bindkeys,
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence /* We don't need trust anchors for the _bind view */
806c235ecf533b98d068b3f8df9d7abbe1e30cf9Mark Andrews (void)cfg_map_get(config, "trusted-keys", &global_keys);
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews (void)cfg_map_get(config, "managed-keys", &global_managed_keys);
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews (void)cfg_map_get(config, "options", &options);
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews "couldn't create keytable");
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews if (auto_dlv && view->rdclass == dns_rdataclass_in) {
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff isc_log_write(ns_g_lctx, DNS_LOGCATEGORY_SECURITY,
7ab0e69f61e61e81d489c95c7ebd981e74e7ef16Andreas Gustafsson "using built-in trusted-keys for view %s",
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews * If bind.keys exists, it overrides the managed-keys
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * clause hard-coded in ns_g_config.
7ab0e69f61e61e81d489c95c7ebd981e74e7ef16Andreas Gustafsson (void)cfg_map_get(bindkeys, "trusted-keys",
7ab0e69f61e61e81d489c95c7ebd981e74e7ef16Andreas Gustafsson (void)cfg_map_get(bindkeys, "managed-keys",
7ab0e69f61e61e81d489c95c7ebd981e74e7ef16Andreas Gustafsson (void)cfg_map_get(ns_g_config, "trusted-keys",
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff (void)cfg_map_get(ns_g_config, "managed-keys",
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews CHECK(load_view_keys(builtin_keys, vconfig, view,
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews CHECK(load_view_keys(builtin_managed_keys, vconfig,
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson CHECK(load_view_keys(view_keys, vconfig, view, ISC_FALSE, mctx));
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson CHECK(load_view_keys(view_managed_keys, vconfig, view, ISC_TRUE, mctx));
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson if (view->rdclass == dns_rdataclass_in) {
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson CHECK(load_view_keys(global_keys, vconfig, view, ISC_FALSE,
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson CHECK(load_view_keys(global_managed_keys, vconfig, view,
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson * Add key zone for managed-keys.
d981ca645597116d227a48bf37cc5edc061c854dBob Halley (void)ns_config_get(maps, "managed-keys-directory", &obj);
0e8cf9a887c70f96ac448b06c069d90b830215ccMark Andrews directory = obj != NULL ? cfg_obj_asstring(obj) : NULL;
0e8cf9a887c70f96ac448b06c069d90b830215ccMark Andrews CHECK(add_keydata_zone(view, directory, ns_g_mctx));
19d365e4448f1782611280b020987988b7ac3210Mark Andrewsmustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver) {
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews const char *str;
d981ca645597116d227a48bf37cc5edc061c854dBob Halley str = cfg_obj_asstring(cfg_tuple_get(obj, "name"));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews value = cfg_obj_asboolean(cfg_tuple_get(obj, "value"));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_resolver_setmustbesecure(resolver, name, value));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Get a dispatch appropriate for the resolver of a given view.
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsget_view_querysource_dispatch(const cfg_obj_t **maps,
94a3bcd132e515b4baa0884ba9dd0f361d2e17bcMark Andrews * Make compiler happy.
d981ca645597116d227a48bf37cc5edc061c854dBob Halley result = ns_config_get(maps, "query-source", &obj);
d981ca645597116d227a48bf37cc5edc061c854dBob Halley result = ns_config_get(maps, "query-source-v6", &obj);
9916239908343b3eb17f0578de4c3cd6a313d85fMark Andrews * If we don't support this address family, we're done!
0513f89e68f82f9ec54e7af9c979a7c43babbe31Bob Halley * Try to find a dispatcher that we can share.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews "using specific query-source port "
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews "suppresses port randomization and can be "
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews "insecure.");
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff result = dns_dispatch_getudp(ns_g_dispatchmgr, ns_g_socketmgr,
47b26abe77184f9bedc68e36bdad03332cf67570David Lawrence isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
94a537e6ab3069f8d34e12e5ea722250be2b89c8Michael Graff "could not get query source dispatcher (%s)",
8695d7b357789bedff63e5b19c5ab25cd58fcd4bMark Andrewsconfigure_order(dns_order_t *order, const cfg_obj_t *ent) {
beed6a0e226fbd0c18c19a3e341a2003cba020a5Mark Andrews unsigned int mode = 0;
beed6a0e226fbd0c18c19a3e341a2003cba020a5Mark Andrews const char *str;
ebfcb6cf66283096ebda1503b6cc042ce86b6bedBrian Wellington result = ns_config_getclass(cfg_tuple_get(ent, "class"),
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews result = ns_config_gettype(cfg_tuple_get(ent, "type"),
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson result = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * "*" should match everything including the root (BIND 8 compat).
d3a86da2e8f09e2c3f55721aae537b9cacc7e537Andreas Gustafsson * As dns_name_matcheswildcard(".", "*.") returns FALSE add a
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * explicit entry for "." when the name is "*".
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff return (dns_order_add(order, dns_fixedname_name(&fixed),
fe47f41b13620bfafc4f8cf65d5df24f1e568764Bob Halleyconfigure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews const char *str;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews cfg_obj_asnetprefix(cfg_map_getname(cpeer), &na, &prefixlen);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = dns_peer_newprefix(mctx, &na, prefixlen, &peer);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_peer_setbogus(peer, cfg_obj_asboolean(obj)));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(cpeer, "provide-ixfr", &obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_peer_setprovideixfr(peer, cfg_obj_asboolean(obj)));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(cpeer, "request-ixfr", &obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_peer_setrequestixfr(peer, cfg_obj_asboolean(obj)));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(cpeer, "request-nsid", &obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_peer_setrequestnsid(peer, cfg_obj_asboolean(obj)));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_peer_setsupportedns(peer, cfg_obj_asboolean(obj)));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(cpeer, "edns-udp-size", &obj);
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews CHECK(dns_peer_setudpsize(peer, (isc_uint16_t)udpsize));
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews (void)cfg_map_get(cpeer, "max-udp-size", &obj);
f0ff273b530afa730025e1c5ad311950f7ff4328Mark Andrews CHECK(dns_peer_setmaxudp(peer, (isc_uint16_t)udpsize));
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence CHECK(dns_peer_settransfers(peer, cfg_obj_asuint32(obj)));
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence (void)cfg_map_get(cpeer, "transfer-format", &obj);
ad493ef9ddb5a3e78e9d99f57abe75552f36a8f4Andreas Gustafsson else if (strcasecmp(str, "one-answer") == 0)
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews result = dns_peer_setkeybycharp(peer, cfg_obj_asstring(obj));
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews (void)cfg_map_get(cpeer, "transfer-source", &obj);
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews (void)cfg_map_get(cpeer, "transfer-source-v6", &obj);
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj));
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews (void)cfg_map_get(cpeer, "notify-source", &obj);
7d62ddffbb4d1cc97b8d80b7ee4944554a57523eMark Andrews (void)cfg_map_get(cpeer, "notify-source-v6", &obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj));
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews (void)cfg_map_get(cpeer, "query-source", &obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews (void)cfg_map_get(cpeer, "query-source-v6", &obj);
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdisable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews const char *str;
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews algorithms = cfg_tuple_get(disabled, "algorithms");
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence DE_CONST(cfg_obj_asstring(cfg_listelt_value(element)), r.base);
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff "invalid algorithm");
330705066b03f6ce0bc08a4bbfc5d2418038c68dBrian Wellington CHECK(dns_resolver_disable_algorithm(resolver, name, alg));
330705066b03f6ce0bc08a4bbfc5d2418038c68dBrian Wellingtonon_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) {
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews const char *str;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = dns_name_fromtext(name, &b, dns_rootname,
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrewscheck_dbtype(dns_zone_t **zonep, unsigned int dbtypec, const char **dbargv,
34b394b43e2207e8f8f3703f0402422121455638David Lawrence unsigned int i;
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff result = dns_zone_getdbtype(*zonep, &argv, mctx);
5a219d878f0bd786e86da2c9b92999260dda3f8dAndreas Gustafsson * Check that all the arguments match.
5a219d878f0bd786e86da2c9b92999260dda3f8dAndreas Gustafsson for (i = 0; i < dbtypec; i++)
34b394b43e2207e8f8f3703f0402422121455638David Lawrence if (argv[i] == NULL || strcmp(argv[i], dbargv[i]) != 0) {
5a219d878f0bd786e86da2c9b92999260dda3f8dAndreas Gustafsson * Check that there are not extra arguments.
5466ce3f279d9fa83ce826bcdc9482bc591152aeAndreas Gustafssonsetquerystats(dns_zone_t *zone, isc_mem_t *mctx, isc_boolean_t on) {
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewscachelist_find(ns_cachelist_t *cachelist, const char *cachename) {
5a219d878f0bd786e86da2c9b92999260dda3f8dAndreas Gustafsson if (strcmp(dns_cache_getname(nsc->cache), cachename) == 0)
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrencecache_reusable(dns_view_t *originview, dns_view_t *view,
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews if (originview->checknames != view->checknames ||
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews dns_resolver_getzeronosoattl(originview->resolver) !=
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews originview->acceptexpired != view->acceptexpired ||
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews originview->enablevalidation != view->enablevalidation ||
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews originview->maxcachettl != view->maxcachettl ||
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews originview->maxncachettl != view->maxncachettl) {
47b26abe77184f9bedc68e36bdad03332cf67570David Lawrencecache_sharable(dns_view_t *originview, dns_view_t *view,
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews * If the cache cannot even reused for the same view, it cannot be
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrews * shared with other views.
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrews if (!cache_reusable(originview, view, new_zero_no_soattl))
47b26abe77184f9bedc68e36bdad03332cf67570David Lawrence * Check other cache related parameters that must be consistent among
47b26abe77184f9bedc68e36bdad03332cf67570David Lawrence * the sharing views.
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrews if (dns_cache_getcleaninginterval(originview->cache) !=
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrews dns_cache_getcachesize(originview->cache) != new_max_cache_size) {
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * Configure 'view' according to 'vconfig', taking defaults from 'config'
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * where values are missing in 'vconfig'.
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * When configuring the default view, 'vconfig' will be NULL and the
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * global defaults in 'config' used exclusively.
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrewsconfigure_view(dns_view_t *view, const cfg_obj_t *config,
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews const cfg_obj_t *vconfig, ns_cachelist_t *cachelist,
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews cfg_aclconfctx_t *actx, isc_boolean_t need_hints)
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews unsigned int dlzargc;
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews dns_view_t *pview = NULL; /* Production view */
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews int i = 0, j = 0, k = 0;
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews const char *str;
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews unsigned int resopts = 0;
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews (void)cfg_map_get(config, "options", &options);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * maps: view options, options, defaults
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * cfgmaps: view options, config
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * optionmaps: view options, options
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Set the view's port number for outgoing queries.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence CHECKM(ns_config_getport(config, &port), "port");
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Create additional cache for this view and zones under the view
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * if explicitly enabled.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * XXX950 default to on.
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff (void)ns_config_get(maps, "acache-enable", &obj);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews CHECK(dns_acache_create(&view->acache, cmctx, ns_g_taskmgr,
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington result = ns_config_get(maps, "acache-cleaning-interval", &obj);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = ns_config_get(maps, "max-acache-size", &obj);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence "'max-acache-size "
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington "d' is too large",
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_acache_setcachesize(view->acache, max_acache_size);
c46f10e4a1702191b003cf8f8fc5059c15d29c48Mark Andrews * Configure the zones.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence (void)cfg_map_get(voptions, "zone", &zonelist);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence (void)cfg_map_get(config, "zone", &zonelist);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews const cfg_obj_t *zconfig = cfg_listelt_value(element);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews CHECK(configure_zone(config, zconfig, vconfig, mctx, view,
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Create Dynamically Loadable Zone driver.
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews (void)cfg_map_get(cfg_tuple_get(dlz, "options"),
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews char *s = isc_mem_strdup(mctx, cfg_obj_asstring(obj));
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = dns_dlzstrtoargv(mctx, s, &dlzargc, &dlzargv);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = dns_dlzcreate(mctx, cfg_obj_asstring(obj),
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrews isc_mem_put(mctx, dlzargv, dlzargc * sizeof(*dlzargv));
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * Obtain configuration parameters that affect the decision of whether
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews * we can reuse/share an existing cache.
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = ns_config_get(maps, "cleaning-interval", &obj);
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff cleaning_interval = cfg_obj_asuint32(obj) * 60;
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = ns_config_get(maps, "max-cache-size", &obj);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews "'max-cache-size "
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews /* Check-names. */
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = ns_checknames_get(maps, "response", &obj);
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews result = ns_config_get(maps, "zero-no-soa-ttl-cache", &obj);
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = ns_config_get(maps, "dnssec-accept-expired", &obj);
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence view->acceptexpired = cfg_obj_asboolean(obj);
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = ns_config_get(maps, "dnssec-validation", &obj);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence view->enablevalidation = cfg_obj_asboolean(obj);
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = ns_config_get(maps, "max-cache-ttl", &obj);
fd4810861c0c0ccb9aebde94e9d289442b2630dbMark Andrews result = ns_config_get(maps, "max-ncache-ttl", &obj);
23cb957a81a51a9656917ea98d0ae56b7abdcaccMark Andrews * Configure the view's cache.
b6a0341bcb113e93bd0bc41a9f9a1fc117444da6Mark Andrews * First, check to see if there are any attach-cache options. If yes,
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews * attempt to lookup an existing cache at attach it to the view. If
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews * there is not one, then try to reuse an existing cache if possible;
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * otherwise create a new cache.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * Note that the ADB is not preserved or shared in either case.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * When a matching view is found, the associated statistics are also
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * retrieved and reused.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * XXX Determining when it is safe to reuse or share a cache is tricky.
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * When the view's configuration changes, the cached data may become
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * invalid because it reflects our old view of the world. We check
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * some of the configuration parameters that could invalidate the cache
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * or otherwise make it unsharable, but there are other configuration
0553f5554f2ecfa137565b83378f566edc8fe6abMark Andrews * options that should be checked. For example, if a view uses a
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * forwarder, changes in the forwarder configuration may invalidate
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * the cache. At the moment, it's the administrator's responsibility to
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews * ensure these configuration options don't invalidate reusing/sharing.
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = ns_config_get(maps, "attach-cache", &obj);
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews if (!cache_sharable(nsc->primaryview, view, zero_no_soattl,
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews "views %s and %s can't share the cache "
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews "due to configuration parameter mismatch",
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews result = dns_viewlist_find(&ns_g_server->viewlist,
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews if (result != ISC_R_NOTFOUND && result != ISC_R_SUCCESS)
20b20b23948b90cb2f7d7f402da99d09f837efd0David Lawrence "cache cannot be reused "
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews "for view %s due to "
82d05588933a3c765aa8518fe455d6477d640b99Mark Andrews "configuration parameter "
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson "reusing existing cache");
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff * Create a cache with the desired name. This normally
7ec579cd5d07228c0d6cece58b80694ad8d59de9Michael Graff * equals the view name, but may also be a forward
ebd68da027cfa8da0fb536c3db11bb88292f41c7Andreas Gustafsson * reference to a view that share the cache with this
ebd68da027cfa8da0fb536c3db11bb88292f41c7Andreas Gustafsson * view but is not yet configured. If it is not the
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * view name but not a forward reference either, then it
3bb3b7ac462a90c2b8b1fb783324d800e2ba748cMichael Graff * is simply a named cache that is not shared.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * cache-file cannot be inherited if views are present, but this
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * should be caught by the configuration checking stage.
3bb3b7ac462a90c2b8b1fb783324d800e2ba748cMichael Graff result = ns_config_get(maps, "cache-file", &obj);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") != 0) {
7ec579cd5d07228c0d6cece58b80694ad8d59de9Michael Graff CHECK(dns_cache_setfilename(cache, cfg_obj_asstring(obj)));
7ec579cd5d07228c0d6cece58b80694ad8d59de9Michael Graff dns_cache_setcleaninginterval(cache, cleaning_interval);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_cache_setcachesize(cache, max_cache_size);
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff * XXXRTH Hardwired number of tasks.
b469f0321d2bcea3914c57d26fd43319e506c313Andreas Gustafsson CHECK(get_view_querysource_dispatch(maps, AF_INET, &dispatch4,
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff CHECK(get_view_querysource_dispatch(maps, AF_INET6, &dispatch6,
b469f0321d2bcea3914c57d26fd43319e506c313Andreas Gustafsson "unable to obtain neither an IPv4 nor"
014892d86d30b7eceb0003d51788f9b5cadfc1bfAndreas Gustafsson " an IPv6 dispatch");
014892d86d30b7eceb0003d51788f9b5cadfc1bfAndreas Gustafsson CHECK(dns_view_createresolver(view, ns_g_taskmgr, 31,
max_adb_size = 0;
if (max_cache_size != 0) {
if (max_adb_size == 0)
if (need_hints)
INSIST(0);
* configured in named.conf.
#ifdef ALLOW_FILTER_AAAA_ON_V4
INSIST(0);
const char *str;
isc_buffer_t b;
0, NULL));
isc_buffer_t b;
const char *str;
0, NULL));
name));
if (empty_zones_enable) {
const char *empty;
int empty_zone = 0;
const char *str;
NULL));
NULL));
NULL));
&forwarders);
if (logit) {
&pview);
goto cleanup;
zonestats_on));
empty_dbtype));
ISC_TRUE);
return (result);
static isc_result_t
return (result);
static isc_result_t
return (ISC_R_RANGE);
NULL));
val);
return (ISC_R_RANGE);
NULL, 0));
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;
&viewclass);
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;
goto cleanup;
&only);
zname);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
&pview);
goto cleanup;
goto cleanup;
forwardtype));
return (result);
static isc_result_t
goto cleanup;
return (result);
static isc_result_t
const char *directory;
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
goto clean;
goto clean;
return (ISC_R_SUCCESS);
return (result);
goto fail;
goto fail;
goto fail;
goto fail;
fail:
goto clean;
static unsigned int oldrequests = 0;
static isc_result_t
char *copy;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
const char *resource;
if (positive)
if (positive)
hiport);
static isc_result_t
const char *type;
return (ISC_R_SUCCESS);
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
&tsigkey));
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
unsigned int algtype;
return (result);
return (result);
if (need_deleteold) {
if (need_createnew) {
goto cleanup;
goto cleanup;
return (result);
return (result);
static isc_result_t
unsigned int maxsocks;
if (first_time) {
filename);
* option where the above parsing failed, parse resolv.conf.
if (ns_g_lwresdonly &&
&config);
&bindkeys_parser));
maxsocks = 0;
if (maxsocks != 0) {
reserved = 0;
&udpport_high),
&udpport_high),
if (ns_g_port != 0)
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
&listenon);
} else if (!ns_g_lwresdonly) {
listenon);
if (interface_interval == 0) {
if (heartbeat_interval == 0) {
else if (ns_g_lwresdonly)
&aclconfctx),
if (first_time) {
#ifdef PATH_RANDOMDEV
&ns_g_entropy);
if (first_time)
* files specified in named.conf get created by the
if (ns_g_logstderr) {
if (first_time) {
&categories);
const char *str;
else if (ns_g_memstatistics)
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
if (ns_g_lwresdonly)
ISC_TRUE),
if (nzf_config) {
if (flush)
sizeof(isc_event_t));
goto cleanup;
attrs = 0;
case AF_INET:
case AF_INET6:
goto cleanup;
attrmask = 0;
goto cleanup;
static isc_result_t
return (result);
static isc_result_t
return (result);
cleanup: ;
char *res;
return (res);
static isc_result_t
const char **zonename)
const char *zonetxt;
char *classtxt;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
if (zonename)
goto fail1;
goto fail1;
goto fail1;
return (result);
return (result);
return (ISC_R_UNEXPECTEDEND);
return (result);
return (result);
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_CONTINUE:
case DNS_R_UPTODATE:
return (result);
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
if (ns_g_port != 0) {
return (result);
return (ISC_R_RANGE);
return (result);
return (result);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
return (result);
goto cleanup;
goto done;
goto resume;
goto cleanup;
goto nextzone;
goto nextzone;
goto cleanup;
goto nextview;
done:
char *ptr;
const char *sep;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_NOMEMORY);
goto nextview;
return (ISC_R_SUCCESS);
return (result);
char *ptr;
return (ISC_R_UNEXPECTEDEND);
goto nextview;
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);
return (ISC_R_UNEXPECTEDEND);
return (DNS_R_SYNTAX);
goto out;
if (changed)
out:
return (result);
return (ISC_R_UNEXPECTEDEND);
viewname);
if (!found) {
return (result);
isc_buffer_t b;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
return (result);
if (!found)
viewname);
return (result);
#ifdef ISC_PLATFORM_USETHREADS
#ifdef ISC_PLATFORM_USETHREADS
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int *foundkeys)
origin);
return (ISC_R_SUCCESS);
return (result);
goto nextkey;
(*foundkeys)++;
goto again;
return (result);
return (ISC_R_SUCCESS);
unsigned int foundkeys = 0;
char *target;
char *viewname;
return (ISC_R_UNEXPECTEDEND);
&foundkeys);
return (result);
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int *foundkeys)
const char *viewname;
origin);
return (ISC_R_SUCCESS);
return (result);
(*foundkeys)++;
sizeof(creatorstr));
return (ISC_R_NOSPACE);
return (result);
return (ISC_R_SUCCESS);
unsigned int foundkeys = 0;
&foundkeys);
return (result);
&foundkeys);
return (result);
if (foundkeys == 0) {
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
return (result);
return (DNS_R_NOTMASTER);
return (result);
char *journal;
return (result);
return (tresult);
return (DNS_R_NOTMASTER);
if (freeze) {
if (frozen) {
if (frozen) {
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_UPTODATE:
case DNS_R_CONTINUE:
sizeof(classstr));
return (result);
#ifdef HAVE_LIBSCF
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
const char *zonename;
const char *argp;
const char *filename = 0;
return (ISC_R_FAILURE);
&config));
#ifdef WIN32
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
const char *vname;
if (voptions) {
&obj);
filename =
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
&len));
return (result);
char *p = *args;
char *str, *d;
char quote;
while (isspace((unsigned char)*p))
while (*p && !isspace((unsigned char)*p))
while (isspace((unsigned char)*p))
return (NULL);
quote = *p++;
while (*p && *p != quote)
*args = d;
return (str);
return (ISC_R_FAILURE);
#ifdef WIN32
goto cleanup;
goto cleanup;
return (result);
goto cleanup;
const char *vname;
&obj);
filename =
goto cleanup;
size_t n;
getpid()));
goto cleanup;
p += znamelen;
if (isspace((unsigned char)*p) ||
found = p;
if (found) {
p = buf;
return (result);