From 54d64c7994d01da590462ecc56faf1a87fc4abb9 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Mon, 19 Mar 2001 22:34:14 +0000 Subject: [PATCH] 782. [feature] Implement the serial-query-rate option. --- CHANGES | 2 ++ bin/named/config.c | 3 ++- bin/named/server.c | 7 ++++++- doc/misc/options | 3 ++- lib/dns/include/dns/zone.h | 20 ++++++++++++++++++- lib/dns/zone.c | 40 ++++++++++++++++++++++++++++++++++++-- lib/isccfg/parser.c | 3 ++- 7 files changed, 71 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 052accc16f..e090d7c37f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ + 782. [feature] Implement the serial-query-rate option. + 781. [func] Avoid error packet loops by dropping duplicate FORMERR responses. [RT #1006] diff --git a/bin/named/config.c b/bin/named/config.c index 9429247d74..5a1707ec40 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.5 2001/03/14 21:53:20 halley Exp $ */ +/* $Id: config.c,v 1.6 2001/03/19 22:34:05 bwelling Exp $ */ #include @@ -71,6 +71,7 @@ options {\n\ recursive-clients 1000;\n\ rrset-order {order cyclic;};\n\ serial-queries 20;\n\ + serial-query-rate 20;\n\ stacksize default;\n\ statistics-file \"named.stats\";\n\ statistics-interval 3600;\n\ diff --git a/bin/named/server.c b/bin/named/server.c index 04debe4d3e..06b7130735 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.306 2001/03/16 22:59:31 bwelling Exp $ */ +/* $Id: server.c,v 1.307 2001/03/19 22:34:06 bwelling Exp $ */ #include @@ -1648,6 +1648,11 @@ load_configuration(const char *filename, ns_server_t *server, INSIST(result == ISC_R_SUCCESS); dns_zonemgr_settransfersperns(server->zonemgr, cfg_obj_asuint32(obj)); + obj = NULL; + result = ns_config_get(maps, "serial-query-rate", &obj); + INSIST(result == ISC_R_SUCCESS); + dns_zonemgr_setserialqueryrate(server->zonemgr, cfg_obj_asuint32(obj)); + /* * Determine which port to use for listening for incoming connections. */ diff --git a/doc/misc/options b/doc/misc/options index 6f2e0487e3..ff954198eb 100644 --- a/doc/misc/options +++ b/doc/misc/options @@ -1,7 +1,7 @@ Copyright (C) 2000, 2001 Internet Software Consortium. See COPYRIGHT in the source root or http://isc.org/copyright.html for terms. -$Id: options,v 1.64 2001/03/16 18:18:57 bwelling Exp $ +$Id: options,v 1.65 2001/03/19 22:34:08 bwelling Exp $ This is a summary of the implementation status of the various named.conf options in BIND 9. @@ -85,6 +85,7 @@ options { [ max-cache-size size_spec; ] No* [ min-roots number; ] Obsolete [ serial-queries number; ] Obsolete + [ serial-query-rate number; ] Yes* [ transfer-format ( one-answer | many-answers ); ] Yes% [ transfers-in number; ] Yes [ transfers-out number; ] Yes diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index ff61784b5f..6f271f4a3a 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.h,v 1.100 2001/02/26 01:45:57 marka Exp $ */ +/* $Id: zone.h,v 1.101 2001/03/19 22:34:11 bwelling Exp $ */ #ifndef DNS_ZONE_H #define DNS_ZONE_H 1 @@ -1232,6 +1232,24 @@ dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr); * 'zmgr' to be a valid zone manager. */ +void +dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value); +/* + * Set the number of SOA queries sent per second. + * + * Requires: + * 'zmgr' to be a valid zone manager + */ + +unsigned int +dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr); +/* + * Return the number of SOA queries sent per second. + * + * Requires: + * 'zmgr' to be a valid zone manager. + */ + void dns_zone_forcereload(dns_zone_t *zone); /* diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 3d1bec352a..30e074ca4f 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.311 2001/03/01 17:46:59 bwelling Exp $ */ +/* $Id: zone.c,v 1.312 2001/03/19 22:34:09 bwelling Exp $ */ #include @@ -275,6 +275,7 @@ struct dns_zonemgr { /* Configuration data. */ int transfersin; int transfersperns; + unsigned int serialqueryrate; /* Locked by iolock */ isc_uint32_t iolimit; @@ -5209,7 +5210,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, &zmgr->rl); if (result != ISC_R_SUCCESS) goto free_task; - /* 20 refresh queries / notifies per second. */ + /* default to 20 refresh queries / notifies per second. */ isc_interval_set(&interval, 0, 1000000000/2); result = isc_ratelimiter_setinterval(zmgr->rl, &interval); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -5752,6 +5753,41 @@ dns_zonemgr_dbdestroyed(isc_task_t *task, isc_event_t *event) { } #endif +void +dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value) { + isc_interval_t interval; + isc_uint32_t ns; + isc_uint32_t pertic; + isc_result_t result; + + REQUIRE(DNS_ZONEMGR_VALID(zmgr)); + + if (value == 0) + value = 1; + + if (value < 10) { + ns = 1000000000 / value; + pertic = 1; + } else { + ns = (1000000000 / value) * 10; + pertic = 10; + } + + isc_interval_set(&interval, 0, ns); + result = isc_ratelimiter_setinterval(zmgr->rl, &interval); + RUNTIME_CHECK(result == ISC_R_SUCCESS); + isc_ratelimiter_setpertic(zmgr->rl, pertic); + + zmgr->serialqueryrate = value; +} + +unsigned int +dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr) { + REQUIRE(DNS_ZONEMGR_VALID(zmgr)); + + return (zmgr->serialqueryrate); +} + void dns_zone_forcereload(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 464522e031..91b3f8dae6 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.47 2001/03/14 21:53:29 halley Exp $ */ +/* $Id: parser.c,v 1.48 2001/03/19 22:34:12 bwelling Exp $ */ #include @@ -815,6 +815,7 @@ options_clauses[] = { { "recursive-clients", &cfg_type_uint32, 0 }, { "rrset-order", &cfg_type_rrsetorder, 0 }, { "serial-queries", &cfg_type_uint32, CFG_CLAUSEFLAG_OBSOLETE }, + { "serial-query-rate", &cfg_type_uint32, 0 }, { "stacksize", &cfg_type_size, 0 }, { "statistics-file", &cfg_type_qstring, 0 }, { "statistics-interval", &cfg_type_uint32, CFG_CLAUSEFLAG_NYI },