Commit 79bbb290 authored by Bob Halley's avatar Bob Halley
Browse files

deal with negative cache results

parent 9736378f
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
#define MAX_CHAINS 8 #define MAX_CHAINS 8
#define MAX_DEPTH 16 #define MAX_DEPTH 16
static inline void
maybe_disassociate(dns_rdataset_t *rdataset) {
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
}
static isc_result_t static isc_result_t
foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth, foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth,
unsigned int oprefixlen) unsigned int oprefixlen)
...@@ -95,8 +101,7 @@ foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth, ...@@ -95,8 +101,7 @@ foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth,
result = foreach(a6ctx, &child, depth, result = foreach(a6ctx, &child, depth,
prefixlen); prefixlen);
dns_rdataset_disassociate(&child); dns_rdataset_disassociate(&child);
if (childsig.methods != NULL) maybe_disassociate(&childsig);
dns_rdataset_disassociate(&childsig);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
break; break;
} else if (result == DNS_R_NOTFOUND && } else if (result == DNS_R_NOTFOUND &&
...@@ -115,6 +120,19 @@ foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth, ...@@ -115,6 +120,19 @@ foreach(dns_a6context_t *a6ctx, dns_rdataset_t *parent, unsigned int depth,
a6ctx->depth = depth; a6ctx->depth = depth;
a6ctx->prefixlen = prefixlen; a6ctx->prefixlen = prefixlen;
(a6ctx->missing)(a6ctx, &name); (a6ctx->missing)(a6ctx, &name);
} else {
/*
* Either something went wrong, or
* we got a negative cache response.
* In either case, we can't follow
* this chain further, and we don't
* want to call the 'missing'
* function.
*
* We do want to clean up...
*/
maybe_disassociate(&child);
maybe_disassociate(&childsig);
} }
} }
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment