server.c revision 927e4c9fecf448bf3894c68fcaf9dc2f89557f3a
87708bde16713bc02ff2598f4a82f98c699a2f2dMark Andrews * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2003 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and/or distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
c19cfefe7e345c37ef3bb98b0db2d14fe7b1d583Evan Hunt * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
c19cfefe7e345c37ef3bb98b0db2d14fe7b1d583Evan Hunt * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
87708bde16713bc02ff2598f4a82f98c699a2f2dMark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
60988462e5d6db53205851d056e3482a29239be9Evan Hunt * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
afaa290bb6acc504e93a0adbf20b6dd6c64e6d63Vernon Schryver * PERFORMANCE OF THIS SOFTWARE.
#ifdef HAVE_GEOIP
#ifndef PATH_MAX
#ifndef SIZE_MAX
goto cleanup; \
goto cleanup; \
struct ns_dispatch {
unsigned int dispatchgen;
struct ns_cache {
struct dumpcontext {
struct viewlistentry {
struct zonelistentry {
struct cfg_context {
const char *empty_zones[] = {
ISC_PLATFORM_NORETURN_PRE static void
static isc_result_t
static isc_result_t
static isc_result_t
static isc_result_t
static isc_result_t
static isc_result_t
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
isc_buffer_t b;
const char *str;
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (result);
* we have foo.example.com and bar.example.com, we'd get a match
* for baz.example.com, which is not the expected result.
goto cleanup;
return (result);
return (result);
static isc_result_t
isc_region_t r;
if (managed) {
const char *initmethod;
goto cleanup;
&viewclass));
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
goto cleanup;
return (result);
static isc_result_t
const char *directory;
return (ISC_R_SUCCESS);
&view_keys);
return (ISC_R_UNEXPECTED);
&builtin_keys);
&builtin_keys);
&builtin_keys);
&builtin_keys);
mctx));
goto cleanup;
return (result);
static isc_result_t
const char *str;
isc_buffer_t b;
return (result);
static isc_result_t
unsigned int maxdispatchbuffers;
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:
if (is_firstview) {
attrmask = 0;
switch (af) {
case AF_INET:
case AF_INET6:
return (ISC_R_SUCCESS);
buf);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int mode = 0;
const char *str;
isc_buffer_t b;
return (result);
return (result);
return (result);
mode = 0;
INSIST(0);
if (addroot) {
return (result);
static isc_result_t
const char *str;
unsigned int prefixlen;
return (result);
INSIST(0);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
const char *str;
isc_buffer_t b;
return (result);
static isc_result_t
const char *str;
isc_buffer_t b;
return (result);
static isc_boolean_t
const char *str;
isc_buffer_t b;
0, NULL);
return (ISC_TRUE);
return (ISC_FALSE);
for (i = 0; i < dbtypec; i++)
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
static ns_cache_t *
return (nsc);
return (NULL);
static isc_boolean_t
return (ISC_FALSE);
return (ISC_TRUE);
static isc_boolean_t
unsigned int new_cleaning_interval,
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
static isc_result_t
return (result);
static isc_result_t
const char *contact)
char *cp;
const unsigned char *s6;
isc_buffer_t b;
while (prefixlen > 0) {
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
const char *str;
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
return (result);
return (result);
return (DNS_R_EMPTYLABEL);
return (result);
return (result);
return (result);
return (result);
return (result);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
return (result);
if (*old_rpz_okp) {
return (ISC_R_SUCCESS);
if (!(cond)) { \
goto cleanup; \
static isc_result_t
int min_entries, i, j;
return (result);
i, min_entries);
i, DNS_RRL_MAX_PREFIX);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
unsigned int dlzargc;
char **dlzargv;
unsigned int cleaning_interval;
const char *str;
unsigned int resopts = 0;
max_acache_size = 0;
namebuf);
goto cleanup;
if (s == NULL) {
goto cleanup;
goto cleanup;
&dlzdb);
goto cleanup;
goto cleanup;
max_cache_size = 0;
INSIST(0);
unsigned int prefixlen;
unsigned int dns64options = 0;
&prefixlen);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
&pview);
goto cleanup;
zero_no_soattl)) {
&cache));
goto cleanup;
== NULL)));
== NULL)));
goto cleanup;
max_adb_size = 0;
if (max_cache_size != 0U) {
if (max_adb_size == 0U)
if (need_hints)
goto cleanup;
INSIST(0);
* configured in named.conf.
#ifdef ALLOW_FILTER_AAAA
INSIST(0);
INSIST(0);
const char *dom;
const char *str;
isc_buffer_t b;
isc_buffer_t b;
const char *str;
0, NULL));
name));
const char *empty;
int empty_zone = 0;
const char *str;
NULL));
NULL));
INSIST(0);
NULL));
&forwarders);
&pview);
goto cleanup;
statlevel));
&zone));
zone));
empty_dbtype));
ISC_TRUE);
goto cleanup;
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);
return (ISC_R_RANGE);
goto cleanup;
INSIST(0);
goto cleanup;
return (result);
static isc_result_t
const char *viewname;
&viewclass);
return (result);
static isc_result_t
return (result);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
return (ISC_R_EXISTS);
return (result);
return (result);
#ifdef HAVE_GEOIP
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;
goto cleanup;
&zone));
zone));
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
zname);
goto cleanup;
forwardtype));
return (result);
static isc_result_t
&pview);
return (result);
return (ISC_R_SUCCESS);
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:
case dns_zone_redirect:
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
if (!allow) {
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
int num_zones = 0;
unsigned int maxsocks;
if (first_time) {
filename);
* option where the above parsing failed, parse resolv.conf.
if (ns_g_lwresdonly &&
&config);
&bindkeys_parser));
if (!exclusive) {
maxsocks = 0;
if (maxsocks != 0) {
reserved = 0;
#ifdef HAVE_GEOIP
char *dir;
&udpport_high),
&udpport_high),
if (ns_g_port != 0)
} else if (!ns_g_lwresdonly) {
listenon);
} else if (!ns_g_lwresdonly) {
listenon);
if (interface_interval == 0) {
if (heartbeat_interval == 0) {
else if (ns_g_lwresdonly)
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) {
goto cleanup;
if (first_time) {
&categories);
const char *str;
else if (ns_g_memstatistics)
if (exclusive)
return (result);
static isc_result_t
unsigned int refs;
if (refs != 0)
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int refs = 0;
return (ISC_R_NOMEMORY);
goto cleanup;
goto cleanup;
if (refs == 0) {
return (result);
static isc_result_t
return (result);
if (ns_g_lwresdonly)
ISC_TRUE),
if (flush)
#ifdef HAVE_GEOIP
#ifdef HAVE_GEOIP
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
char *classtxt;
if (skip) {
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_SUCCESS);
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);
char *ptr;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_NOTFOUND);
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
if (ns_g_port != 0) {
return (result);
return (ISC_R_RANGE);
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);
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 (set) {
if (!first) {
goto out;
goto out;
if (!set)
else 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);
target);
if (!found)
return (result);
sizeof(boottime));
sizeof(configtime));
#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);
static isc_result_t
char *journal;
if (cleanup) {
return (result);
return (result);
return (tresult);
sizeof(classstr));
return (result);
return (result);
return (tresult);
return (DNS_R_NOTMASTER);
return (DNS_R_NOTDYNAMIC);
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;
&config));
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
const char *vname;
goto cleanup;
goto cleanup;
NULL));
return (result);
static isc_boolean_t
if (first)
return (ISC_FALSE);
return (first);
goto cleanup;
goto cleanup;
goto cleanup;
size_t n;
(long)getpid()));
goto cleanup;
p += znamelen;
if (isspace((unsigned char)*p) ||
found = p;
if (found) {
p = buf;
goto cleanup;
if (cleanup) {
if (exclusive)
return (result);
const char *ptr;
size_t n;
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
hash = 0;
return (ISC_R_UNEXPECTEDEND);
if (n == sizeof(nbuf))
return (ISC_R_NOSPACE);
return (ISC_R_BADNUMBER);
return (ISC_R_RANGE);
return (ISC_R_UNEXPECTEDEND);
if (clear) {
} else if (chain) {
ISC_TRUE));
} else if (list) {
goto cleanup;
if (!first)
return (result);
int nfiles = 0;
goto cleanup;
switch (zonetype) {
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_staticstub:
case dns_zone_redirect:
case dns_zone_key:
case dns_zone_dlz:
if (hasraw)
if (hasraw) {
DNS_ZONEKEY_MAINTAIN) != 0);
sizeof(kbuf));
sizeof(rtbuf));
for (i = 0; i < nfiles; i++) {
if (hasraw) {
if (secure) {
if (hasraw)
if (maintain) {
} else if (allow)
if (dynamic) {
if (frozen)
for (i = 0; i < nfiles; i++)
return (result);