mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-29 19:09:36 -05:00
fix bug
git-svn-id: file:///svn/unbound/trunk@1426 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
9f4a9249c6
commit
0a9116f856
3 changed files with 39 additions and 55 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
13 January 2009: Wouter
|
||||||
|
- fixed bug in lameness marking, removed printouts.
|
||||||
|
|
||||||
12 January 2009: Wouter
|
12 January 2009: Wouter
|
||||||
- fixed bug in infrastructure lameness cache, did not lowercase
|
- fixed bug in infrastructure lameness cache, did not lowercase
|
||||||
name of zone to hash when setting lame.
|
name of zone to hash when setting lame.
|
||||||
|
|
|
||||||
|
|
@ -840,6 +840,8 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
iq->qchase.qname_len = slen;
|
iq->qchase.qname_len = slen;
|
||||||
/* This *is* a query restart, even if it is a cheap
|
/* This *is* a query restart, even if it is a cheap
|
||||||
* one. */
|
* one. */
|
||||||
|
iq->dp = NULL;
|
||||||
|
iq->refetch_glue = 0;
|
||||||
iq->query_restart_count++;
|
iq->query_restart_count++;
|
||||||
return next_state(iq, INIT_REQUEST_STATE);
|
return next_state(iq, INIT_REQUEST_STATE);
|
||||||
}
|
}
|
||||||
|
|
@ -857,6 +859,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
log_err("alloc failure for forward dp");
|
log_err("alloc failure for forward dp");
|
||||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||||
}
|
}
|
||||||
|
iq->refetch_glue = 0;
|
||||||
/* the request has been forwarded.
|
/* the request has been forwarded.
|
||||||
* forwarded requests need to be immediately sent to the
|
* forwarded requests need to be immediately sent to the
|
||||||
* next state, QUERYTARGETS. */
|
* next state, QUERYTARGETS. */
|
||||||
|
|
@ -1351,6 +1354,19 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** find NS rrset in given list */
|
||||||
|
static struct ub_packed_rrset_key*
|
||||||
|
find_NS(struct reply_info* rep, size_t from, size_t to)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for(i=from; i<to; i++) {
|
||||||
|
if(ntohs(rep->rrsets[i]->rk.type) == LDNS_RR_TYPE_NS)
|
||||||
|
return rep->rrsets[i];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the query response. All queries end up at this state first. This
|
* Process the query response. All queries end up at this state first. This
|
||||||
* process generally consists of analyzing the response and routing the
|
* process generally consists of analyzing the response and routing the
|
||||||
|
|
@ -1402,6 +1418,18 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
dnsseclame = 1;
|
dnsseclame = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* see if referral brings us close to the target */
|
||||||
|
if(type == RESPONSE_TYPE_REFERRAL) {
|
||||||
|
struct ub_packed_rrset_key* ns = find_NS(
|
||||||
|
iq->response->rep, iq->response->rep->an_numrrsets,
|
||||||
|
iq->response->rep->an_numrrsets
|
||||||
|
+ iq->response->rep->ns_numrrsets);
|
||||||
|
if(!ns || !dname_strict_subdomain_c(ns->rk.dname, iq->dp->name)
|
||||||
|
|| !dname_subdomain_c(iq->qchase.qname, ns->rk.dname)){
|
||||||
|
verbose(VERB_ALGO, "bad referral, throwaway");
|
||||||
|
type = RESPONSE_TYPE_THROWAWAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* handle each of the type cases */
|
/* handle each of the type cases */
|
||||||
if(type == RESPONSE_TYPE_ANSWER) {
|
if(type == RESPONSE_TYPE_ANSWER) {
|
||||||
|
|
@ -1529,25 +1557,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
/* Cache the LAMEness. */
|
/* Cache the LAMEness. */
|
||||||
verbose(VERB_DETAIL, "query response was %sLAME",
|
verbose(VERB_DETAIL, "query response was %sLAME",
|
||||||
dnsseclame?"DNSSEC ":"");
|
dnsseclame?"DNSSEC ":"");
|
||||||
if(qstate->reply) {
|
if(!dname_subdomain_c(iq->qchase.qname, iq->dp->name)) {
|
||||||
/* @@@ DEBUG LAME @@@ */
|
log_err("mark lame: mismatch in qname and dpname");
|
||||||
if(1) {
|
/* throwaway this reply below */
|
||||||
log_info("LAME mark. %s time %d",
|
} else if(qstate->reply) {
|
||||||
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
|
/* need addr for lameness cache, but we may have
|
||||||
* gotten this from cache, so test to be sure */
|
* gotten this from cache, so test to be sure */
|
||||||
if(!infra_set_lame(qstate->env->infra_cache,
|
if(!infra_set_lame(qstate->env->infra_cache,
|
||||||
|
|
@ -1562,24 +1575,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
/* Cache the LAMEness. */
|
/* Cache the LAMEness. */
|
||||||
verbose(VERB_DETAIL, "query response REC_LAME: "
|
verbose(VERB_DETAIL, "query response REC_LAME: "
|
||||||
"recursive but not authoritative server");
|
"recursive but not authoritative server");
|
||||||
if(qstate->reply) {
|
if(!dname_subdomain_c(iq->qchase.qname, iq->dp->name)) {
|
||||||
/* @@@ DEBUG LAME @@@ */
|
log_err("mark rec_lame: mismatch in qname and dpname");
|
||||||
if(1) {
|
/* throwaway this reply below */
|
||||||
log_info("REC_LAME mark. rec_lame time %d",
|
} else if(qstate->reply) {
|
||||||
(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
|
/* need addr for lameness cache, but we may have
|
||||||
* gotten this from cache, so test to be sure */
|
* gotten this from cache, so test to be sure */
|
||||||
verbose(VERB_DETAIL, "mark as REC_LAME");
|
verbose(VERB_DETAIL, "mark as REC_LAME");
|
||||||
|
|
|
||||||
18
services/cache/infra.c
vendored
18
services/cache/infra.c
vendored
|
|
@ -300,15 +300,6 @@ infra_lookup_lame(struct infra_host_data* host,
|
||||||
*rlame = d->rec_lame;
|
*rlame = d->rec_lame;
|
||||||
*alame = d->lame_type_A;
|
*alame = d->lame_type_A;
|
||||||
*olame = d->lame_other;
|
*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);
|
lock_rw_unlock(&e->lock);
|
||||||
return *dlame || *rlame || *alame || *olame;
|
return *dlame || *rlame || *alame || *olame;
|
||||||
}
|
}
|
||||||
|
|
@ -428,8 +419,6 @@ infra_set_lame(struct infra_cache* infra,
|
||||||
int dlame, rlame, alame, olame;
|
int dlame, rlame, alame, olame;
|
||||||
if(infra_lookup_lame(data, name, namelen, timenow,
|
if(infra_lookup_lame(data, name, namelen, timenow,
|
||||||
&dlame, &rlame, &alame, &olame)) {
|
&dlame, &rlame, &alame, &olame)) {
|
||||||
/* @@@ DEBUG LAME ***/
|
|
||||||
log_info("lookup_lame merge in set_lame");
|
|
||||||
/* merge data into new structure */
|
/* merge data into new structure */
|
||||||
if(dlame) d->isdnsseclame = 1;
|
if(dlame) d->isdnsseclame = 1;
|
||||||
if(rlame) d->rec_lame = 1;
|
if(rlame) d->rec_lame = 1;
|
||||||
|
|
@ -537,13 +526,6 @@ infra_get_lame_rtt(struct infra_cache* infra,
|
||||||
/* check lameness first, if so, ttl on host does not matter anymore */
|
/* check lameness first, if so, ttl on host does not matter anymore */
|
||||||
if(infra_lookup_lame(host, name, namelen, timenow,
|
if(infra_lookup_lame(host, name, namelen, timenow,
|
||||||
&dlm, &rlm, &alm, &olm)) {
|
&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) {
|
if(alm && qtype == LDNS_RR_TYPE_A) {
|
||||||
lock_rw_unlock(&e->lock);
|
lock_rw_unlock(&e->lock);
|
||||||
*lame = 1;
|
*lame = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue