]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
cycle detection test. TODO items
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 26 Jul 2007 10:04:05 +0000 (10:04 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 26 Jul 2007 10:04:05 +0000 (10:04 +0000)
git-svn-id: file:///svn/unbound/trunk@454 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
doc/TODO
iterator/iter_utils.c
testdata/iter_cycle.rpl [new file with mode: 0644]
testdata/iter_cycle_noh.rpl [new file with mode: 0644]

index c827ceaaaefdaf0393ed4ec8f721b468a20f2d86..08bc1f88274f0800814a66a03b5c5f9a56017ffe 100644 (file)
@@ -2,6 +2,7 @@
        - cycle detection, for query state dependencies. Will attempt to
          circumvent the cycle, but if no other targets available fails.
        - unit test for AXFR, IXFR response.
+       - test for cycle detection.
 
 25 July 2007: Wouter
        - testbound read ADDRESS and check it.
index fa92761f764d239906d5f06bbbd76b0d17511558..2fdbfa89d4704e110a86a6a85440d728911c0b13 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -25,8 +25,10 @@ o fallback without EDNS if result is NOTIMPL, now only on FORMERR like in java.
 o scrubber has slow pkt_subdomain and pkt_strict_subdomain functions.
 o get serverselection algorithm out of local optimum.
 o donotqueryaddresses allow specification of subnets, use trie to store.
+  extend default list to contain illegal ip4 and ip6 addresses.
 o memory profile; and if needed put serviced queries under qstate->region
   and special purpose region code, reuse blocks, shrink if too big.
 o check query, option to enforce presence of qdsection in noerror answers.
 o configuration option where port 53 is used for send and receive, no other
   ports are used.
+o prime sequence in multiple queries, if glue missing from prime sequence.
index bedf78a40a0a1a0882bf10aa733c751d73ff5f4c..a6accbe454e17af05f59fa7c34bbe0d1dad6c24f 100644 (file)
@@ -379,7 +379,12 @@ iter_mark_cycle_targets(struct module_qstate* qstate, struct delegpt* dp)
                if(causes_cycle(qstate, ns->name, ns->namelen, 
                        LDNS_RR_TYPE_AAAA, qstate->qinfo.qclass) ||
                   causes_cycle(qstate, ns->name, ns->namelen, 
-                       LDNS_RR_TYPE_A, qstate->qinfo.qclass))
+                       LDNS_RR_TYPE_A, qstate->qinfo.qclass)) {
+                       log_nametypeclass(VERB_DETAIL, "skipping target due "
+                               "to dependency cycle (harden-glue: no may "
+                               "fix this)", ns->name, LDNS_RR_TYPE_A, 
+                               qstate->qinfo.qclass);
                        ns->resolved = 1;
+               }
        }
 }
diff --git a/testdata/iter_cycle.rpl b/testdata/iter_cycle.rpl
new file mode 100644 (file)
index 0000000..d018069
--- /dev/null
@@ -0,0 +1,151 @@
+; config options
+stub-zone:
+       name: "."
+       stub-addr: 193.0.14.129         # K.ROOT-SERVERS.NET.
+CONFIG_END
+
+SCENARIO_BEGIN Test resolution with dependency cycle
+; query for ns.example.com, needs ns.example.net, needs ns.example.com.
+
+; 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
+ns.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
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.com. IN AAAA
+SECTION AUTHORITY
+com.   IN NS   a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net.    IN      A       192.5.6.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN A
+SECTION AUTHORITY
+net.   IN NS   e.gtld-servers.net.
+SECTION ADDITIONAL
+e.gtld-servers.net.    IN      A       192.12.94.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN AAAA
+SECTION AUTHORITY
+net.   IN NS   e.gtld-servers.net.
+SECTION ADDITIONAL
+e.gtld-servers.net.    IN      A       192.12.94.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
+ns.example.com. IN A
+SECTION AUTHORITY
+example.com.   IN NS   ns.example.net.
+SECTION ADDITIONAL
+; note this will be scrubbed off
+ns.example.net.        IN A 1.2.3.1
+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.net.
+SECTION ADDITIONAL
+; note this will be scrubbed off
+ns.example.net.        IN A 1.2.3.1
+ENTRY_END
+RANGE_END
+
+; e.gtld-servers.net.
+RANGE_BEGIN 0 100
+       ADDRESS 192.12.94.30
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN A
+SECTION AUTHORITY
+example.net.   IN NS   ns.example.com.
+SECTION ADDITIONAL
+; note this will be scrubbed off
+ns.example.com.        IN A 1.2.3.2
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN AAAA
+SECTION AUTHORITY
+example.net.   IN NS   ns.example.com.
+SECTION ADDITIONAL
+; note this will be scrubbed off
+ns.example.com.        IN A 1.2.3.2
+ENTRY_END
+RANGE_END
+
+STEP 1 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+ns.example.com. IN A
+ENTRY_END
+
+; recursion happens here.
+; cycle detected and it fails.
+STEP 20 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA SERVFAIL
+SECTION QUESTION
+ns.example.com. IN A
+ENTRY_END
+
+SCENARIO_END
diff --git a/testdata/iter_cycle_noh.rpl b/testdata/iter_cycle_noh.rpl
new file mode 100644 (file)
index 0000000..cf01cb2
--- /dev/null
@@ -0,0 +1,175 @@
+; config options
+server:
+       harden-glue: "no"
+stub-zone:
+       name: "."
+       stub-addr: 193.0.14.129         # K.ROOT-SERVERS.NET.
+CONFIG_END
+
+SCENARIO_BEGIN Test resolution where disabled scrubber avoids cycle
+; query for ns.example.com, needs ns.example.net, needs ns.example.com.
+; scrubber disabled, so extra glue is trusted.
+
+; 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
+ns.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
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.com. IN AAAA
+SECTION AUTHORITY
+com.   IN NS   a.gtld-servers.net.
+SECTION ADDITIONAL
+a.gtld-servers.net.    IN      A       192.5.6.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN A
+SECTION AUTHORITY
+net.   IN NS   e.gtld-servers.net.
+SECTION ADDITIONAL
+e.gtld-servers.net.    IN      A       192.12.94.30
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN AAAA
+SECTION AUTHORITY
+net.   IN NS   e.gtld-servers.net.
+SECTION ADDITIONAL
+e.gtld-servers.net.    IN      A       192.12.94.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
+ns.example.com. IN A
+SECTION AUTHORITY
+example.com.   IN NS   ns.example.net.
+SECTION ADDITIONAL
+ns.example.net.        IN A 1.2.3.1
+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.net.
+SECTION ADDITIONAL
+ns.example.net.        IN A 1.2.3.1
+ENTRY_END
+RANGE_END
+
+; e.gtld-servers.net.
+RANGE_BEGIN 0 100
+       ADDRESS 192.12.94.30
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN A
+SECTION AUTHORITY
+example.net.   IN NS   ns.example.com.
+SECTION ADDITIONAL
+ns.example.com.        IN A 1.2.3.2
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+ns.example.net. IN AAAA
+SECTION AUTHORITY
+example.net.   IN NS   ns.example.com.
+SECTION ADDITIONAL
+ns.example.com.        IN A 1.2.3.2
+ENTRY_END
+RANGE_END
+
+; ns.example.net.
+RANGE_BEGIN 0 100
+       ADDRESS 1.2.3.1
+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.2
+SECTION AUTHORITY
+example.com.   IN NS   ns.example.net.
+SECTION ADDITIONAL
+ns.example.net.        IN A 1.2.3.1
+ENTRY_END
+RANGE_END
+
+STEP 1 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+ns.example.com. IN A
+ENTRY_END
+
+; recursion happens here.
+; cycle detected and it fails.
+STEP 20 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA
+SECTION QUESTION
+ns.example.com. IN A
+SECTION ANSWER
+ns.example.com.        IN A 1.2.3.2
+SECTION AUTHORITY
+example.com.   IN NS   ns.example.net.
+; scrubbed off
+; SECTION ADDITIONAL
+; ns.example.net.      IN A 1.2.3.1
+ENTRY_END
+
+SCENARIO_END