]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
cache: fixed drift when current time <= than cached
authorMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 9 Feb 2015 16:15:43 +0000 (17:15 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 9 Feb 2015 16:15:43 +0000 (17:15 +0100)
lib/cache.c

index 704bfcf05f32de78fa7dc520e7218fe742465a0d..1c2ef64e03f85a81f92c68c474d3c8026b45ee49 100644 (file)
@@ -115,8 +115,14 @@ int kr_cache_peek(namedb_txn_t *txn, knot_rrset_t *rr, uint32_t *timestamp)
                rr->rrs.rr_count = found_rr->count;
                rr->rrs.data = found_rr->data;
 
-               /* No time constraint or current timestamp */
-               if (timestamp == NULL || *timestamp <= found_rr->timestamp) {
+               /* No time constraint */
+               if (timestamp == NULL) {
+                       return KNOT_EOK;
+               }
+
+               /* John Connor record cached from the future. */
+               if (*timestamp < found_rr->timestamp) {
+                       *timestamp = 0;
                        return KNOT_EOK;
                }