]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
report RTT
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 14 Aug 2009 08:35:46 +0000 (08:35 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 14 Aug 2009 08:35:46 +0000 (08:35 +0000)
git-svn-id: file:///svn/unbound/trunk@1761 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/cachedump.c
doc/Changelog
validator/autotrust.c

index 045353521e706fbddce4251f7fb60d9afbb17b19..01db2f933c3fd486c2e6b548a6c9257b7b1b197b 100644 (file)
@@ -45,6 +45,7 @@
 #include "daemon/worker.h"
 #include "services/cache/rrset.h"
 #include "services/cache/dns.h"
+#include "services/cache/infra.h"
 #include "util/data/msgreply.h"
 #include "util/regional.h"
 #include "util/net_help.h"
@@ -779,6 +780,54 @@ load_cache(SSL* ssl, struct worker* worker)
        return read_fixed(ssl, worker->env.scratch_buffer, "EOF");
 }
 
+/** print details on a delegation point */
+static void
+print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
+{
+       char buf[257];
+       struct delegpt_addr* a;
+       int lame, dlame, rlame, rtt, edns_vs, to;
+       uint8_t edns_lame_known;
+       for(a = dp->target_list; a; a = a->next_target) {
+               addr_to_str(&a->addr, a->addrlen, buf, sizeof(buf));
+               if(!ssl_printf(ssl, "%-16s\t", buf))
+                       return;
+               if(a->bogus) {
+                       if(!ssl_printf(ssl, "Address is BOGUS. ")) 
+                               return;
+               }
+               /* lookup in infra cache */
+               /* uses type_A because most often looked up, but other
+                * lameness won't be reported then */
+               if(!infra_get_lame_rtt(worker->env.infra_cache, 
+                       &a->addr, a->addrlen, dp->name, dp->namelen,
+                       LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rtt, 
+                       *worker->env.now)) {
+                       if(!ssl_printf(ssl, "not in infra cache.\n"))
+                               return;
+                       continue; /* skip stuff not in infra cache */
+               }
+               if(!ssl_printf(ssl, "%s%s%srtt %d msec. ",
+                       lame?"LAME ":"", dlame?"NoDNSSEC ":"",
+                       rlame?"NoAuthButRecursive ":"", rtt))
+                       return;
+               if(infra_host(worker->env.infra_cache, &a->addr, a->addrlen,
+                       *worker->env.now, &edns_vs, &edns_lame_known, &to)) {
+                       if(edns_vs == -1) {
+                               if(!ssl_printf(ssl, "noEDNS%s.",
+                                       edns_lame_known?" probed":""))
+                                       return;
+                       } else {
+                               if(!ssl_printf(ssl, "EDNS %d%s.",
+                                       edns_vs, edns_lame_known?" probed":""))
+                                       return;
+                       }
+               }
+               if(!ssl_printf(ssl, "\n"))
+                       return;
+       }
+}
+
 int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
        size_t nmlen, int ATTR_UNUSED(nmlabs))
 {
@@ -824,11 +873,13 @@ int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
                delegpt_count_addr(dp, &n_addr, &n_res, &n_avail);
                /* since dp has not been used by iterator, all are available*/
                if(!ssl_printf(ssl, "Delegation with %d names, of which %d "
-                       "have no addresses in cache.\n"
-                       "It provides %d IP addresses. %s\n", 
-                       (int)n_ns, (int)n_miss, (int)n_addr, 
-                       (dp->bogus?"It is BOGUS":"") ))
+                       "can be examined to query further addresses.\n"
+                       "%sIt provides %d IP addresses.\n", 
+                       (int)n_ns, (int)n_miss, (dp->bogus?"It is BOGUS. ":""),
+                       (int)n_addr))
                        return 0;
+               /* print more dp info */
+               print_dp_details(ssl, worker, dp);
                /* go up? */
                if(iter_dp_is_useless(&qinfo, BIT_RD, dp)) {
                        if(!ssl_printf(ssl, "cache delegation was "
index 793e530c90f95592254f3cd1e1ee09666b29eb94..f160b348d46ba3aabd96c553e8bcce54707b9f66 100644 (file)
@@ -1,3 +1,6 @@
+14 August 2009: Wouter
+       - unbound-control lookup prints out infra cache information, like RTT.
+
 13 August 2009: Wouter
        - autotrust read anchor files. locked trust anchors.
 
index 4cd4633337a4ead35ca613879fafeaf4ae91efdb..fc2dc3431b19046ee01985147f0413a4d65071bb 100644 (file)
@@ -331,7 +331,7 @@ find_add_tp(struct val_anchors* anchors, ldns_rr* rr)
        return tp;
 }
 
-/** Add trust anchor from RR. */
+/** Add trust anchor from RR */
 static struct autr_ta*
 add_trustanchor_frm_rr(struct val_anchors* anchors, ldns_rr* rr, 
        struct trust_anchor** tp)