]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rplan: ability to refetch expiring queries
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 18 Jul 2015 22:56:03 +0000 (00:56 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 18 Jul 2015 23:24:00 +0000 (01:24 +0200)
lib/layer/rrcache.c
lib/rplan.h

index 65b0596a5ff85d1c99c0195e46b0476de5068d67..9d017caf64d2a1d17c44e3acc921406e253d7272 100644 (file)
@@ -52,17 +52,21 @@ static int loot_rr(struct kr_cache_txn *txn, knot_pkt_t *pkt, const knot_dname_t
                return ret;
        }
 
+       /* Mark as expiring if it has less than 1% TTL (or less than 5s) */
+       if (is_expiring(&cache_rr, drift)) {
+               if (qry->flags & QUERY_NO_EXPIRING) {
+                       return kr_error(ENOENT);
+               } else {
+                       qry->flags |= QUERY_EXPIRING;
+               }
+       }
+
        /* Update packet question */
        if (!knot_dname_is_equal(knot_pkt_qname(pkt), name)) {
                KR_PKT_RECYCLE(pkt);
                knot_pkt_put_question(pkt, qry->sname, qry->sclass, qry->stype);
        }
 
-       /* Mark as expiring if it has less than 1% TTL (or less than 5s) */
-       if (is_expiring(&cache_rr, drift)) {
-               qry->flags |= QUERY_EXPIRING;
-       }
-
        /* Update packet answer */
        knot_rrset_t rr_copy;
        ret = kr_cache_materialize(&rr_copy, &cache_rr, drift, &pkt->mm);
index a459f4c5b2a795f47f8cf3bca2bc11a928993a5f..96785a6f78f4409ec2aa517df6e2bfa2bfc05ad6 100644 (file)
@@ -36,7 +36,8 @@
        X(AWAIT_CUT  , 1 << 6) /**< Query is waiting for zone cut lookup */ \
        X(SAFEMODE   , 1 << 7) /**< Don't use fancy stuff (EDNS...) */ \
        X(CACHED     , 1 << 8) /**< Query response is cached. */ \
-       X(EXPIRING   , 1 << 9) /**< Query response is cached, but expiring. */
+       X(EXPIRING   , 1 << 9) /**< Query response is cached, but expiring. */ \
+       X(NO_EXPIRING, 1 << 10) /**< Do not use expiring cached records. */ \
 
 /** Query flags */
 enum kr_query_flag {