From: Wouter Wijngaards Date: Fri, 20 Jul 2007 09:41:44 +0000 (+0000) Subject: Refetch glue code. X-Git-Tag: release-0.4~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2fd43871392d4ec91d6fc602fc182f0f9e1ed8b;p=thirdparty%2Funbound.git Refetch glue code. git-svn-id: file:///svn/unbound/trunk@445 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index cdf230eb1..e0c829298 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,8 @@ become a possibility. Note that still normalize scrubbing is done, and that the potentially spoofed data is used for infrastructure and not returned to the client. + - if glue times out, refetch by asking parent of delegation again. + Much like asking for DS at the parent side. 19 July 2007: Wouter - shuffle NS selection when getting nameserver target addresses. diff --git a/iterator/iter_delegpt.c b/iterator/iter_delegpt.c index f0038b288..0d5a57eae 100644 --- a/iterator/iter_delegpt.c +++ b/iterator/iter_delegpt.c @@ -99,17 +99,6 @@ delegpt_add_ns(struct delegpt* dp, struct region* region, uint8_t* name) (void)dname_count_size_labels(name, &ns->namelen); ns->name = region_alloc_init(region, name, ns->namelen); ns->resolved = 0; - - /* Sanity check: if the target name is at or *below* the - * delegation point itself, then this will be (potentially) - * unresolvable. This is the one case where glue *must* - * have been present. - * FIXME: at this point, this *may* be resolvable, so - * perhaps we should issue the query anyway and let it fail.*/ - if(dname_subdomain_c(ns->name, dp->name)) { - ns->resolved = 1; - } - return 1; } diff --git a/iterator/iterator.c b/iterator/iterator.c index 1d4769873..07a95bbae 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -114,6 +114,7 @@ iter_new(struct module_qstate* qstate, int id) iq->referral_count = 0; iq->priming = 0; iq->priming_stub = 0; + iq->refetch_glue = 0; iq->chase_flags = qstate->query_flags; /* Start with the (current) qname. */ iq->qchase = qstate->qinfo; @@ -405,6 +406,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype, subiq->final_state = final_state; subiq->qchase = subq->qinfo; subiq->chase_flags = subq->query_flags; + subiq->refetch_glue = 0; } return 1; } @@ -639,10 +641,12 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq, /* first, adjust for DS queries. To avoid the grandparent problem, * we just look for the closest set of server to the parent of qname. + * When re-fetching glue we also need to ask the parent. */ delname = iq->qchase.qname; delnamelen = iq->qchase.qname_len; - if(iq->qchase.qtype == LDNS_RR_TYPE_DS && delname[0] != 0) { + if((iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) + && delname[0] != 0) { /* do not adjust root label, remove first label from delname */ size_t lablen = delname[0] + 1; delname += lablen; @@ -663,7 +667,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq, if(!prime_root(qstate, iq, ie, id, iq->qchase.qclass)) return error_response(qstate, id, LDNS_RCODE_REFUSED); - /* priming creates an sends a subordinate query, with + /* priming creates and sends a subordinate query, with * this query as the parent. So further processing for * this event will stop until reactivated by the results * of priming. */ @@ -772,13 +776,10 @@ generate_target_query(struct module_qstate* qstate, struct iter_qstate* iq, if(subq) { struct iter_qstate* subiq = (struct iter_qstate*)subq->minfo[id]; - subiq->dp = delegpt_copy(iq->dp, subq->region); - if(!subiq->dp) { - log_err("init targetq: out of memory"); - (*qstate->env->kill_sub)(subq); - return 0; + if(dname_subdomain_c(name, iq->dp->name)) { + verbose(VERB_ALGO, "refetch of target glue"); + subiq->refetch_glue = 1; } - delegpt_log(subiq->dp); } log_nametypeclass(VERB_DETAIL, "new target", name, qtype, qclass); return 1; diff --git a/iterator/iterator.h b/iterator/iterator.h index f6587900d..91a1c9ff7 100644 --- a/iterator/iterator.h +++ b/iterator/iterator.h @@ -228,6 +228,14 @@ struct iter_qstate { */ int priming_stub; + /** + * This is a flag that, if true, means that this query is + * for (re)fetching glue from a zone. Since the address should + * have been glue, query again to the servers that should have + * been returning it as glue. + */ + int refetch_glue; + /** list of pending queries to authoritative servers. */ struct outbound_list outlist; };