mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
debug work.
git-svn-id: file:///svn/unbound/trunk@371 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
523c1bdb06
commit
aaec3572e4
11 changed files with 90 additions and 17 deletions
|
|
@ -215,9 +215,12 @@ static struct module_qstate*
|
||||||
find_run_in(struct module_qstate* p)
|
find_run_in(struct module_qstate* p)
|
||||||
{
|
{
|
||||||
struct module_qstate* q;
|
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) {
|
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)
|
if(p->ext_state[p->curmod] == module_state_initial)
|
||||||
return p;
|
return p;
|
||||||
|
log_nametypeclass("find run morepass", p->qinfo.qname, p->qinfo.qtype, p->qinfo.qclass);
|
||||||
if((q=find_run_in(p)))
|
if((q=find_run_in(p)))
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
@ -229,6 +232,7 @@ static struct module_qstate*
|
||||||
find_runnable(struct module_qstate* subq)
|
find_runnable(struct module_qstate* subq)
|
||||||
{
|
{
|
||||||
struct module_qstate* p = subq;
|
struct module_qstate* p = subq;
|
||||||
|
log_info("find runnable");
|
||||||
if(p->subquery_next && p->subquery_next->ext_state[
|
if(p->subquery_next && p->subquery_next->ext_state[
|
||||||
p->subquery_next->curmod] == module_state_initial)
|
p->subquery_next->curmod] == module_state_initial)
|
||||||
return p->subquery_next;
|
return p->subquery_next;
|
||||||
|
|
@ -256,6 +260,8 @@ worker_process_query(struct worker* worker, struct work_query* w,
|
||||||
region_free_all(worker->scratchpad);
|
region_free_all(worker->scratchpad);
|
||||||
qstate->reply = NULL;
|
qstate->reply = NULL;
|
||||||
s = qstate->ext_state[qstate->curmod];
|
s = qstate->ext_state[qstate->curmod];
|
||||||
|
log_info("worker_process_query: module exit state is %s",
|
||||||
|
strextstate(s));
|
||||||
/* examine results, start further modules, etc. */
|
/* examine results, start further modules, etc. */
|
||||||
if(s == module_wait_subquery) {
|
if(s == module_wait_subquery) {
|
||||||
if(!qstate->subquery_first) {
|
if(!qstate->subquery_first) {
|
||||||
|
|
@ -295,6 +301,7 @@ worker_process_query(struct worker* worker, struct work_query* w,
|
||||||
qstate = nxt;
|
qstate = nxt;
|
||||||
entry = NULL;
|
entry = NULL;
|
||||||
event = module_event_pass;
|
event = module_event_pass;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
- priming gives LAME result, returns SERVFAIL.
|
- priming gives LAME result, returns SERVFAIL.
|
||||||
- debug routine to print dns_msg as handled by iterator.
|
- debug routine to print dns_msg as handled by iterator.
|
||||||
- memleak in config file stubs fixup.
|
- memleak in config file stubs fixup.
|
||||||
|
- more small bugs, in scrubber, query compare no ID for lookup,
|
||||||
|
in dname validation for NS targets.
|
||||||
|
- sets entry.key for new special allocs.
|
||||||
|
- lognametypeclass can display unknown types and classes.
|
||||||
|
|
||||||
4 June 2007: Wouter
|
4 June 2007: Wouter
|
||||||
- random selection of equally preferred nameserver targets.
|
- random selection of equally preferred nameserver targets.
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct region* region,
|
||||||
for(i=0; i<nsdata->count; i++) {
|
for(i=0; i<nsdata->count; i++) {
|
||||||
if(nsdata->rr_len[i] < 2+1) continue; /* len + root label */
|
if(nsdata->rr_len[i] < 2+1) continue; /* len + root label */
|
||||||
if(dname_valid(nsdata->rr_data[i]+2, nsdata->rr_len[i]-2) !=
|
if(dname_valid(nsdata->rr_data[i]+2, nsdata->rr_len[i]-2) !=
|
||||||
(size_t)ldns_read_uint16(nsdata->rr_data[i])-2)
|
(size_t)ldns_read_uint16(nsdata->rr_data[i]))
|
||||||
continue; /* bad format */
|
continue; /* bad format */
|
||||||
/* add rdata of NS (= wirefmt dname), skip rdatalen bytes */
|
/* add rdata of NS (= wirefmt dname), skip rdatalen bytes */
|
||||||
if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2))
|
if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2))
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ response_type_from_server(struct dns_msg* msg, struct query_info* request,
|
||||||
/* If we are getting an NS set for the zone we
|
/* If we are getting an NS set for the zone we
|
||||||
* thought we were contacting, then it is an answer.*/
|
* thought we were contacting, then it is an answer.*/
|
||||||
/* FIXME: is this correct? */
|
/* FIXME: is this correct? */
|
||||||
if(query_dname_compare(s->rk.dname, origzone)) {
|
if(query_dname_compare(s->rk.dname, origzone) == 0) {
|
||||||
return RESPONSE_TYPE_ANSWER;
|
return RESPONSE_TYPE_ANSWER;
|
||||||
}
|
}
|
||||||
/* If we are getting a referral upwards (or to
|
/* If we are getting a referral upwards (or to
|
||||||
|
|
|
||||||
|
|
@ -277,20 +277,21 @@ synth_cname_rrset(uint8_t** sname, size_t* snamelen, uint8_t* alias,
|
||||||
static int
|
static int
|
||||||
pkt_strict_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr)
|
pkt_strict_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr)
|
||||||
{
|
{
|
||||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
uint8_t buf1[LDNS_MAX_DOMAINLEN+1];
|
||||||
/* decompress DNAME name */
|
uint8_t buf2[LDNS_MAX_DOMAINLEN+1];
|
||||||
dname_pkt_copy(pkt, buf, dr);
|
/* decompress names */
|
||||||
return dname_strict_subdomain_c(sname, buf);
|
dname_pkt_copy(pkt, buf1, sname);
|
||||||
|
dname_pkt_copy(pkt, buf2, dr);
|
||||||
|
return dname_strict_subdomain_c(buf1, buf2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** check subdomain with decompression */
|
/** check subdomain with decompression */
|
||||||
static int
|
static int
|
||||||
pkt_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr)
|
pkt_sub(ldns_buffer* pkt, uint8_t* comprname, uint8_t* zone)
|
||||||
{
|
{
|
||||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
||||||
/* decompress DNAME name */
|
dname_pkt_copy(pkt, buf, comprname);
|
||||||
dname_pkt_copy(pkt, buf, dr);
|
return dname_subdomain_c(buf, zone);
|
||||||
return dname_subdomain_c(sname, buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -452,6 +453,7 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg, uint8_t* zonename)
|
||||||
struct rrset_parse* rrset, *prev;
|
struct rrset_parse* rrset, *prev;
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
rrset = msg->rrset_first;
|
rrset = msg->rrset_first;
|
||||||
|
log_nametypeclass("sanitize for", zonename, 0, 0);
|
||||||
|
|
||||||
/* At this point, we brutally remove ALL rrsets that aren't
|
/* At this point, we brutally remove ALL rrsets that aren't
|
||||||
* children of the originating zone. The idea here is that,
|
* children of the originating zone. The idea here is that,
|
||||||
|
|
|
||||||
|
|
@ -247,15 +247,21 @@ iter_dns_store(struct module_env* env, struct dns_msg* msg, int is_referral)
|
||||||
/* store rrsets */
|
/* store rrsets */
|
||||||
struct rrset_ref ref;
|
struct rrset_ref ref;
|
||||||
uint32_t now = time(NULL);
|
uint32_t now = time(NULL);
|
||||||
size_t i;
|
size_t i, j;
|
||||||
reply_info_set_ttls(rep, now);
|
|
||||||
for(i=0; i<rep->rrset_count; i++) {
|
for(i=0; i<rep->rrset_count; i++) {
|
||||||
|
/* fixup rrset ttl */
|
||||||
|
struct packed_rrset_data* data = (struct
|
||||||
|
packed_rrset_data*)rep->rrsets[i]->entry.data;
|
||||||
|
data->ttl += now;
|
||||||
|
for(j=0; j<data->count + data->rrsig_count; j++)
|
||||||
|
data->rr_ttl[j] += now;
|
||||||
ref.key = rep->rrsets[i];
|
ref.key = rep->rrsets[i];
|
||||||
ref.id = rep->rrsets[i]->id;
|
ref.id = rep->rrsets[i]->id;
|
||||||
/*ignore ret: it was in the cache, ref updated */
|
/*ignore ret: it was in the cache, ref updated */
|
||||||
(void)rrset_cache_update(env->rrset_cache, &ref,
|
(void)rrset_cache_update(env->rrset_cache, &ref,
|
||||||
env->alloc, now);
|
env->alloc, now);
|
||||||
}
|
}
|
||||||
|
free(rep);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
/* store msg, and rrsets */
|
/* store msg, and rrsets */
|
||||||
|
|
|
||||||
|
|
@ -870,6 +870,8 @@ generate_target_query(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
free(subq);
|
free(subq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
log_nametypeclass("new target", name, qtype, qclass);
|
||||||
|
delegpt_log(subiq->dp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1141,6 +1143,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
iq->dp = delegpt_from_message(iq->response, qstate->region);
|
iq->dp = delegpt_from_message(iq->response, qstate->region);
|
||||||
if(!iq->dp)
|
if(!iq->dp)
|
||||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||||
|
delegpt_log(iq->dp);
|
||||||
iq->num_current_queries = 0;
|
iq->num_current_queries = 0;
|
||||||
iq->num_target_queries = -1;
|
iq->num_target_queries = -1;
|
||||||
/* Count this as a referral. */
|
/* Count this as a referral. */
|
||||||
|
|
@ -1258,6 +1261,7 @@ processPrimeResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||||
|
|
||||||
log_nametypeclass("priming successful for", qstate->qinfo.qname,
|
log_nametypeclass("priming successful for", qstate->qinfo.qname,
|
||||||
qstate->qinfo.qtype, qstate->qinfo.qclass);
|
qstate->qinfo.qtype, qstate->qinfo.qclass);
|
||||||
|
delegpt_log(dp);
|
||||||
foriq = (struct iter_qstate*)forq->minfo[id];
|
foriq = (struct iter_qstate*)forq->minfo[id];
|
||||||
foriq->dp = dp;
|
foriq->dp = dp;
|
||||||
foriq->response = dns_copy_msg(iq->response, forq->region);
|
foriq->response = dns_copy_msg(iq->response, forq->region);
|
||||||
|
|
|
||||||
|
|
@ -361,6 +361,42 @@ dname_test_dname_lab_cmp()
|
||||||
unit_assert(ml == 4);
|
unit_assert(ml == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** test dname_subdomain_c */
|
||||||
|
static void
|
||||||
|
dname_test_subdomain()
|
||||||
|
{
|
||||||
|
unit_assert(dname_subdomain_c(
|
||||||
|
(uint8_t*)"",
|
||||||
|
(uint8_t*)""));
|
||||||
|
unit_assert(dname_subdomain_c(
|
||||||
|
(uint8_t*)"\003com",
|
||||||
|
(uint8_t*)""));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"",
|
||||||
|
(uint8_t*)"\003com"));
|
||||||
|
unit_assert(dname_subdomain_c(
|
||||||
|
(uint8_t*)"\007example\003com",
|
||||||
|
(uint8_t*)"\003com"));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"\003com",
|
||||||
|
(uint8_t*)"\007example\003com"));
|
||||||
|
unit_assert(dname_subdomain_c(
|
||||||
|
(uint8_t*)"\007example\003com",
|
||||||
|
(uint8_t*)""));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"\003net",
|
||||||
|
(uint8_t*)"\003com"));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"\003net",
|
||||||
|
(uint8_t*)"\003org"));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"\007example\003net",
|
||||||
|
(uint8_t*)"\003org"));
|
||||||
|
unit_assert(!dname_subdomain_c(
|
||||||
|
(uint8_t*)"\003net",
|
||||||
|
(uint8_t*)"\007example\003org"));
|
||||||
|
}
|
||||||
|
|
||||||
/** test dname_strict_subdomain */
|
/** test dname_strict_subdomain */
|
||||||
static void
|
static void
|
||||||
dname_test_strict_subdomain()
|
dname_test_strict_subdomain()
|
||||||
|
|
@ -409,5 +445,6 @@ void dname_test()
|
||||||
dname_test_dname_lab_cmp();
|
dname_test_dname_lab_cmp();
|
||||||
dname_test_pkt_dname_len(buff);
|
dname_test_pkt_dname_len(buff);
|
||||||
dname_test_strict_subdomain();
|
dname_test_strict_subdomain();
|
||||||
|
dname_test_subdomain();
|
||||||
ldns_buffer_free(buff);
|
ldns_buffer_free(buff);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ alloc_setup_special(alloc_special_t* t)
|
||||||
{
|
{
|
||||||
memset(t, 0, sizeof(*t));
|
memset(t, 0, sizeof(*t));
|
||||||
lock_rw_init(&t->entry.lock);
|
lock_rw_init(&t->entry.lock);
|
||||||
|
t->entry.key = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** prealloc some entries in the cache. To minimize contention.
|
/** prealloc some entries in the cache. To minimize contention.
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ ub_rrset_compare(void* k1, void* k2)
|
||||||
struct ub_packed_rrset_key* key1 = (struct ub_packed_rrset_key*)k1;
|
struct ub_packed_rrset_key* key1 = (struct ub_packed_rrset_key*)k1;
|
||||||
struct ub_packed_rrset_key* key2 = (struct ub_packed_rrset_key*)k2;
|
struct ub_packed_rrset_key* key2 = (struct ub_packed_rrset_key*)k2;
|
||||||
int c;
|
int c;
|
||||||
if(key1 == key2 || key1->id == key2->id)
|
if(key1 == key2)
|
||||||
return 0;
|
return 0;
|
||||||
if(key1->rk.type != key2->rk.type) {
|
if(key1->rk.type != key2->rk.type) {
|
||||||
if(key1->rk.type < key2->rk.type)
|
if(key1->rk.type < key2->rk.type)
|
||||||
|
|
|
||||||
|
|
@ -183,11 +183,23 @@ log_nametypeclass(const char* str, uint8_t* name, uint16_t type,
|
||||||
uint16_t dclass)
|
uint16_t dclass)
|
||||||
{
|
{
|
||||||
char buf[LDNS_MAX_DOMAINLEN+1];
|
char buf[LDNS_MAX_DOMAINLEN+1];
|
||||||
|
char t[12], c[12];
|
||||||
|
const char *ts, *cs;
|
||||||
dname_str(name, buf);
|
dname_str(name, buf);
|
||||||
log_info("%s <%s %s %s>", str, buf,
|
if(ldns_rr_descript(type) && ldns_rr_descript(type)->_name)
|
||||||
ldns_rr_descript(type)?ldns_rr_descript(type)->_name: "??",
|
ts = ldns_rr_descript(type)->_name;
|
||||||
ldns_lookup_by_id(ldns_rr_classes, (int)dclass)?
|
else {
|
||||||
ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name:"??");
|
snprintf(t, 12, "TYPE%d", (int)type);
|
||||||
|
ts = t;
|
||||||
|
}
|
||||||
|
if(ldns_lookup_by_id(ldns_rr_classes, (int)dclass) &&
|
||||||
|
ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name)
|
||||||
|
cs = ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name;
|
||||||
|
else {
|
||||||
|
snprintf(c, 12, "CLASS%d", (int)dclass);
|
||||||
|
cs = c;
|
||||||
|
}
|
||||||
|
log_info("%s <%s %s %s>", str, buf, ts, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue