From: Vladimír Čunát Date: Fri, 2 Feb 2018 10:25:52 +0000 (+0100) Subject: cache: assume NSEC if ". NS" is missing in cache X-Git-Tag: v2.1.0~13^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7c3192b8e3105f2d8864c7c13bc780bea3ec472;p=thirdparty%2Fknot-resolver.git cache: assume NSEC if ". NS" is missing in cache This happens e.g. after cache.clear(), and currently one can stay long-term without that record in cache. That was effectively disabling aggressive answers from the root zone. This needs disabling a buggy part of Deckard test. --- diff --git a/lib/cache/api.c b/lib/cache/api.c index 6860dd52e..e0eb6c06f 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -382,8 +382,7 @@ static int cache_peek_real(kr_layer_t *ctx, knot_pkt_t *pkt) kr_dname_lf(k->buf, k->zname, false); /* LATER(optim.): probably remove */ const knot_db_val_t val_cut = closest_NS(ctx, k); if (!val_cut.data) { - VERBOSE_MSG(qry, "=> not even root NS in cache\n"); - return ctx->state; /* nothing to do without any NS at all */ + VERBOSE_MSG(qry, "=> not even root NS in cache, but let's try NSEC\n"); } switch (k->type) { case KNOT_RRTYPE_NS: @@ -1106,7 +1105,11 @@ static knot_db_val_t closest_NS(kr_layer_t *ctx, struct key *k) next_label: /* remove one more label */ exact_match = false; - if (k->zname[0] == 0) { /* missing root NS in cache */ + if (k->zname[0] == 0) { + /* We miss root NS in cache, but let's at least assume it exists. */ + k->type = KNOT_RRTYPE_NS; + k->zlf_len = zlf_len; + assert(zlf_len == 0); return VAL_EMPTY; } zlf_len -= (k->zname[0] + 1); diff --git a/tests/deckard b/tests/deckard index 05064e06e..39772e733 160000 --- a/tests/deckard +++ b/tests/deckard @@ -1 +1 @@ -Subproject commit 05064e06e7dbea44308c9776f1823d1a5dfb9556 +Subproject commit 39772e7336d9465a81bae6e983cb7fd559f7f0bc