]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3352. [bug] Ensure that learned server attributes timeout of the
authorMark Andrews <marka@isc.org>
Wed, 18 Jul 2012 04:19:13 +0000 (14:19 +1000)
committerMark Andrews <marka@isc.org>
Wed, 18 Jul 2012 04:19:13 +0000 (14:19 +1000)
                        adb cache. [RT #29856]

CHANGES
lib/dns/adb.c

diff --git a/CHANGES b/CHANGES
index ecc39a5425c149c5b448ce877a23db7ab7ceeba2..224ab78fcd0660e1011706ba51ed4b5f53133f61 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3352.  [bug]           Ensure that learned server attributes timeout of the
+                       adb cache. [RT #29856]
+
 3351.  [bug]           isc_mem_put and isc_mem_putanddetach didn't report
                        caller if either ISC_MEM_DEBUGSIZE or ISC_MEM_DEBUGCTX
                        memory debugging flags are set. [RT #30243]
index 6c98b68cdd9ac6d7f138e6ba147684aea7043245..2e7788d02327bc0f4be9a8fa330f821875eaa85c 100644 (file)
@@ -3431,8 +3431,10 @@ dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
        addr->entry->srtt = new_srtt;
        addr->srtt = new_srtt;
 
-       isc_stdtime_get(&now);
-       addr->entry->expires = now + ADB_ENTRY_WINDOW;
+       if (addr->entry->expires == 0) {
+               isc_stdtime_get(&now);
+               addr->entry->expires = now + ADB_ENTRY_WINDOW;
+       }
 
        UNLOCK(&adb->entrylocks[bucket]);
 }
@@ -3442,6 +3444,7 @@ dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
                    unsigned int bits, unsigned int mask)
 {
        int bucket;
+       isc_stdtime_t now;
 
        REQUIRE(DNS_ADB_VALID(adb));
        REQUIRE(DNS_ADBADDRINFO_VALID(addr));
@@ -3450,6 +3453,11 @@ dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
        LOCK(&adb->entrylocks[bucket]);
 
        addr->entry->flags = (addr->entry->flags & ~mask) | (bits & mask);
+       if (addr->entry->expires == 0) {
+               isc_stdtime_get(&now);
+               addr->entry->expires = now + ADB_ENTRY_WINDOW;
+       }
+
        /*
         * Note that we do not update the other bits in addr->flags with
         * the most recent values from addr->entry->flags.
@@ -3528,15 +3536,16 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) {
        entry = addr->entry;
        REQUIRE(DNS_ADBENTRY_VALID(entry));
 
-       isc_stdtime_get(&now);
-
        *addrp = NULL;
        overmem = isc_mem_isovermem(adb->mctx);
 
        bucket = addr->entry->lock_bucket;
        LOCK(&adb->entrylocks[bucket]);
 
-       entry->expires = now + ADB_ENTRY_WINDOW;
+       if (entry->expires == 0) {
+               isc_stdtime_get(&now);
+               entry->expires = now + ADB_ENTRY_WINDOW;
+       }
 
        want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE);