4a09e96
Index: iterator/iter_delegpt.c
4a09e96
===================================================================
4a09e96
--- iterator/iter_delegpt.c	(revision 1952)
4a09e96
+++ iterator/iter_delegpt.c	(revision 1953)
4a09e96
@@ -154,11 +154,13 @@
4a09e96
 		/* ignore it */
4a09e96
 		return 1;
4a09e96
 	}
4a09e96
-	if(addr_is_ip6(addr, addrlen))
4a09e96
-		ns->got6 = 1;
4a09e96
-	else	ns->got4 = 1;
4a09e96
-	if(ns->got4 && ns->got6)
4a09e96
-		ns->resolved = 1;
4a09e96
+	if(!lame) {
4a09e96
+		if(addr_is_ip6(addr, addrlen))
4a09e96
+			ns->got6 = 1;
4a09e96
+		else	ns->got4 = 1;
4a09e96
+		if(ns->got4 && ns->got6)
4a09e96
+			ns->resolved = 1;
4a09e96
+	}
4a09e96
 	return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame, nodup);
4a09e96
 }
4a09e96
 
4a09e96
@@ -254,10 +256,11 @@
4a09e96
 			(dp->bogus?" BOGUS":"") );
4a09e96
 		}
4a09e96
 		for(a = dp->target_list; a; a = a->next_target) {
4a09e96
-			if(a->bogus) 
4a09e96
-				log_addr(VERB_ALGO, "  BOGUS ", 
4a09e96
-					&a->addr, a->addrlen);
4a09e96
-			else log_addr(VERB_ALGO, "  ", &a->addr, a->addrlen);
4a09e96
+			const char* str = "  ";
4a09e96
+			if(a->bogus && a->lame) str = "  BOGUS ADDR_LAME ";
4a09e96
+			else if(a->bogus) str = "  BOGUS ";
4a09e96
+			else if(a->lame) str = "  ADDR_LAME ";
4a09e96
+			log_addr(VERB_ALGO, str, &a->addr, a->addrlen);
4a09e96
 		}
4a09e96
 	}
4a09e96
 }
4a09e96
@@ -448,3 +451,13 @@
4a09e96
 		}
4a09e96
 	}
4a09e96
 }
4a09e96
+
4a09e96
+void delegpt_no_ipv6(struct delegpt* dp)
4a09e96
+{
4a09e96
+	struct delegpt_ns* ns;
4a09e96
+	for(ns = dp->nslist; ns; ns = ns->next) {
4a09e96
+		/* no ipv6, so only ipv4 is enough to resolve a nameserver */
4a09e96
+		if(ns->got4)
4a09e96
+			ns->resolved = 1;
4a09e96
+	}
4a09e96
+}
4a09e96
Index: iterator/iter_delegpt.h
4a09e96
===================================================================
4a09e96
--- iterator/iter_delegpt.h	(revision 1952)
4a09e96
+++ iterator/iter_delegpt.h	(revision 1953)
4a09e96
@@ -314,4 +314,11 @@
4a09e96
  */
4a09e96
 void delegpt_add_neg_msg(struct delegpt* dp, struct msgreply_entry* msg);
4a09e96
 
4a09e96
+/**
4a09e96
+ * Register the fact that there is no ipv6 and thus AAAAs are not going 
4a09e96
+ * to be queried for or be useful.
4a09e96
+ * @param dp: the delegation point. Updated to reflect no ipv6.
4a09e96
+ */
4a09e96
+void delegpt_no_ipv6(struct delegpt* dp);
4a09e96
+
4a09e96
 #endif /* ITERATOR_ITER_DELEGPT_H */
4a09e96
Index: iterator/iterator.c
4a09e96
===================================================================
4a09e96
--- iterator/iterator.c	(revision 1952)
4a09e96
+++ iterator/iterator.c	(revision 1953)
4a09e96
@@ -1305,6 +1305,8 @@
4a09e96
 		verbose(VERB_QUERY, "Failed to get a delegation, giving up");
4a09e96
 		return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
4a09e96
 	}
4a09e96
+	if(!ie->supports_ipv6)
4a09e96
+		delegpt_no_ipv6(iq->dp);
4a09e96
 	delegpt_log(VERB_ALGO, iq->dp);
4a09e96
 
4a09e96
 	if(iq->num_current_queries>0) {
4a09e96
Index: doc/Changelog
4a09e96
===================================================================
4a09e96
--- doc/Changelog	(revision 1952)
4a09e96
+++ doc/Changelog	(revision 1953)
4a09e96
@@ -1,3 +1,11 @@
4a09e96
+8 January 2010: Wouter
4a09e96
+	- Fix for parent-child disagreement code which could have trouble
4a09e96
+	  when (a) ipv6 was disabled and (b) the TTL for parent and child
4a09e96
+	  were different.  There were two bugs, the parent-side information
4a09e96
+	  is fixed to no longer block lookup of child side information and
4a09e96
+	  the iterator is fixed to no longer attempt to get ipv6 when it is
4a09e96
+	  not enabled and then give up in failure.
4a09e96
+
4a09e96
 7 January 2010: Wouter
4a09e96
 	- Fixup python documentation (thanks Leo Vandewoestijne).
4a09e96
 	- Work on cache prefetch feature.
4a09e96
Index: testdata/iter_pcttl.rpl
4a09e96
===================================================================
4a09e96
--- testdata/iter_pcttl.rpl	(revision 0)
4a09e96
+++ testdata/iter_pcttl.rpl	(revision 1953)
4a09e96
@@ -0,0 +1,245 @@
4a09e96
+; config options
4a09e96
+server:
4a09e96
+	target-fetch-policy: "0 0 0 0 0"
4a09e96
+	do-ip6: no
4a09e96
+
4a09e96
+stub-zone:
4a09e96
+	name: "."
4a09e96
+	stub-addr: 193.0.14.129 	# K.ROOT-SERVERS.NET.
4a09e96
+CONFIG_END
4a09e96
+
4a09e96
+SCENARIO_BEGIN Test cache ttls where parent child differ in ttl
4a09e96
+; and the lameness for parent suddenly becomes the only information point.
4a09e96
+
4a09e96
+; K.ROOT-SERVERS.NET.
4a09e96
+RANGE_BEGIN 0 100
4a09e96
+	ADDRESS 193.0.14.129 
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+. IN NS	K.ROOT-SERVERS.NET.
4a09e96
+SECTION ADDITIONAL
4a09e96
+K.ROOT-SERVERS.NET.	IN	A	193.0.14.129
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode subdomain
4a09e96
+ADJUST copy_id copy_query
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+com. IN NS
4a09e96
+SECTION AUTHORITY
4a09e96
+com.	IN NS	a.gtld-servers.net.
4a09e96
+SECTION ADDITIONAL
4a09e96
+a.gtld-servers.net.	IN 	A	192.5.6.30
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode subdomain
4a09e96
+ADJUST copy_id copy_query
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+net. IN NS
4a09e96
+SECTION AUTHORITY
4a09e96
+net.	IN NS	e.gtld-servers.net.
4a09e96
+SECTION ADDITIONAL
4a09e96
+e.gtld-servers.net.	IN 	A	192.12.94.30
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+RANGE_END
4a09e96
+
4a09e96
+; a.gtld-servers.net.
4a09e96
+RANGE_BEGIN 0 100
4a09e96
+	ADDRESS 192.5.6.30
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+com. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+com.	IN NS	a.gtld-servers.net.
4a09e96
+SECTION ADDITIONAL
4a09e96
+a.gtld-servers.net.	IN 	A	192.5.6.30
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode subdomain
4a09e96
+ADJUST copy_id copy_query
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+example.com. IN NS
4a09e96
+SECTION AUTHORITY
4a09e96
+example.com.	IN NS	ns.foo.com.
4a09e96
+SECTION ADDITIONAL
4a09e96
+;ns.foo.com.	200 	IN 	A	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode subdomain
4a09e96
+ADJUST copy_id copy_query
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+foo.com. IN NS
4a09e96
+SECTION AUTHORITY
4a09e96
+foo.com.	200 IN NS	ns.foo.com.
4a09e96
+SECTION ADDITIONAL
4a09e96
+ns.foo.com.	200 	IN 	A	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+RANGE_END
4a09e96
+
4a09e96
+; e.gtld-servers.net.
4a09e96
+RANGE_BEGIN 0 100
4a09e96
+	ADDRESS 192.12.94.30
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+net. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+net.	IN NS	e.gtld-servers.net.
4a09e96
+SECTION ADDITIONAL
4a09e96
+e.gtld-servers.net.	IN 	A	192.12.94.30
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+RANGE_END
4a09e96
+
4a09e96
+; ns.foo.com.
4a09e96
+; The parent-IP version
4a09e96
+RANGE_BEGIN 0 100
4a09e96
+	ADDRESS 1.2.3.44
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY AA QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+foo.com. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+foo.com.	200 IN NS	ns.foo.com.
4a09e96
+SECTION ADDITIONAL
4a09e96
+ns.foo.com.	100 	IN 	A	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY AA QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+ns.foo.com. IN A
4a09e96
+SECTION ANSWER
4a09e96
+ns.foo.com. 100 IN A	1.2.3.44
4a09e96
+SECTION AUTHORITY
4a09e96
+foo.com.	200 IN NS	ns.foo.com.
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY AA QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+ns.foo.com. IN AAAA
4a09e96
+SECTION AUTHORITY
4a09e96
+foo.com.    100 IN SOA . . 1 2 3 4 5
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY AA QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+example.com. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+example.com.	200 IN NS	ns.foo.com.
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode qtype qname
4a09e96
+ADJUST copy_id
4a09e96
+REPLY AA QR NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+www.example.com. IN A
4a09e96
+SECTION ANSWER
4a09e96
+www.example.com. 100 IN A	10.20.30.40
4a09e96
+SECTION AUTHORITY
4a09e96
+example.com.	200 IN NS	ns.foo.com.
4a09e96
+SECTION ADDITIONAL
4a09e96
+ns.foo.com 	100 IN A 	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+RANGE_END
4a09e96
+
4a09e96
+; NOT USED.  The parent side equals child side but not in the cache.
4a09e96
+; and they have different TTLs only.
4a09e96
+; ns.foo.com
4a09e96
+; The child IP version.   Does not respond to anything (servfail instead
4a09e96
+; of timeouts since this is easier to encode in .rpl file format).
4a09e96
+RANGE_BEGIN 0 100
4a09e96
+	ADDRESS 1.2.3.55
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH opcode 
4a09e96
+ADJUST copy_id copy_query
4a09e96
+REPLY QR SERVFAIL
4a09e96
+SECTION QUESTION
4a09e96
+foo.com. IN NS
4a09e96
+SECTION ANSWER
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+RANGE_END
4a09e96
+
4a09e96
+STEP 1 QUERY
4a09e96
+ENTRY_BEGIN
4a09e96
+REPLY RD
4a09e96
+SECTION QUESTION
4a09e96
+www.example.com. IN A
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+; recursion happens here.
4a09e96
+STEP 20 CHECK_ANSWER
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH all
4a09e96
+REPLY QR RD RA NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+www.example.com. IN A
4a09e96
+SECTION ANSWER
4a09e96
+www.example.com. 100 IN A	10.20.30.40
4a09e96
+SECTION AUTHORITY
4a09e96
+example.com.	100 IN NS	ns.foo.com.
4a09e96
+; scrubbed off
4a09e96
+;SECTION ADDITIONAL
4a09e96
+;ns.foo.com 	IN A 	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+; Now we wait 101 seconds, and the child data is gone,
4a09e96
+; but the parent-side was cached for 200 and it still there.
4a09e96
+
4a09e96
+STEP 30 TIME_PASSES ELAPSE 101
4a09e96
+
4a09e96
+STEP 40 QUERY
4a09e96
+ENTRY_BEGIN
4a09e96
+REPLY RD
4a09e96
+SECTION QUESTION
4a09e96
+www.example.com. IN A
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+; recursion happens here.
4a09e96
+STEP 50 CHECK_ANSWER
4a09e96
+ENTRY_BEGIN
4a09e96
+MATCH all
4a09e96
+REPLY QR RD RA NOERROR
4a09e96
+SECTION QUESTION
4a09e96
+www.example.com. IN A
4a09e96
+SECTION ANSWER
4a09e96
+www.example.com. 100 IN A	10.20.30.40
4a09e96
+SECTION AUTHORITY
4a09e96
+example.com.	100 IN NS	ns.foo.com.
4a09e96
+; scrubbed off
4a09e96
+;SECTION ADDITIONAL
4a09e96
+;ns.foo.com 	IN A 	1.2.3.44
4a09e96
+ENTRY_END
4a09e96
+
4a09e96
+SCENARIO_END