]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
cache: fix broken refresh of insecure records
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 14 Feb 2018 14:24:03 +0000 (15:24 +0100)
committerPetr Špaček <petr.spacek@nic.cz>
Thu, 15 Feb 2018 15:29:09 +0000 (16:29 +0100)
... that were about to expire.  The effect was that predict module
started the request, but cache still didn't overwrite the record if it
wasn't secure.

NEWS
lib/cache/entry_list.c

diff --git a/NEWS b/NEWS
index 8b144b4c6e19bebebec9f90e76878adf6815802c..894de67815d9e35f8376357d39b3c372fb429234 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Bugfixes
 - detect_time_jump module: don't clear cache on suspend-resume (#284)
 - stats module: fix stats.list() returning nothing, regressed in 2.0.0
 - policy.TLS_FORWARD: refusal when configuring with multiple IPs (#306)
+- cache: fix broken refresh of insecure records that were about to expire
 - fix the hints module on some systems, e.g. Fedora (came back on 2.0.0)
 - build with older gnutls (conditionally disable features)
 
index 4536a921bd49551ac9fa37b67819ff0b45b51b69..9afdafee7bf16e8a3a3c1e944c46af96ff3cd35d 100644 (file)
@@ -164,7 +164,7 @@ int entry_h_splice(
                 * Stale-serving is NOT considered, but TTL 1 would be considered
                 * as expiring anyway, ... */
                int32_t old_ttl = get_new_ttl(eh_orig, qry, NULL, 0);
-               if (old_ttl > 0 && !is_expiring(old_ttl, eh_orig->ttl)
+               if (old_ttl > 0 && !is_expiring(eh_orig->ttl, old_ttl)
                    && rank <= eh_orig->rank) {
                        WITH_VERBOSE(qry) {
                                auto_free char *type_str = kr_rrtype_text(type),