From: Vladimír Čunát Date: Tue, 20 Feb 2018 16:15:31 +0000 (+0100) Subject: nitpicks around zone cut searching X-Git-Tag: v2.1.1~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1350c27fea259ef6399682d17aa08e2f613a3c3;p=thirdparty%2Fknot-resolver.git nitpicks around zone cut searching It's mostly just --verbose logging adjustments. --- diff --git a/lib/cache/api.c b/lib/cache/api.c index 4cebca665..e459adc42 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -801,7 +801,8 @@ static int stash_rrset(const ranked_rr_array_t *arr, int arr_i, WITH_VERBOSE(qry) { /* Reduce verbosity. */ - if (!kr_rank_test(entry->rank, KR_RANK_AUTH)) { + if (!kr_rank_test(entry->rank, KR_RANK_AUTH) + && rr->type != KNOT_RRTYPE_NS) { ++*unauth_cnt; return kr_ok(); } diff --git a/lib/layer/validate.c b/lib/layer/validate.c index a90afa3b1..79be6e4a1 100644 --- a/lib/layer/validate.c +++ b/lib/layer/validate.c @@ -764,7 +764,8 @@ static int check_signer(kr_layer_t *ctx, knot_pkt_t *pkt) return KR_STATE_DONE; } -/** Change ranks of RRs from this single iteration: _INITIAL or _MISSING -> rank_to_set. */ +/** Change ranks of RRs from this single iteration: + * _INITIAL or _TRY or _MISSING -> rank_to_set. */ static void rank_records(kr_layer_t *ctx, enum kr_rank rank_to_set) { struct kr_request *req = ctx->req; diff --git a/lib/resolve.c b/lib/resolve.c index f9adf2329..d6f71d5bd 100644 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -267,8 +267,7 @@ static int ns_fetch_cut(struct kr_query *qry, const knot_dname_t *requested_name qry->flags.DNSSEC_WANT = false; } /* Check if any DNSKEY found for cached cut */ - if ((qry->flags.DNSSEC_WANT) && - (cut_found.key == NULL)) { + if ((qry->flags.DNSSEC_WANT) && (cut_found.key == NULL)) { /* No DNSKEY was found for cached cut. * If no glue were fetched for this cut, * we have got circular dependency - must fetch A\AAAA @@ -1277,7 +1276,7 @@ static int zone_cut_check(struct kr_request *request, struct kr_query *qry, knot if (ret != 0) { return KR_STATE_FAIL; } - VERBOSE_MSG(qry, "=> using root hints\n"); + VERBOSE_MSG(qry, "=> no cache open, using root hints\n"); qry->flags.AWAIT_CUT = false; return KR_STATE_DONE; } diff --git a/lib/zonecut.c b/lib/zonecut.c index 52ff62491..841aa76b8 100644 --- a/lib/zonecut.c +++ b/lib/zonecut.c @@ -354,7 +354,8 @@ static int fetch_secure_rrset(knot_rrset_t **rr, struct kr_cache *cache, const struct kr_query *qry) { if (!rr) { - return kr_error(ENOENT); + assert(!EINVAL); + return kr_error(EINVAL); } /* peek, check rank and TTL */ struct kr_cache_p peek; @@ -416,18 +417,21 @@ int kr_zonecut_find_cached(struct kr_context *ctx, struct kr_zonecut *cut, *secured = false; } /* Fetch DS and DNSKEY if caller wants secure zone cut */ + int ret_ds = 1, ret_dnskey = 1; if (*secured || is_root) { - fetch_secure_rrset(&cut->trust_anchor, &ctx->cache, label, - KNOT_RRTYPE_DS, cut->pool, qry); - fetch_secure_rrset(&cut->key, &ctx->cache, label, - KNOT_RRTYPE_DNSKEY, cut->pool, qry); + ret_ds = fetch_secure_rrset(&cut->trust_anchor, &ctx->cache, + label, KNOT_RRTYPE_DS, cut->pool, qry); + ret_dnskey = fetch_secure_rrset(&cut->key, &ctx->cache, + label, KNOT_RRTYPE_DNSKEY, cut->pool, qry); } update_cut_name(cut, label); mm_free(cut->pool, qname); kr_cache_sync(&ctx->cache); WITH_VERBOSE(qry) { auto_free char *label_str = kr_dname_text(label); - VERBOSE_MSG(qry, "found cut: %s\n", label_str); + VERBOSE_MSG(qry, + "found cut: %s (return codes: DS %d, DNSKEY %d)\n", + label_str, ret_ds, ret_dnskey); } return kr_ok(); }