From: Wouter Wijngaards Date: Wed, 25 Jul 2007 14:12:44 +0000 (+0000) Subject: glue fetch tested. X-Git-Tag: release-0.4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bd8d5a9291b23418a1f12972dc3793c51ebc4fb;p=thirdparty%2Funbound.git glue fetch tested. git-svn-id: file:///svn/unbound/trunk@451 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 88c2bb5d4..f1713c8bb 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,8 @@ - testbound read ADDRESS and check it. - test for version.bind and friends. - test for iterator chaining through several referrals. + - test and fixup for refetch for glue. Refetch fails if glue + is still not provided. 24 July 2007: Wouter - Example section in config manual. diff --git a/iterator/iterator.c b/iterator/iterator.c index 206126044..0809535bc 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -643,8 +643,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq, * 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->refetch_glue) { + delname = iq->dp->name; + delnamelen = iq->dp->namelen; + } else { + delname = iq->qchase.qname; + delnamelen = iq->qchase.qname_len; + } if((iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) && delname[0] != 0) { /* do not adjust root label, remove first label from delname */ @@ -779,6 +784,7 @@ generate_target_query(struct module_qstate* qstate, struct iter_qstate* iq, if(dname_subdomain_c(name, iq->dp->name)) { verbose(VERB_ALGO, "refetch of target glue"); subiq->refetch_glue = 1; + subiq->dp = delegpt_copy(iq->dp, subq->region); } } log_nametypeclass(VERB_DETAIL, "new target", name, qtype, qclass); @@ -834,6 +840,13 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq, missing --; continue; } + if(iq->refetch_glue && dname_subdomain_c(ns->name, + iq->dp->name)) { + log_nametypeclass(VERB_DETAIL, "skip double glue " + "refetch", ns->name, LDNS_RR_TYPE_A, + iq->qchase.qclass); + continue; + } if(ie->supports_ipv6) { /* Send the AAAA request. */ diff --git a/iterator/iterator.h b/iterator/iterator.h index 91a1c9ff7..b10261338 100644 --- a/iterator/iterator.h +++ b/iterator/iterator.h @@ -233,6 +233,8 @@ struct iter_qstate { * 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. + * The delegation point must be set to the one that should *not* + * be used when creating the state. A higher one will be attempted. */ int refetch_glue; diff --git a/testdata/fetch_glue.rpl b/testdata/fetch_glue.rpl new file mode 100644 index 000000000..93acce267 --- /dev/null +++ b/testdata/fetch_glue.rpl @@ -0,0 +1,149 @@ +; config options +stub-zone: + name: "." + stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET. +CONFIG_END + +SCENARIO_BEGIN Fetch glue when missing or timed out. + +; K.ROOT-SERVERS.NET. +RANGE_BEGIN 0 100 + ADDRESS 193.0.14.129 +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +. IN NS +SECTION ANSWER +. IN NS K.ROOT-SERVERS.NET. +SECTION ADDITIONAL +K.ROOT-SERVERS.NET. IN A 193.0.14.129 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION AUTHORITY +com. IN NS a.gtld-servers.net. +SECTION ADDITIONAL +a.gtld-servers.net. IN A 192.5.6.30 +ENTRY_END +RANGE_END + +; a.gtld-servers.net. +RANGE_BEGIN 0 100 + ADDRESS 192.5.6.30 +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION AUTHORITY +example.com. IN NS ns.example.com. +; is missing the glue! +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +ns.example.com. IN A +SECTION ANSWER +ns.example.com. IN A 1.2.3.4 +SECTION AUTHORITY +example.com. IN NS ns.example.com. +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +ns.example.com. IN AAAA +SECTION AUTHORITY +example.com. IN NS ns.example.com. +ENTRY_END +RANGE_END + +; ns.example.com. +RANGE_BEGIN 0 100 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +ns.example.com. IN A +SECTION ANSWER +ns.example.com. IN A 1.2.3.4 +SECTION AUTHORITY +example.com. IN NS ns.example.com. +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qtype qname +ADJUST copy_id +REPLY QR NOERROR +SECTION QUESTION +ns.example.com. IN AAAA +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END + +RANGE_END + +STEP 1 QUERY +ENTRY_BEGIN +REPLY RD +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +; recursion happens here. +STEP 10 CHECK_ANSWER +ENTRY_BEGIN +MATCH all +REPLY QR RD RA NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END + +; due to ordering of answer packets, this is still outstanding, remove it +STEP 21 CHECK_OUT_QUERY +ENTRY_BEGIN +ADJUST copy_id +MATCH qname qtype +REPLY QR +SECTION QUESTION +ns.example.com IN AAAA +ENTRY_END + +SCENARIO_END