From: Mark Andrews Date: Thu, 25 Oct 2012 03:29:10 +0000 (+1100) Subject: 3405. [bug] Handle time going backwards in acache. [RT #31253] X-Git-Tag: v9.10.0a1~766 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=f3e10cca1b9a95fab5ac7a162c0705e2d9da7370;p=thirdparty%2Fbind9.git 3405. [bug] Handle time going backwards in acache. [RT #31253] Squashed commit of the following: commit fbf4c8fe2644c101bac870360d3f2c159a90f203 Author: Mark Andrews Date: Wed Oct 24 14:43:14 2012 +1100 remove INSIST and handle time going backwards --- diff --git a/CHANGES b/CHANGES index 7a5194465a8..8046ecfaebe 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +3405. [bug] Handle time going backwards in acache. [RT #31253] + 3404. [bug] dnssec-signzone: When re-signing a zone, remove RRSIG and NSEC records from nodes that used to be in-zone but are now below a zone cut. [RT #31556] diff --git a/lib/dns/acache.c b/lib/dns/acache.c index 2ad4981de69..0c96010c2de 100644 --- a/lib/dns/acache.c +++ b/lib/dns/acache.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -776,10 +777,14 @@ entry_stale(acache_cleaner_t *cleaner, dns_acacheentry_t *entry, * use and the cleaning interval. */ if (cleaner->overmem) { - unsigned int passed = - now32 - entry->lastused; /* <= interval */ + unsigned int passed; isc_uint32_t val; + if (isc_serial_ge(now32, entry->lastused)) + passed = now32 - entry->lastused; /* <= interval */ + else + passed = 0; + if (passed > interval / 2) return (ISC_TRUE); isc_random_get(&val); @@ -825,8 +830,10 @@ acache_incremental_cleaning_action(isc_task_t *task, isc_event_t *event) { entry = cleaner->current_entry; isc_stdtime_convert32(cleaner->last_cleanup_time, &last32); - INSIST(now32 > last32); - interval = now32 - last32; + if (isc_serial_ge(now32, last32)) + interval = now32 - last32; + else + interval = 0; while (n_entries-- > 0) { isc_boolean_t is_stale = ISC_FALSE;