Commit cb9aa603 authored by Michael Graff's avatar Michael Graff
Browse files

wire up the {min,max}-{refresh,retry}-time stuff

parent 44f14735
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.51 2000/08/01 01:23:10 tale Exp $ */
/* $Id: zoneconf.c,v 1.52 2000/08/02 22:29:14 explorer Exp $ */
#include <config.h>
......@@ -322,6 +322,42 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
sockaddr = sockaddr_any6;
dns_zone_setxfrsource6(zone, &sockaddr);
result = dns_c_zone_getmaxrefreshtime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getmaxrefreshtime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxrefreshtime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MAXREFRESH;
dns_zone_setmaxrefreshtime(zone, uintval);
result = dns_c_zone_getminrefreshtime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getminrefreshtime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getminrefreshtime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MINREFRESH;
dns_zone_setminrefreshtime(zone, uintval);
result = dns_c_zone_getmaxretrytime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getmaxretrytime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxretrytime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MAXRETRY;
dns_zone_setmaxretrytime(zone, uintval);
result = dns_c_zone_getminretrytime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getminretrytime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getminretrytime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MINRETRY;
dns_zone_setminretrytime(zone, uintval);
break;
default:
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.h,v 1.64 2000/08/01 01:24:58 tale Exp $ */
/* $Id: zone.h,v 1.65 2000/08/02 22:29:16 explorer Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
......@@ -44,6 +44,25 @@ typedef enum {
#define DNS_ZONEOPT_DIALUP 0x00000008U /* zone xfr over dialup link */
#define DNS_ZONEOPT_NOTIFY 0x00000010U /* perform NOTIFY */
#ifndef DNS_ZONE_MINREFRESH
#define DNS_ZONE_MINREFRESH 300 /* 5 minutes */
#endif
#ifndef DNS_ZONE_MAXREFRESH
#define DNS_ZONE_MAXREFRESH 2419200 /* 4 weeks */
#endif
#ifndef DNS_ZONE_DEFAULTREFRESH
#define DNS_ZONE_DEFAULTREFRESH 3600 /* 1 hour */
#endif
#ifndef DNS_ZONE_MINRETRY
#define DNS_ZONE_MINRETRY 300 /* 5 minutes */
#endif
#ifndef DNS_ZONE_MAXRETRY
#define DNS_ZONE_MAXRETRY 1209600 /* 2 weeks */
#endif
#ifndef DNS_ZONE_DEFAULTRETRY
#define DNS_ZONE_DEFAULTRETRY 1800 /* 30 minutes */
#endif
ISC_LANG_BEGINDECLS
/***
......@@ -449,6 +468,46 @@ dns_zone_setrefresh(dns_zone_t *zone, isc_uint32_t refresh,
* 'zone' to be a valid zone.
*/
void
dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val);
/*
* Set the minimum refresh time.
*
* Requires:
* 'zone' is valid.
* val > 0.
*/
void
dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val);
/*
* Set the maximum refresh time.
*
* Requires:
* 'zone' is valid.
* val > 0.
*/
void
dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val);
/*
* Set the minimum retry time.
*
* Requires:
* 'zone' is valid.
* val > 0.
*/
void
dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
/*
* Set the maximum retry time.
*
* Requires:
* 'zone' is valid.
* val > 0.
*/
isc_result_t
dns_zone_setxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
/*
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.172 2000/08/01 01:23:09 tale Exp $ */
/* $Id: zone.c,v 1.173 2000/08/02 22:29:13 explorer Exp $ */
#include <config.h>
......@@ -66,34 +66,16 @@
#define RANGE(a, b, c) (((a) < (b)) ? (b) : ((a) < (c) ? (a) : (c)))
/*
* Implementation limits.
*/
#ifndef DNS_MIN_REFRESH
#define DNS_MIN_REFRESH 2 /* 2 seconds */
#endif
#ifndef DNS_MAX_REFRESH
#define DNS_MAX_REFRESH 2419200 /* 4 weeks */
#endif
#ifndef DNS_MIN_RETRY
#define DNS_MIN_RETRY 1 /* 1 second */
#endif
#ifndef DNS_MAX_RETRY
#define DNS_MAX_RETRY 1209600 /* 2 weeks */
#endif
#ifndef DNS_MAX_EXPIRE
#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
#endif
/*
* Default values.
*/
#define DNS_DEFAULT_IDLEIN 3600 /* 1 hour */
#define DNS_DEFAULT_IDLEOUT 3600 /* 1 hour */
#define DEFAULT_REFRESH 900 /* 15 minutes */
#define DEFAULT_RETRY 300 /* 5 minutes */
#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours */
#ifndef DNS_MAX_EXPIRE
#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
#endif
typedef struct dns_notify dns_notify_t;
typedef struct dns_stub dns_stub_t;
......@@ -131,6 +113,12 @@ struct dns_zone {
isc_uint32_t retry;
isc_uint32_t expire;
isc_uint32_t minimum;
isc_uint32_t maxrefresh;
isc_uint32_t minrefresh;
isc_uint32_t maxretry;
isc_uint32_t minretry;
isc_sockaddr_t *masters;
#ifndef NOMINUM_PUBLIC
dns_name_t **masterkeynames;
......@@ -359,10 +347,15 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->dumptime = 0;
isc_time_settoepoch(&zone->loadtime);
zone->serial = 0;
zone->refresh = DEFAULT_REFRESH;
zone->retry = DEFAULT_RETRY;
zone->refresh = DNS_ZONE_DEFAULTREFRESH;
zone->retry = DNS_ZONE_DEFAULTRETRY;
zone->expire = 0;
zone->minimum = 0;
zone->maxrefresh = DNS_ZONE_MAXREFRESH;
zone->minrefresh = DNS_ZONE_MINREFRESH;
zone->maxretry = DNS_ZONE_MAXRETRY;
zone->minretry = DNS_ZONE_MINRETRY;
zone->masters = NULL;
#ifndef NOMINUM_PUBLIC
zone->masterkeynames = NULL;
......@@ -783,9 +776,10 @@ dns_zone_load(dns_zone_t *zone) {
}
}
zone->serial = serial;
zone->refresh = RANGE(refresh, DNS_MIN_REFRESH,
DNS_MAX_REFRESH);
zone->retry = RANGE(retry, DNS_MIN_RETRY, DNS_MAX_RETRY);
zone->refresh = RANGE(refresh,
zone->minrefresh, zone->maxrefresh);
zone->retry = RANGE(retry,
zone->minretry, zone->maxretry);
zone->expire = RANGE(expire, zone->refresh + zone->retry,
DNS_MAX_EXPIRE);
zone->minimum = minimum;
......@@ -1552,7 +1546,8 @@ zone_expire(dns_zone_t *zone) {
"failure: %s", dns_result_totext(result));
}
zone->flags |= DNS_ZONEFLG_EXPIRED;
dns_zone_setrefresh(zone, DEFAULT_REFRESH, DEFAULT_RETRY);
dns_zone_setrefresh(zone, DNS_ZONE_DEFAULTREFRESH,
DNS_ZONE_DEFAULTRETRY);
zone_unload(zone);
}
......@@ -1713,6 +1708,38 @@ dns_zone_setrefresh(dns_zone_t *zone, isc_uint32_t refresh,
zone->retry = retry;
}
void
dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(val > 0);
zone->minrefresh = val;
}
void
dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(val > 0);
zone->maxrefresh = val;
}
void
dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(val > 0);
zone->minretry = val;
}
void
dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val) {
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(val > 0);
zone->maxretry = val;
}
static isc_boolean_t
notify_isqueued(dns_zone_t *zone, dns_name_t *name, isc_sockaddr_t *addr) {
dns_notify_t *notify;
......@@ -3885,10 +3912,10 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
zone_log(zone, me, ISC_LOG_ERROR,
"no NS records");
zone->serial = serial;
zone->refresh = RANGE(refresh, DNS_MIN_REFRESH,
DNS_MAX_REFRESH);
zone->retry = RANGE(retry, DNS_MIN_RETRY,
DNS_MAX_RETRY);
zone->refresh = RANGE(refresh, zone->minrefresh,
zone->maxrefresh);
zone->retry = RANGE(retry, zone->minretry,
zone->maxretry);
zone->expire = RANGE(expire,
zone->refresh + zone->retry,
DNS_MAX_EXPIRE);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.51 2000/08/01 01:23:10 tale Exp $ */
/* $Id: zoneconf.c,v 1.52 2000/08/02 22:29:14 explorer Exp $ */
#include <config.h>
......@@ -322,6 +322,42 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
sockaddr = sockaddr_any6;
dns_zone_setxfrsource6(zone, &sockaddr);
result = dns_c_zone_getmaxrefreshtime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getmaxrefreshtime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxrefreshtime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MAXREFRESH;
dns_zone_setmaxrefreshtime(zone, uintval);
result = dns_c_zone_getminrefreshtime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getminrefreshtime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getminrefreshtime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MINREFRESH;
dns_zone_setminrefreshtime(zone, uintval);
result = dns_c_zone_getmaxretrytime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getmaxretrytime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getmaxretrytime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MAXRETRY;
dns_zone_setmaxretrytime(zone, uintval);
result = dns_c_zone_getminretrytime(czone, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_view_getminretrytime(cview, &uintval);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getminretrytime(cctx, &uintval);
if (result != ISC_R_SUCCESS)
uintval = DNS_ZONE_MINRETRY;
dns_zone_setminretrytime(zone, uintval);
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment