]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/zonecut: verbose output tweaks
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 1 Nov 2018 10:24:50 +0000 (11:24 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Fri, 2 Nov 2018 15:21:31 +0000 (16:21 +0100)
lib/zonecut.c

index 774c58dd79389e8b95bc7e825c1203f6a2781407..d0abe9daa0ca70f4c786fd5c8ff8013ae26fa3e2 100644 (file)
@@ -333,6 +333,7 @@ static addrset_info_t fetch_addr(pack_t *addrs, const knot_dname_t *ns, uint16_t
                                  kr_memreserve, mm_pool);
        if (ret) abort(); /* ENOMEM "probably" */
 
+       int usable_cnt = 0;
        addrset_info_t result = AI_EMPTY;
        knot_rdata_t *rd = cached_rr.rrs.rdata;
        for (uint16_t i = 0; i < cached_rr.rrs.count; ++i, rd = knot_rdataset_next(rd)) {
@@ -350,6 +351,7 @@ static addrset_info_t fetch_addr(pack_t *addrs, const knot_dname_t *ns, uint16_t
                           < rtt_e->tout_timestamp + ctx->cache_rtt_tout_retry_interval;
                if (!unusable) {
                        result = AI_OK;
+                       ++usable_cnt;
                }
 
                ret = pack_obj_push(addrs, rd->data, rd->len);
@@ -363,6 +365,10 @@ static addrset_info_t fetch_addr(pack_t *addrs, const knot_dname_t *ns, uint16_t
                 * Overall there's some overlap with nsrep.c functionality.
                 */
        }
+       if (usable_cnt != cached_rr.rrs.count) {
+               VERBOSE_MSG(qry, "usable NS addresses: %d/%d\n",
+                               usable_cnt, cached_rr.rrs.count);
+       }
        return result;
 }
 
@@ -423,7 +429,14 @@ static int fetch_ns(struct kr_context *ctx, struct kr_zonecut *cut,
                        ? AI_REPUT
                        : fetch_addr(*pack, ns_name, KNOT_RRTYPE_AAAA, cut->pool, qry);
 
-               /* FIXME: deep, perhaps separate into a function (break -> return). */
+               #if 0 /* rather unlikely to be useful unless changing some zcut code */
+               WITH_VERBOSE(qry) {
+                       auto_free char *ns_name_txt = kr_dname_text(ns_name);
+                       VERBOSE_MSG(qry, "NS %s infos: %d, %d\n",
+                                       ns_name_txt, (int)infos[0], (int)infos[1]);
+               }
+               #endif
+
                /* AI_CYCLED checks.
                 * If an ancestor query has its zone cut in the state that
                 * it's looking for name or address(es) of some NS(s),