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;
}
find_runnable(struct module_qstate* subq)
{
struct module_qstate* p = subq;
+ log_info("find runnable");
if(p->subquery_next && p->subquery_next->ext_state[
p->subquery_next->curmod] == module_state_initial)
return p->subquery_next;
region_free_all(worker->scratchpad);
qstate->reply = NULL;
s = qstate->ext_state[qstate->curmod];
+ log_info("worker_process_query: module exit state is %s",
+ strextstate(s));
/* examine results, start further modules, etc. */
if(s == module_wait_subquery) {
if(!qstate->subquery_first) {
qstate = nxt;
entry = NULL;
event = module_event_pass;
+ continue;
}
}
break;
- priming gives LAME result, returns SERVFAIL.
- debug routine to print dns_msg as handled by iterator.
- 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
- random selection of equally preferred nameserver targets.
for(i=0; i<nsdata->count; i++) {
if(nsdata->rr_len[i] < 2+1) continue; /* len + root label */
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 */
/* add rdata of NS (= wirefmt dname), skip rdatalen bytes */
if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2))
/* If we are getting an NS set for the zone we
* thought we were contacting, then it is an answer.*/
/* 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;
}
/* If we are getting a referral upwards (or to
static int
pkt_strict_sub(ldns_buffer* pkt, uint8_t* sname, uint8_t* dr)
{
- uint8_t buf[LDNS_MAX_DOMAINLEN+1];
- /* decompress DNAME name */
- dname_pkt_copy(pkt, buf, dr);
- return dname_strict_subdomain_c(sname, buf);
+ uint8_t buf1[LDNS_MAX_DOMAINLEN+1];
+ uint8_t buf2[LDNS_MAX_DOMAINLEN+1];
+ /* decompress names */
+ dname_pkt_copy(pkt, buf1, sname);
+ dname_pkt_copy(pkt, buf2, dr);
+ return dname_strict_subdomain_c(buf1, buf2);
}
/** check subdomain with decompression */
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];
- /* decompress DNAME name */
- dname_pkt_copy(pkt, buf, dr);
- return dname_subdomain_c(sname, buf);
+ dname_pkt_copy(pkt, buf, comprname);
+ return dname_subdomain_c(buf, zone);
}
/**
struct rrset_parse* rrset, *prev;
prev = NULL;
rrset = msg->rrset_first;
+ log_nametypeclass("sanitize for", zonename, 0, 0);
/* At this point, we brutally remove ALL rrsets that aren't
* children of the originating zone. The idea here is that,
/* store rrsets */
struct rrset_ref ref;
uint32_t now = time(NULL);
- size_t i;
- reply_info_set_ttls(rep, now);
+ size_t i, j;
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.id = rep->rrsets[i]->id;
/*ignore ret: it was in the cache, ref updated */
(void)rrset_cache_update(env->rrset_cache, &ref,
env->alloc, now);
}
+ free(rep);
return 1;
} else {
/* store msg, and rrsets */
free(subq);
return 0;
}
+ log_nametypeclass("new target", name, qtype, qclass);
+ delegpt_log(subiq->dp);
return 1;
}
iq->dp = delegpt_from_message(iq->response, qstate->region);
if(!iq->dp)
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
+ delegpt_log(iq->dp);
iq->num_current_queries = 0;
iq->num_target_queries = -1;
/* Count this as a referral. */
log_nametypeclass("priming successful for", qstate->qinfo.qname,
qstate->qinfo.qtype, qstate->qinfo.qclass);
+ delegpt_log(dp);
foriq = (struct iter_qstate*)forq->minfo[id];
foriq->dp = dp;
foriq->response = dns_copy_msg(iq->response, forq->region);
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 */
static void
dname_test_strict_subdomain()
dname_test_dname_lab_cmp();
dname_test_pkt_dname_len(buff);
dname_test_strict_subdomain();
+ dname_test_subdomain();
ldns_buffer_free(buff);
}
{
memset(t, 0, sizeof(*t));
lock_rw_init(&t->entry.lock);
+ t->entry.key = t;
}
/** prealloc some entries in the cache. To minimize contention.
struct ub_packed_rrset_key* key1 = (struct ub_packed_rrset_key*)k1;
struct ub_packed_rrset_key* key2 = (struct ub_packed_rrset_key*)k2;
int c;
- if(key1 == key2 || key1->id == key2->id)
+ if(key1 == key2)
return 0;
if(key1->rk.type != key2->rk.type) {
if(key1->rk.type < key2->rk.type)
uint16_t dclass)
{
char buf[LDNS_MAX_DOMAINLEN+1];
+ char t[12], c[12];
+ const char *ts, *cs;
dname_str(name, buf);
- log_info("%s <%s %s %s>", str, buf,
- ldns_rr_descript(type)?ldns_rr_descript(type)->_name: "??",
- ldns_lookup_by_id(ldns_rr_classes, (int)dclass)?
- ldns_lookup_by_id(ldns_rr_classes, (int)dclass)->name:"??");
+ if(ldns_rr_descript(type) && ldns_rr_descript(type)->_name)
+ ts = ldns_rr_descript(type)->_name;
+ else {
+ 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