From: Wouter Wijngaards Date: Mon, 12 Jan 2009 09:22:39 +0000 (+0000) Subject: lameness debugging. X-Git-Tag: release-1.2.1~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f4a9249c67f3b9093c4958ea28ba51b881338f5;p=thirdparty%2Funbound.git lameness debugging. fix for lameness hashing. git-svn-id: file:///svn/unbound/trunk@1425 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index db14cd175..bda323cd1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,8 @@ +12 January 2009: Wouter + - fixed bug in infrastructure lameness cache, did not lowercase + name of zone to hash when setting lame. + - lameness debugging printouts. + 9 January 2009: Wouter - created svn tag for 1.2.0 release. - svn trunk contains 1.2.1 version number. diff --git a/iterator/iterator.c b/iterator/iterator.c index 77d5004fb..ec7d6cb29 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1530,6 +1530,24 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, verbose(VERB_DETAIL, "query response was %sLAME", dnsseclame?"DNSSEC ":""); if(qstate->reply) { + /* @@@ DEBUG LAME @@@ */ + if(1) { + log_info("LAME mark. %s time %d", + dnsseclame?"dnsseclame":"lame", + (int)*qstate->env->now); + log_addr(0, "addr", &qstate->reply->addr, + qstate->reply->addrlen); + log_nametypeclass(0, "delegpt", iq->dp->name, + iq->qchase.qtype, iq->qchase.qclass); + log_dns_msg("from msg", &iq->response->qinfo, + iq->response->rep); + if(qstate->reply && qstate->reply->c && + qstate->reply->c->buffer) + log_hex("hex packet", + ldns_buffer_begin(qstate->reply->c-> + buffer), ldns_buffer_limit(qstate-> + reply->c->buffer)); + } /* need addr for lameness cache, but we may have * gotten this from cache, so test to be sure */ if(!infra_set_lame(qstate->env->infra_cache, @@ -1545,6 +1563,23 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, verbose(VERB_DETAIL, "query response REC_LAME: " "recursive but not authoritative server"); if(qstate->reply) { + /* @@@ DEBUG LAME @@@ */ + if(1) { + log_info("REC_LAME mark. rec_lame time %d", + (int)*qstate->env->now); + log_addr(0, "addr", &qstate->reply->addr, + qstate->reply->addrlen); + log_nametypeclass(0, "delegpt", iq->dp->name, + iq->qchase.qtype, iq->qchase.qclass); + log_dns_msg("from msg", &iq->response->qinfo, + iq->response->rep); + if(qstate->reply && qstate->reply->c && + qstate->reply->c->buffer) + log_hex("hex packet", + ldns_buffer_begin(qstate->reply->c-> + buffer), ldns_buffer_limit(qstate-> + reply->c->buffer)); + } /* need addr for lameness cache, but we may have * gotten this from cache, so test to be sure */ verbose(VERB_DETAIL, "mark as REC_LAME"); diff --git a/services/cache/infra.c b/services/cache/infra.c index 75a39bc75..eeaaa7928 100644 --- a/services/cache/infra.c +++ b/services/cache/infra.c @@ -268,9 +268,9 @@ infra_host(struct infra_cache* infra, struct sockaddr_storage* addr, /** hash lameness key */ static hashvalue_t -hash_lameness(uint8_t* name, size_t namelen) +hash_lameness(uint8_t* name) { - return hashlittle(name, namelen, 0xab); + return dname_query_hash(name, 0xab); } int @@ -283,7 +283,7 @@ infra_lookup_lame(struct infra_host_data* host, struct infra_lame_data *d; if(!host->lameness) return 0; - k.entry.hash = hash_lameness(name, namelen); + k.entry.hash = hash_lameness(name); k.zonename = name; k.namelen = namelen; k.entry.key = (void*)&k; @@ -300,6 +300,15 @@ infra_lookup_lame(struct infra_host_data* host, *rlame = d->rec_lame; *alame = d->lame_type_A; *olame = d->lame_other; + if(*dlame || *rlame || *alame || *olame) { + /* @@@ DEBUG LAME @@@ */ + log_info("infra_lookup_lame: looked up LAME d%d r%d a%d o%d", + *dlame, *rlame, *alame, *olame); + log_nametypeclass(0, "search", name, 0, 0); + log_nametypeclass(0, "found", + ((struct infra_lame_key*)e->key)->zonename, 0, 0); + } + lock_rw_unlock(&e->lock); return *dlame || *rlame || *alame || *olame; } @@ -375,7 +384,7 @@ infra_set_lame(struct infra_cache* infra, return 0; } lock_rw_init(&k->entry.lock); - k->entry.hash = hash_lameness(name, namelen); + k->entry.hash = hash_lameness(name); k->entry.key = (void*)k; k->entry.data = (void*)d; d->ttl = timenow + infra->lame_ttl; @@ -419,6 +428,8 @@ infra_set_lame(struct infra_cache* infra, int dlame, rlame, alame, olame; if(infra_lookup_lame(data, name, namelen, timenow, &dlame, &rlame, &alame, &olame)) { + /* @@@ DEBUG LAME ***/ + log_info("lookup_lame merge in set_lame"); /* merge data into new structure */ if(dlame) d->isdnsseclame = 1; if(rlame) d->rec_lame = 1; @@ -526,6 +537,13 @@ infra_get_lame_rtt(struct infra_cache* infra, /* check lameness first, if so, ttl on host does not matter anymore */ if(infra_lookup_lame(host, name, namelen, timenow, &dlm, &rlm, &alm, &olm)) { + /* @@@ DEBUG LAME @@@ */ + log_info("lookup_lame in get_lame_rtt type %d", qtype); + log_addr(0, "for addr", addr, addrlen); + log_addr(0, "found addr", + &((struct infra_host_key*)e->key)->addr, + ((struct infra_host_key*)e->key)->addrlen); + if(alm && qtype == LDNS_RR_TYPE_A) { lock_rw_unlock(&e->lock); *lame = 1;