* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.218.2.9 2002/03/26 00:54:58 marka Exp $ */
+/* $Id: resolver.c,v 1.218.2.10 2002/04/19 01:11:16 marka Exp $ */
#include <config.h>
#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)
/*
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;
else
gluing = ISC_FALSE;
name = NULL;
- rdataset = NULL;
result = dns_message_findname(fctx->rmessage, DNS_SECTION_ADDITIONAL,
addname, dns_rdatatype_any, 0, &name,
NULL);
if (result == ISC_R_SUCCESS) {
external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain));
- if (type == dns_rdatatype_a) {
- for (rdataset = ISC_LIST_HEAD(name->list);
- rdataset != NULL;
- rdataset = ISC_LIST_NEXT(rdataset, link)) {
- if (rdataset->type == dns_rdatatype_sig)
- rtype = rdataset->covers;
- else
- rtype = rdataset->type;
- if (rtype == dns_rdatatype_a ||
- rtype == dns_rdatatype_aaaa ||
- 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,
- &rdataset);
- if (result == ISC_R_SUCCESS) {
- mark_related(name, rdataset, external, gluing);
- /*
- * Do we have its SIG too?
- */
- result = dns_message_findtype(name,
- dns_rdatatype_sig,
- type, &rdataset);
- if (result == ISC_R_SUCCESS)
- mark_related(name, rdataset, external,
- gluing);
- }
+ for (rdataset = ISC_LIST_HEAD(name->list);
+ rdataset != NULL;
+ rdataset = ISC_LIST_NEXT(rdataset, link)) {
+ if (rdataset->type == dns_rdatatype_sig)
+ rtype = rdataset->covers;
+ else
+ rtype = rdataset->type;
+ if ((type == dns_rdatatype_a &&
+ (rtype == dns_rdatatype_a ||
+ rtype == dns_rdatatype_aaaa ||
+ rtype == dns_rdatatype_a6)) ||
+ type == rtype)
+ mark_related(name, rdataset, external,
+ 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;
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.