]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1178. [func] Follow and cache (if appropriate) A6 and other
authorMark Andrews <marka@isc.org>
Thu, 17 Jan 2002 00:16:30 +0000 (00:16 +0000)
committerMark Andrews <marka@isc.org>
Thu, 17 Jan 2002 00:16:30 +0000 (00:16 +0000)
                        data chains to completion in the additional section.

CHANGES
lib/dns/include/dns/name.h
lib/dns/include/dns/rdataset.h
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 3af4aee586bf6555cf18525205a0d5992a294db7..981521c26215cc5acbe5222741dc6b0cdcc5dc30 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+1178.  [func]          Follow and cache (if appropriate) A6 and other
+                       data chains to completion in the additional section.
+
 1177.  [func]          Report view when loading zones if it is not a
                        standard view (_default or _bind). [RT #2270]
 
index d1c610f66db4962c93e78ffb76ada1b81190b199..38e18f928ada9bcd45958a6e80ae2c687deaa307 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name.h,v 1.97 2001/12/04 01:32:44 bwelling Exp $ */
+/* $Id: name.h,v 1.98 2002/01/17 00:16:28 marka Exp $ */
 
 #ifndef DNS_NAME_H
 #define DNS_NAME_H 1
@@ -209,6 +209,7 @@ struct dns_name {
 #define DNS_NAMEATTR_ANSWER            0x0200          /* Used by resolver. */
 #define DNS_NAMEATTR_NCACHE            0x0400          /* Used by resolver. */
 #define DNS_NAMEATTR_CHAINING          0x0800          /* Used by resolver. */
+#define DNS_NAMEATTR_CHASE             0x1000          /* Used by resolver. */
 
 LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_rootname;
 LIBDNS_EXTERNAL_DATA extern dns_name_t *dns_wildcardname;
index 2281fb5b98a10c21b864a27345d4f2447eeda54a..ab2ebd863d512c97ecb139162656bc57e683b203 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rdataset.h,v 1.41 2001/08/28 03:58:21 marka Exp $ */
+/* $Id: rdataset.h,v 1.42 2002/01/17 00:16:30 marka Exp $ */
 
 #ifndef DNS_RDATASET_H
 #define DNS_RDATASET_H 1
@@ -128,6 +128,7 @@ struct dns_rdataset {
 #define DNS_RDATASETATTR_TTLADJUSTED   0x0200          /* Used by message.c */
 #define DNS_RDATASETATTR_FIXEDORDER    0x0400
 #define DNS_RDATASETATTR_RANDOMIZE     0x0800
+#define DNS_RDATASETATTR_CHASE         0x1000          /* Used by resolver. */
 
 void
 dns_rdataset_init(dns_rdataset_t *rdataset);
index 72f77fc8f6d66c50e621331f9d92e38b449259b7..a873853ef6b29a1e9709b74b43a8821778ceb567 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.234 2001/11/30 01:59:18 gson Exp $ */
+/* $Id: resolver.c,v 1.235 2002/01/17 00:16:25 marka Exp $ */
 
 #include <config.h>
 
@@ -2451,6 +2451,7 @@ clone_results(fetchctx_t *fctx) {
 #define ANSWERSIG(r)   (((r)->attributes & DNS_RDATASETATTR_ANSWERSIG) != 0)
 #define EXTERNAL(r)    (((r)->attributes & DNS_RDATASETATTR_EXTERNAL) != 0)
 #define CHAINING(r)    (((r)->attributes & DNS_RDATASETATTR_CHAINING) != 0)
+#define CHASE(r)       (((r)->attributes & DNS_RDATASETATTR_CHASE) != 0)
 
 
 /*
@@ -3271,6 +3272,13 @@ mark_related(dns_name_t *name, dns_rdataset_t *rdataset,
                        rdataset->ttl = 1;
        } else
                rdataset->trust = dns_trust_additional;
+       /*
+        * Avoid infinite loops by only marking new rdatasets.
+        */
+       if (!CACHE(rdataset)) {
+               name->attributes |= DNS_NAMEATTR_CHASE;
+               rdataset->attributes |= DNS_RDATASETATTR_CHASE;
+       }
        rdataset->attributes |= DNS_RDATASETATTR_CACHE;
        if (external)
                rdataset->attributes |= DNS_RDATASETATTR_EXTERNAL;
@@ -3312,13 +3320,6 @@ check_related(void *arg, dns_name_t *addname, dns_rdatatype_t type) {
                                    rtype == dns_rdatatype_a6)
                                        mark_related(name, rdataset, external,
                                                     gluing);
-                               /*
-                                * XXXRTH  Need to do a controlled recursion
-                                *         on the A6 prefix names to mark
-                                *         any additional data related to them.
-                                *
-                                *         Ick.
-                                */
                        }
                } else {
                        result = dns_message_findtype(name, type, 0,
@@ -3336,15 +3337,46 @@ check_related(void *arg, dns_name_t *addname, dns_rdatatype_t type) {
                                                     gluing);
                        }
                }
-               /*
-                * XXXRTH  Some other stuff still needs to be marked.
-                *         See query.c.
-                */
        }
 
        return (ISC_R_SUCCESS);
 }
 
+static void
+chase_additional(fetchctx_t *fctx) {
+       isc_boolean_t rescan;
+       dns_section_t section = DNS_SECTION_ADDITIONAL;
+       isc_result_t result;
+
+ again:
+       rescan = ISC_FALSE;
+       
+       for (result = dns_message_firstname(fctx->rmessage, section);
+            result == ISC_R_SUCCESS;
+            result = dns_message_nextname(fctx->rmessage, section)) {
+               dns_name_t *name = NULL;
+               dns_rdataset_t *rdataset;
+               dns_message_currentname(fctx->rmessage, DNS_SECTION_ADDITIONAL,
+                                       &name);
+               if ((name->attributes & DNS_NAMEATTR_CHASE) == 0)
+                       continue;
+               name->attributes &= ~DNS_NAMEATTR_CHASE;
+               for (rdataset = ISC_LIST_HEAD(name->list);
+                    rdataset != NULL;
+                    rdataset = ISC_LIST_NEXT(rdataset, link)) {
+                       if (CHASE(rdataset)) {
+                               rdataset->attributes &= ~DNS_RDATASETATTR_CHASE;
+                               (void)dns_rdataset_additionaldata(rdataset,
+                                                                 check_related,
+                                                                 fctx);
+                               rescan = ISC_TRUE;
+                       }
+               }
+       }
+       if (rescan)
+               goto again;
+}
+
 static inline isc_result_t
 cname_target(dns_rdataset_t *rdataset, dns_name_t *tname) {
        isc_result_t result;
@@ -4425,6 +4457,11 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
                goto done;
        }
 
+       /*
+        * Follow A6 and other additional section data chains.
+        */
+       chase_additional(fctx);
+
        /*
         * Cache the cacheable parts of the message.  This may also cause
         * work to be queued to the DNSSEC validator.