zone.c revision 9ec46fafd60c5450352597547dd62a87f330664b
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington * Copyright (C) 1999 Internet Software Consortium.
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson * Permission to use, copy, modify, and distribute this software for any
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson * purpose with or without fee is hereby granted, provided that the above
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington /* $Id: zone.c,v 1.73 2000/01/31 02:37:58 marka Exp $ */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington/* XXX remove once config changes are in place */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington#define dns_zone_uptodate(x) zone_log(x, me, ISC_LOG_INFO, "dns_zone_uptodate")
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington#define RANGE(a, b, c) (((a) < (b)) ? (b) : ((a) < (c) ? (a) : (c)))
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington#define DNS_MAX_REFRESH 2419200 /* 4 weeks */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington#define DNS_DEFAULT_IDLEIN 3600 /* 1 hour */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington#define DNS_DEFAULT_IDLEOUT 3600 /* 1 hour */
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellingtontypedef enum {
90c099e88e9f16bfee9edee3ac1a51fc98843772Brian Wellington ISC_LINK(struct dns_zone_checkservers) link;
909e3c228813f05bcdebf403a69ed18406f86ec4Brian Wellington /* Unlocked */
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson ISC_LINK(dns_zone_t) link; /* Used by zmgr. */
unsigned int flags;
unsigned int options;
unsigned int setoptions;
char * db_type;
unsigned int db_argc;
char ** db_argv;
unsigned int masterscnt;
unsigned int curmaster;
unsigned int notifycnt;
/* XXX MPA these may need to go back into zone.h */
(((z)->options & (o)) != 0) : \
struct dns_zonemgr {
#ifdef notyet
static void record_serial(void);
char *s = NULL; \
isc_result_t r; \
if (r == DNS_R_SUCCESS) { \
return (DNS_R_NOMEMORY);
return (DNS_R_UNEXPECTED);
return (DNS_R_SUCCESS);
return (result);
return (result);
return (result);
static isc_result_t
int len;
return (DNS_R_NOMEMORY);
return (DNS_R_SUCCESS);
return (result);
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_hint:
case dns_zone_forward:
case dns_zone_cache:
int soacount = 0;
int nscount = 0;
case dns_zone_forward:
case dns_zone_none:
goto cleanup;
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_hint:
case dns_zone_cache:
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
nscount = 0;
soacount = 0;
NULL);
nscount++;
NULL);
if (soacount == 0)
soacount++;
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
if (nscount == 0)
goto cleanup;
case dns_zone_hint:
if (nscount == 0) {
goto cleanup;
case dns_zone_cache:
goto cleanup;
goto cleanup;
if (soacount != 0)
return (result);
#ifdef notyet
NULL);
sizeof *checkservers);
#ifdef notyet
switch (state) {
case get_a6:
case get_aaaa:
case get_a:
case get_ns:
case get_soa:
goto cleanup;
switch (state) {
case get_a6:
case get_aaaa:
case get_a:
case get_ns:
case get_soa:
goto cleanup;
goto cleanup_msgsoa;
goto cleanup_msgsoa;
goto cleanup_msgsoa;
server);
goto cleanup_zonesoa;
goto cleanup_zonesoa;
server);
#ifdef notyet
switch (type) {
case dns_rdatatype_a:
dns_rdata_freestruct(&a);
case dns_rdatatype_a6:
INSIST(0);
static isc_result_t
if (value)
if (value)
unsigned int *optionsmask)
goto cleanup;
goto cleanup;
return (DNS_R_SUCCESS);
return (DNS_R_NOMEMORY);
return (DNS_R_SUCCESS);
goto cleanup;
return (DNS_R_SUCCESS);
return (DNS_R_NOMEMORY);
return (DNS_R_NOMEMORY);
return (DNS_R_SUCCESS);
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:
case dns_zone_stub:
#ifdef notyet
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
#ifdef notyet
return (result);
return (result);
#ifdef notyet
static isc_result_t
(void)tmgr;
return (DNS_R_SUCCESS);
return (DNS_R_UNEXPECTED);
return (DNS_R_UNEXPECTED);
isc_socket_t *s;
== ISC_R_SUCCESS);
s = NULL;
return (result);
isc_socket_detach(&s);
return (DNS_R_SUCCESS);
goto cleanup1;
goto cleanup2;
#ifdef notyet
char *master;
&masterbuf);
goto next_master;
goto next_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;
goto next_master;
goto next_master;
#ifdef notyet
static isc_result_t
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub:
if (next == 0) {
return (DNS_R_UNEXPECTED);
return (DNS_R_SUCCESS);
static isc_result_t
return (result);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
return (DNS_R_FORMERR);
return (DNS_R_NOTIMP);
return (DNS_R_SUCCESS);
return (DNS_R_REFUSED);
&rdataset);
return (DNS_R_SUCCESS);
return (DNS_R_SUCCESS);
return (DNS_R_SUCCESS);
const char *fmt, ...) {
int len;
#ifdef notyet
int res = 0;
res++;
return (res);
if (idlein == 0)
if (idleout == 0)
#ifdef notyet
record_serial() {
return (ISC_FALSE);
return (result);
static isc_result_t
goto fail;
if (dump) {
goto fail;
return (DNS_R_SUCCESS);
fail:
return (result);
switch (result) {
case DNS_R_UPTODATE:
case DNS_R_SUCCESS:
if (again)
if (port == 0)
port);
return (ISC_R_NOMEMORY);
goto free_mem;
goto free_rwlock;
goto free_conflock;
goto free_transfersin;
goto free_taskpool;
return (ISC_R_SUCCESS);
return (result);
goto cleanup_task;
goto cleanup_timer;
goto unlock;
return (result);
dns_zone_t *p;
p != NULL;
return (ISC_R_SUCCESS);