zone.c revision 2d1bc69493b662218e732a474f5860d4c358be71
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * Permission to use, copy, modify, and distribute this software for any
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * purpose with or without fee is hereby granted, provided that the above
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * copyright notice and this permission notice appear in all copies.
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User/* $Id: zone.c,v 1.191 2000/08/19 00:47:57 gson Exp $ */
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User#define RANGE(a, b, c) (((a) < (b)) ? (b) : ((a) < (c) ? (a) : (c)))
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * Default values.
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours */
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User /* Unlocked */
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User unsigned int magic;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User ISC_LINK(dns_zone_t) link; /* Used by zmgr. */
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User unsigned int erefs;
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User unsigned int irefs;
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User unsigned int flags;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User#endif /* NOMINUM_PUBLIC */
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User#endif /* NOMINUM_PUBLIC */
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User /* Access Control Lists */
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * Zones in certain states such as "waiting for zone transfer"
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * or "zone transfer in progress" are kept on per-state linked lists
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * in the zone manager using the 'statelink' field. The 'statelist'
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * field points at the list the zone is currently on. It the zone
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User * is not on any such list, statelist is NULL.
/* XXX MPA these may need to go back into zone.h */
struct dns_zonemgr {
unsigned int magic;
int transfersin;
int transfersperns;
struct dns_notify {
#ifndef NOMINUM_PUBLIC
unsigned int flags;
#ifndef NOMINUM_PUBLIC
struct dns_stub {
#ifndef NOMINUM_PUBLIC
#ifdef NOMINUM_PUBLIC
unsigned int flags,
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
goto free_mutex;
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
#ifndef NOMINUM_PUBLIC
goto nomem;
for (i = 0; i < dbargc; i++)
for (i = 0; i < dbargc; i++) {
goto nomem;
goto unlock;
for (i = 0; i < dbargc; i++) {
return (result);
return (result);
return (result);
static isc_result_t
int len;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (result);
unsigned int soacount = 0;
unsigned int nscount = 0;
goto cleanup;
goto cleanup;
goto cleanup;
&db);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
nscount = 0;
soacount = 0;
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
goto cleanup;
if (nscount == 0)
isc_time_t t;
goto cleanup;
zone,
sizeof(isc_event_t));
goto cleanup;
return (result);
static isc_result_t
unsigned int *nscount)
unsigned int count;
*nscount = 0;
goto invalidate_rdataset;
goto invalidate_rdataset;
count = 0;
count++;
return (result);
static isc_result_t
unsigned int *soacount,
unsigned int count;
goto invalidate_rdataset;
count = 0;
count++;
if (count > 0) {
return (result);
static isc_result_t
goto closeversion;
minimum);
return (answer);
if (free_now)
if (value)
if (value)
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
goto unlock;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
return (result);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
sizeof(dns_name_t));
if (count == 0)
goto unlock;
goto unlock;
#ifndef NOMINUM_PUBLIC
goto unlock;
for (i = 0; i < count; i++)
for (i = 0; i < count; i++) {
sizeof(dns_name_t));
goto allocfail;
newname[i]);
for (i = 0; i < count; i++)
newname[i],
goto unlock;
return (result);
return (result);
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_master:
case dns_zone_master:
case dns_zone_slave:
return (result);
static isc_result_t
char *buf;
int buflen;
return (ISC_R_NOMEMORY);
goto cleanup;
goto cleanup;
&dns_master_style_default, f);
n = fflush(f);
n = ferror(f);
n = fclose(f);
return (result);
return (result);
#ifndef NOMINUM_PUBLIC
#ifndef NOMINUM_PUBLIC
static isc_boolean_t
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (ISC_R_NOMEMORY);
#ifndef NOMINUM_PUBLIC
return (ISC_R_SUCCESS);
goto detach;
goto detach;
unsigned int options;
goto destroy;
goto destroy;
goto detach;
goto detach;
static isc_result_t
isc_event_t *e;
if (e == NULL)
return (ISC_R_NOMEMORY);
isc_event_free(&e);
return (result);
goto cleanup;
goto cleanup;
#ifdef NOMINUM_PUBLIC
goto cleanup;
#ifdef NOMINUM_PUBLIC
goto cleanup;
goto cleanup;
#ifndef NOMINUM_PUBLIC
goto cleanup1;
goto cleanup2;
goto cleanup3;
goto cleanup3;
if (isqueued) {
static inline isc_result_t
goto fail;
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
&rdataset);
goto fail;
goto fail;
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto same_master;
goto next_master;
if (cnamecnt != 0) {
goto next_master;
if (nscnt == 0) {
goto next_master;
goto next_master;
goto free_stub;
goto free_stub;
goto detach;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
master);
goto tcp_transfer;
master);
goto next_master;
goto same_master;
goto next_master;
if (cnamecnt != 0) {
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
goto next_master;
isc_time_t t;
goto next_master;
goto next_master;
isc_event_t *e;
if (e == NULL) {
isc_event_free(&e);
static inline isc_result_t
&message);
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
goto cleanup;
DNS_REQUESTOPT_TCP : 0;
goto cleanup;
goto cleanup;
goto cleanup;
&node);
goto cleanup;
goto cleanup;
goto cleanup;
static isc_result_t
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
if (next == 0) {
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
#ifdef NOMINUM_PUBLIC
isc_region_t r;
&message);
goto fail;
goto cleanup;
goto cleanup;
#ifndef NOMINUM_PUBLIC
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
NULL);
goto done;
goto done;
goto done;
isc_buffer_usedregion(b, &r);
goto done;
goto done;
done:
fail:
return (result);
return (DNS_R_FORMERR);
return (DNS_R_NOTIMP);
return (ISC_R_SUCCESS);
#ifndef NOMINUM_PUBLIC
return (ISC_R_SUCCESS);
return (DNS_R_REFUSED);
&rdataset);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
int len;
int count = 0;
count++;
return (count);
if (idlein == 0)
if (idleout == 0)
return (result);
static isc_result_t
goto fail;
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
unsigned int soacount;
unsigned int nscount;
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_UPTODATE:
isc_time_t t;
nscount = 0;
soacount = 0;
if (nscount == 0)
#ifndef NOMINUM_PUBLIC
case DNS_R_ZONETOOLARGE:
goto cleanup;
#ifndef NOMINUM_PUBLIC
return (ISC_R_NOMEMORY);
goto free_mem;
goto free_rwlock;
goto free_conflock;
goto free_taskpool;
goto free_task;
return (ISC_R_SUCCESS);
return (result);
goto cleanup_task;
goto unlock;
return (result);
if (free_now)
if (free_now)
dns_zone_t *p;
p != NULL;
return (ISC_R_SUCCESS);
static isc_result_t
dns_zone_t *x;
isc_event_t *e;
x != NULL;
nxfrsin++;
nxfrsperns++;
return (ISC_R_QUOTA);
return (ISC_R_QUOTA);
sizeof(isc_event_t));
if (e == NULL)
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);