From a11cc0c530f68843b2f79314e24d0e238682bcb2 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 7 Jun 2007 10:38:02 +0000 Subject: [PATCH] Fixup cname target name readout. git-svn-id: file:///svn/unbound/trunk@373 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/worker.c | 24 +++++++++++++++++++++--- doc/Changelog | 4 +++- iterator/iter_resptype.c | 2 ++ services/outside_network.c | 5 ++++- util/data/packed_rrset.c | 1 - 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/daemon/worker.c b/daemon/worker.c index e1abbe519..de30e0daa 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -210,17 +210,33 @@ set_extstates_initial(struct worker* worker, struct module_qstate* qstate) qstate->ext_state[i] = module_state_initial; } +/** recursive debug logging of (sub)query structure */ +static void +run_debug(struct module_qstate* p, int d) +{ + char buf[80+1+1]; /* max nn=80; marker is 1, zero at end is 1 */ + int i, nn = d*2; + if(nn > 80) + nn = 80; + for(i=0; iqinfo.qname, p->qinfo.qtype, p->qinfo.qclass); + for(p = p->subquery_first; p; p = p->subquery_next) { + run_debug(p, d+1); + } +} + /** find runnable recursive */ static struct module_qstate* find_run_in(struct module_qstate* p) { struct module_qstate* q; - log_nametypeclass("find run in", p->qinfo.qname, p->qinfo.qtype, p->qinfo.qclass); for(p = p->subquery_first; p; p = p->subquery_next) { - log_nametypeclass("find run passed", p->qinfo.qname, p->qinfo.qtype, p->qinfo.qclass); if(p->ext_state[p->curmod] == module_state_initial) return p; - log_nametypeclass("find run morepass", p->qinfo.qname, p->qinfo.qtype, p->qinfo.qclass); if((q=find_run_in(p))) return q; } @@ -238,6 +254,8 @@ find_runnable(struct module_qstate* subq) return p->subquery_next; while(p->parent) p = p->parent; + if(verbosity >= VERB_ALGO) + run_debug(p, 0); return find_run_in(p); } diff --git a/doc/Changelog b/doc/Changelog index 2e8221b5c..4a4acf9d1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,7 +1,9 @@ 7 June 2007: Wouter - fixup error in double linked list insertion for subqueries and for outbound list of serviced queries for iterator module. - - nicer printout of outgoing port selection. + - nicer printout of outgoing port selection. + - fixup cname target readout. + - nicer debug output. 5 June 2007: Wouter - iterator state finished. diff --git a/iterator/iter_resptype.c b/iterator/iter_resptype.c index fc2d7031b..a5c15850b 100644 --- a/iterator/iter_resptype.c +++ b/iterator/iter_resptype.c @@ -159,7 +159,9 @@ response_type_from_server(struct dns_msg* msg, struct query_info* request, * it is relevant. */ if(ntohs(s->rk.type) == LDNS_RR_TYPE_CNAME && query_dname_compare(mname, s->rk.dname) == 0) { + log_nametypeclass("following CNAME from", mname, LDNS_RR_TYPE_CNAME, request->qclass); get_cname_target(s, &mname, &mname_len); + log_nametypeclass("following CNAME to", mname, request->qtype, request->qclass); } } /* if we encountered a CNAME (or a bunch of CNAMEs), and diff --git a/services/outside_network.c b/services/outside_network.c index 0c65f41e1..8a02c4cd7 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -285,12 +285,15 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error, memcpy(&key.addr, &reply_info->addr, reply_info->addrlen); key.addrlen = reply_info->addrlen; verbose(VERB_ALGO, "Incoming reply id=%4.4x addr=", key.id); + if(verbosity >= VERB_ALGO) { + log_addr("Incoming reply addr=", &reply_info->addr, reply_info->addrlen); + } /* find it, see if this thing is a valid query response */ verbose(VERB_ALGO, "lookup size is %d entries", (int)outnet->pending->count); p = (struct pending*)rbtree_search(outnet->pending, &key); if(!p) { - verbose(VERB_DETAIL, "received unsolicited udp reply. dropped."); + verbose(VERB_DETAIL, "received unwanted or unsolicited udp reply dropped."); return 0; } diff --git a/util/data/packed_rrset.c b/util/data/packed_rrset.c index dc1099b30..3d8a45cbb 100644 --- a/util/data/packed_rrset.c +++ b/util/data/packed_rrset.c @@ -207,7 +207,6 @@ get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname, len = ldns_read_uint16(d->rr_data[0]); if(len != d->rr_len[0] - sizeof(uint16_t)) return; - len -= sizeof(uint16_t); if(dname_valid(d->rr_data[0]+sizeof(uint16_t), len) != len) return; *dname = d->rr_data[0]+sizeof(uint16_t); -- 2.47.2