From: Vladimír Čunát Date: Fri, 26 Jan 2018 13:27:53 +0000 (+0100) Subject: cache: *always* store and retrieve RRSIGs X-Git-Tag: v2.0.0~6^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04ff1298abfd1208cf5bc38d5288f98a94d871f5;p=thirdparty%2Fknot-resolver.git cache: *always* store and retrieve RRSIGs --- diff --git a/lib/cache.c b/lib/cache.c index d74579d03..e8a52c286 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -41,6 +41,14 @@ #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 : diff --git a/lib/cache/entry_rr.c b/lib/cache/entry_rr.c index 5f127ade8..47e1c6e6e 100644 --- a/lib/cache/entry_rr.c +++ b/lib/cache/entry_rr.c @@ -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); diff --git a/tests/deckard b/tests/deckard index 0a8445786..05064e06e 160000 --- a/tests/deckard +++ b/tests/deckard @@ -1 +1 @@ -Subproject commit 0a844578608bb0c944880082bcbfce96453dfa98 +Subproject commit 05064e06e7dbea44308c9776f1823d1a5dfb9556