to break up the key data in a "trusted-keys"
statement into multiple lines. [RT #284]
- 432. [func] Added refresh/retry jitter. This is currently
- hard-coded to be no more than 20% of the SOA
- provided time or 10 minutes, whichever is less.
+ 432. [func] Added refresh/retry jitter. The actual refresh/
+ retry time is now a random value between 75% and
+ 100% of the configured value.
431. [func] Log at ISC_LOG_INFO when a zone is successfully
loaded.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.218 2000/09/26 16:32:39 gson Exp $ */
+/* $Id: zone.c,v 1.219 2000/09/26 17:23:19 gson Exp $ */
#include <config.h>
#define DNS_MAX_EXPIRE 14515200 /* 24 weeks */
#endif
-#define REFRESH_JITTER 600 /* seconds */
-#define RETRY_JITTER 600
-
typedef struct dns_notify dns_notify_t;
typedef struct dns_stub dns_stub_t;
typedef struct dns_load dns_load_t;
* Setting this to the retry time will do that. XXXMLG
* If we are successful it will be reset using zone->refresh.
*/
- zone->refreshtime = now + isc_random_jitter(zone->retry,
- zone->retry * .80,
- RETRY_JITTER);
+ zone->refreshtime = now +
+ isc_random_jitter(zone->retry, zone->retry / 4);
zone_log(zone, "dns_zone_refresh", ISC_LOG_DEBUG(20),
"refresh time (%u/%u), now %u",
zone->refreshtime, zone->refresh, now);
LOCK(&zone->lock);
zone->flags &= ~DNS_ZONEFLG_REFRESH;
zone->refreshtime = now +
- isc_random_jitter(zone->refresh, zone->refresh * .80,
- REFRESH_JITTER);
+ isc_random_jitter(zone->refresh, zone->refresh / 4);
zone->expiretime = now + zone->expire;
zone_log(zone, me, ISC_LOG_DEBUG(20),
"refresh time (%u/%u), now %u",
dns_result_totext(result));
}
zone->refreshtime = now +
- isc_random_jitter(zone->refresh, zone->refresh * .80,
- REFRESH_JITTER);
+ isc_random_jitter(zone->refresh, zone->refresh / 4);
zone->expiretime = now + zone->expire;
zone_log(zone, me, ISC_LOG_DEBUG(20),
"refresh time (%u/%u), now %u",
} else {
zone->refreshtime = now +
isc_random_jitter(zone->refresh,
- zone->refresh * .80,
- REFRESH_JITTER);
+ zone->refresh / 4);
zone_log(zone, me, ISC_LOG_DEBUG(20),
"refresh time (%u/%u), now %u",
zone->refreshtime, zone->refresh, now);
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.h,v 1.9 2000/09/06 16:25:35 gson Exp $ */
+/* $Id: random.h,v 1.10 2000/09/26 17:23:16 gson Exp $ */
#ifndef ISC_RANDOM_H
#define ISC_RANDOM_H 1
*/
isc_uint32_t
-isc_random_jitter(isc_uint32_t max, isc_uint32_t min, isc_uint32_t jitter);
+isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter);
/*
- * Return a value between (max - jitter) and (max).
- *
- * If (max - min) < jitter, the maximum jitter becomes (max - min) instead.
+ * Get a random value between (max - jitter) and (max).
+ * This is useful for jittering timer values.
*/
ISC_LANG_ENDDECLS
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: random.c,v 1.12 2000/09/08 00:06:39 explorer Exp $ */
+/* $Id: random.c,v 1.13 2000/09/26 17:23:17 gson Exp $ */
#include <config.h>
}
isc_uint32_t
-isc_random_jitter(isc_uint32_t max, isc_uint32_t min, isc_uint32_t jitter) {
- isc_uint32_t val;
-
- REQUIRE(jitter > 0);
-
- if (min >= max)
- return (min);
-
- /*
- * Don't allow jitter to be more than max - min.
- */
- if (jitter > max - min)
- jitter = max - min;
+isc_random_jitter(isc_uint32_t max, isc_uint32_t jitter) {
+ REQUIRE(jitter < max);
if (jitter == 0)
- return (min);
-
- val = rand() % jitter;
- return (max - val);
+ return (max);
+ else
+ return (max - rand() % jitter);
}