]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
glue fetch tested.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 25 Jul 2007 14:12:44 +0000 (14:12 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 25 Jul 2007 14:12:44 +0000 (14:12 +0000)
git-svn-id: file:///svn/unbound/trunk@451 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
iterator/iterator.c
iterator/iterator.h
testdata/fetch_glue.rpl [new file with mode: 0644]

index 88c2bb5d4d333d844b42d1d46b44208b49fbf647..f1713c8bb4e67c6da1c3b2f4026e338f893d9b4a 100644 (file)
@@ -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.
index 20612604409d8e1107c247e03c0140ffa23d5011..0809535bc41f66841490519ac5e023f96d601718 100644 (file)
@@ -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. */
index 91a1c9ff751c9fc55782d2f6842917c2e7bad87d..b102613385a985c70e89dd1f5c39905751420883 100644 (file)
@@ -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 (file)
index 0000000..93acce2
--- /dev/null
@@ -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