]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
rrcache verbose: print rank information
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 7 Apr 2017 13:40:50 +0000 (15:40 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 7 Apr 2017 13:40:50 +0000 (15:40 +0200)
lib/layer/rrcache.c

index ebc11ac3d6c92db6eb30a3d33f6d1cae88856d37..c5a12a453eac4d171e0ec494e70581ca8739bd15 100644 (file)
@@ -75,6 +75,8 @@ static int loot_rr(struct kr_cache *cache, knot_pkt_t *pkt, const knot_dname_t *
                return ret;
        }
 
+       VERBOSE_MSG(qry, "=> rank: 0%0.2o, lowest 0%0.2o\n", *rank, lowest_rank);
+
        if (*rank < lowest_rank) {
                return kr_error(ENOENT);
        }
@@ -274,11 +276,16 @@ static int commit_rr(const char *key, void *val, void *data)
                /* If equal rank was accepted, spoofing a single answer would be enough
                 * to e.g. override NS record in AUTHORITY section.
                 * This way they would have to hit the first answer (whenever TTL expires). */
-               if (cached_rank >= rank) {
-                       return kr_ok();
+               if (cached_rank >= 0) {
+                       VERBOSE_MSG(baton->qry, "=> orig. rank: 0%0.2o\n", cached_rank);
+                       if (cached_rank >= rank) {
+                               return kr_ok();
+                       }
                }
        }
 
+       VERBOSE_MSG(baton->qry, "=> stashing rank: 0%0.2o\n", rank);
+
        uint8_t flags = KR_CACHE_FLAG_NONE;
        if (kr_rank_test(rank, KR_RANK_AUTH)) {
                if (baton->qry->flags & QUERY_DNSSEC_WEXPAND) {