Commit 48f929d3 authored by Mark Andrews's avatar Mark Andrews

1792. [func] New zone option "notify-delay". Specify a minimum

                        delay between sets of NOTIFY messages.
parent e286a65f
......@@ -10,7 +10,8 @@
1793. [placeholder] rt13378
1792. [placeholder] rt13124
1792. [func] New zone option "notify-delay". Specify a minimum
delay between sets of NOTIFY messages.
1791. [placeholder] rt13230
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.54 2005/01/10 23:43:16 marka Exp $ */
/* $Id: config.c,v 1.55 2005/01/11 23:10:04 marka Exp $ */
#include <config.h>
......@@ -136,6 +136,7 @@ options {\n\
allow-transfer {any;};\n\
notify yes;\n\
# also-notify <none>\n\
notify-delay 5;\n\
dialup no;\n\
# forward <none>\n\
# forwarders <none>\n\
......
......@@ -15,7 +15,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: named.conf.docbook,v 1.5 2004/11/11 01:08:23 marka Exp $ -->
<!-- $Id: named.conf.docbook,v 1.6 2005/01/11 23:10:04 marka Exp $ -->
<refentry>
<refentryinfo>
......@@ -258,6 +258,7 @@ options {
notify <replaceable>notifytype</replaceable>;
notify-source ( <replaceable>ipv4_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-source-v6 ( <replaceable>ipv6_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-delay <replaceable>seconds</replaceable>;
also-notify <optional> port <replaceable>integer</replaceable> </optional> { ( <replaceable>ipv4_address</replaceable> | <replaceable>ipv6_address</replaceable> )
<optional> port <replaceable>integer</replaceable> </optional>; ... };
allow-notify { <replaceable>address_match_element</replaceable>; ... };
......@@ -387,6 +388,7 @@ view <replaceable>string</replaceable> <replaceable>optional_class</replaceable>
notify <replaceable>notifytype</replaceable>;
notify-source ( <replaceable>ipv4_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-source-v6 ( <replaceable>ipv6_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-delay <replaceable>seconds</replaceable>;
also-notify <optional> port <replaceable>integer</replaceable> </optional> { ( <replaceable>ipv4_address</replaceable> | <replaceable>ipv6_address</replaceable> )
<optional> port <replaceable>integer</replaceable> </optional>; ... };
allow-notify { <replaceable>address_match_element</replaceable>; ... };
......@@ -464,6 +466,7 @@ zone <replaceable>string</replaceable> <replaceable>optional_class</replaceable>
notify <replaceable>notifytype</replaceable>;
notify-source ( <replaceable>ipv4_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-source-v6 ( <replaceable>ipv6_address</replaceable> | * ) <optional> port ( <replaceable>integer</replaceable> | * ) </optional>;
notify-delay <replaceable>seconds</replaceable>;
also-notify <optional> port <replaceable>integer</replaceable> </optional> { ( <replaceable>ipv4_address</replaceable> | <replaceable>ipv6_address</replaceable> )
<optional> port <replaceable>integer</replaceable> </optional>; ... };
allow-notify { <replaceable>address_match_element</replaceable>; ... };
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.117 2005/01/11 03:46:08 marka Exp $ */
/* $Id: zoneconf.c,v 1.118 2005/01/11 23:10:04 marka Exp $ */
#include <config.h>
......@@ -561,6 +561,12 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
INSIST(0);
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES, check);
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMESFAIL, fail);
obj = NULL;
result = ns_config_get(maps, "notify-delay", &obj);
INSIST(result == ISC_R_SUCCESS);
dns_zone_setnotifydelay(zone, cfg_obj_asuint32(obj));
}
/*
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.h,v 1.130 2005/01/10 23:43:25 marka Exp $ */
/* $Id: zone.h,v 1.131 2005/01/11 23:10:05 marka Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
......@@ -1446,6 +1446,24 @@ dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache);
* 'zone' will have a reference to 'acache'
*/
void
dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay);
/*
* Set the minimum delay between sets of notify messages.
*
* Requires:
* 'zone' to be valid.
*/
isc_uint32_t
dns_zone_getnotifydelay(dns_zone_t *zone);
/*
* Get the minimum delay between sets of notify messages.
*
* Requires:
* 'zone' to be valid.
*/
ISC_LANG_ENDDECLS
#endif /* DNS_ZONE_H */
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.428 2005/01/10 23:43:22 marka Exp $ */
/* $Id: zone.c,v 1.429 2005/01/11 23:10:05 marka Exp $ */
#include <config.h>
......@@ -154,6 +154,7 @@ struct dns_zone {
isc_time_t refreshtime;
isc_time_t dumptime;
isc_time_t loadtime;
isc_time_t notifytime;
isc_uint32_t serial;
isc_uint32_t refresh;
isc_uint32_t retry;
......@@ -220,7 +221,8 @@ struct dns_zone {
/*
* Optional per-zone statistics counters (NULL if not present).
*/
isc_uint64_t *counters;
isc_uint64_t *counters;
isc_uint32_t notifydelay;
};
#define DNS_ZONE_FLAG(z,f) (ISC_TF(((z)->flags & (f)) != 0))
......@@ -443,7 +445,7 @@ static void forward_callback(isc_task_t *task, isc_event_t *event);
static void zone_saveunique(dns_zone_t *zone, const char *path,
const char *templat);
static void zone_maintenance(dns_zone_t *zone);
static void zone_notify(dns_zone_t *zone);
static void zone_notify(dns_zone_t *zone, isc_time_t *now);
static void dump_done(void *arg, isc_result_t result);
#define ENTER zone_debuglog(zone, me, 1, "enter")
......@@ -487,10 +489,12 @@ isc_result_t
dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
isc_result_t result;
dns_zone_t *zone;
isc_time_t now;
REQUIRE(zonep != NULL && *zonep == NULL);
REQUIRE(mctx != NULL);
TIME_NOW(&now);
zone = isc_mem_get(mctx, sizeof(*zone));
if (zone == NULL)
return (ISC_R_NOMEMORY);
......@@ -530,6 +534,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
isc_time_settoepoch(&zone->refreshtime);
isc_time_settoepoch(&zone->dumptime);
isc_time_settoepoch(&zone->loadtime);
zone->notifytime = now;
zone->serial = 0;
zone->refresh = DNS_ZONE_DEFAULTREFRESH;
zone->retry = DNS_ZONE_DEFAULTRETRY;
......@@ -580,6 +585,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
ISC_LINK_INIT(zone, statelink);
zone->statelist = NULL;
zone->counters = NULL;
zone->notifydelay = 5;
zone->magic = ZONE_MAGIC;
......@@ -2287,8 +2293,9 @@ zone_maintenance(dns_zone_t *zone) {
switch (zone->type) {
case dns_zone_master:
case dns_zone_slave:
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY))
zone_notify(zone);
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) &&
isc_time_compare(&now, &zone->notifytime) >= 0)
zone_notify(zone, &now);
break;
default:
break;
......@@ -3016,7 +3023,7 @@ dns_zone_notify(dns_zone_t *zone) {
}
static void
zone_notify(dns_zone_t *zone) {
zone_notify(dns_zone_t *zone, isc_time_t *now) {
dns_dbnode_t *node = NULL;
dns_dbversion_t *version = NULL;
dns_name_t *origin = NULL;
......@@ -3041,6 +3048,7 @@ zone_notify(dns_zone_t *zone) {
LOCK_ZONE(zone);
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
notifytype = zone->notifytype;
DNS_ZONE_TIME_ADD(now, zone->notifydelay, &zone->notifytime);
UNLOCK_ZONE(zone);
if (! DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED))
......@@ -4460,7 +4468,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) {
switch (zone->type) {
case dns_zone_master:
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY))
next = *now;
next = zone->notifytime;
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP) &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DUMPING)) {
INSIST(!isc_time_isepoch(&zone->dumptime));
......@@ -4472,7 +4480,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) {
case dns_zone_slave:
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY))
next = *now;
next = zone->notifytime;
/*FALLTHROUGH*/
case dns_zone_stub:
......@@ -6997,3 +7005,19 @@ dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata) {
return (ISC_R_SUCCESS);
}
void
dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay) {
REQUIRE(DNS_ZONE_VALID(zone));
LOCK_ZONE(zone);
zone->notifydelay = delay;
UNLOCK_ZONE(zone);
}
isc_uint32_t
dns_zone_getnotifydelay(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
return (zone->notifydelay);
}
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: namedconf.c,v 1.44 2005/01/10 23:43:27 marka Exp $ */
/* $Id: namedconf.c,v 1.45 2005/01/11 23:10:06 marka Exp $ */
#include <config.h>
......@@ -765,6 +765,7 @@ zone_clauses[] = {
{ "notify-source", &cfg_type_sockaddr4wild, 0 },
{ "notify-source-v6", &cfg_type_sockaddr6wild, 0 },
{ "also-notify", &cfg_type_portiplist, 0 },
{ "notify-delay", &cfg_type_uint32, 0 },
{ "dialup", &cfg_type_dialuptype, 0 },
{ "forward", &cfg_type_forwardtype, 0 },
{ "forwarders", &cfg_type_portiplist, 0 },
......
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