]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
nitpicks around zone cut searching
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 20 Feb 2018 16:15:31 +0000 (17:15 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 20 Feb 2018 16:27:43 +0000 (17:27 +0100)
It's mostly just --verbose logging adjustments.

lib/cache/api.c
lib/layer/validate.c
lib/resolve.c
lib/zonecut.c

index 4cebca665691828c5f4f2084085183e9b079e123..e459adc42131389b08bd60b0a6f176b604de12de 100644 (file)
@@ -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();
                }
index a90afa3b12d9710fbdb4e80b428691f123e25c9f..79be6e4a1eb1833385441e445e052c2e2276bd95 100644 (file)
@@ -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;
index f9adf2329427dae749b2789831159bcc1de76058..d6f71d5bd45ad03c21d1937ec76985abf16dc75b 100644 (file)
@@ -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;
        }
index 52ff6249120b10315d71384c88576f9ec37716f4..841aa76b8135f66bae4c373d219655cd5d2562e3 100644 (file)
@@ -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();
                }