]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
cache: *always* store and retrieve RRSIGs
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 26 Jan 2018 13:27:53 +0000 (14:27 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 26 Jan 2018 14:09:46 +0000 (15:09 +0100)
lib/cache.c
lib/cache/entry_rr.c
tests/deckard

index d74579d038739f761e89697b23b8202e2f908aef..e8a52c286dc16b02a45d4dbfb48a94724ef789ce 100644 (file)
 
 #include "lib/cache/impl.h"
 
+/* TODO:
+ *     - Reconsider when RRSIGs are put in and retrieved from the cache.
+ *       Currently it's always done, which _might_ be spurious, depending
+ *       on how kresd will use the returned result.
+ *       There's also the "problem" that kresd ATM does _not_ ask upstream
+ *       with DO bit in some cases.
+ */
+
 
 /** Cache version */
 static const uint16_t CACHE_VERSION = 2;
@@ -706,21 +714,19 @@ static int stash_rrset(const ranked_rr_array_t *arr, int arr_i,
                break;
        }
 
-       /* Find corresponding signatures, if validated.  LATER(optim.): speed. */
+       /* Try to find corresponding signatures, always.  LATER(optim.): speed. */
        const knot_rrset_t *rr_sigs = NULL;
-       if (kr_rank_test(entry->rank, KR_RANK_SECURE)) {
-               for (ssize_t j = arr->len - 1; j >= 0; --j) {
-                       /* TODO: ATM we assume that some properties are the same
-                        * for all RRSIGs in the set (esp. label count). */
-                       ranked_rr_array_entry_t *e = arr->at[j];
-                       bool ok = e->qry_uid == qry->uid && !e->cached
-                               && e->rr->type == KNOT_RRTYPE_RRSIG
-                               && knot_rrsig_type_covered(&e->rr->rrs, 0) == rr->type
-                               && knot_dname_is_equal(rr->owner, e->rr->owner);
-                       if (!ok) continue;
-                       rr_sigs = e->rr;
-                       break;
-               }
+       for (ssize_t j = arr->len - 1; j >= 0; --j) {
+               /* TODO: ATM we assume that some properties are the same
+                * for all RRSIGs in the set (esp. label count). */
+               ranked_rr_array_entry_t *e = arr->at[j];
+               bool ok = e->qry_uid == qry->uid && !e->cached
+                       && e->rr->type == KNOT_RRTYPE_RRSIG
+                       && knot_rrsig_type_covered(&e->rr->rrs, 0) == rr->type
+                       && knot_dname_is_equal(rr->owner, e->rr->owner);
+               if (!ok) continue;
+               rr_sigs = e->rr;
+               break;
        }
 
        const int wild_labels = rr_sigs == NULL ? 0 :
index 5f127ade877e28151925b3599b6ad7a54c5accea..47e1c6e6ed0d914d10156196dc393284bfc77e6c 100644 (file)
@@ -124,8 +124,7 @@ int entry2answer(struct answer *ans, int id,
        ans->rrsets[id].set.rank = eh->rank;
        ans->rrsets[id].set.expiring = is_expiring(eh->ttl, new_ttl);
        /* Materialize the RRSIG RRset for the answer in (pseudo-)packet. */
-       bool want_rrsigs = kr_rank_test(eh->rank, KR_RANK_SECURE);
-                       //^^ TODO: vague; function parameter instead?
+       bool want_rrsigs = true; // TODO
        if (want_rrsigs) {
                ret = rdataset_materialize(&ans->rrsets[id].sig_rds, eh->data + data_off,
                                           eh_bound, new_ttl, ans->mm);
index 0a844578608bb0c944880082bcbfce96453dfa98..05064e06e7dbea44308c9776f1823d1a5dfb9556 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0a844578608bb0c944880082bcbfce96453dfa98
+Subproject commit 05064e06e7dbea44308c9776f1823d1a5dfb9556