Commit 46e7763d authored by Evan Hunt's avatar Evan Hunt

[master] check for STALE rdatasets in cache search

4446.	[bug]		The cache_find() and _findrdataset() functions
			could find rdatasets that had been marked stale.
			[RT #42853]
parent 3390d74e
4446. [bug] The cache_find() and _findrdataset() functions
could find rdatasets that had been marked stale.
[RT #42853]
4445. [cleanup] isc_errno_toresult() can now be used to call the
formerly private function isc__errno2result().
[RT #43050]
......
......@@ -163,7 +163,7 @@ typedef isc_uint64_t rbtdb_serial_t;
#define cache_findrdataset cache_findrdataset64
#define cache_findzonecut cache_findzonecut64
#define cache_zonecut_callback cache_zonecut_callback64
#define check_stale_rdataset check_stale_rdataset64
#define check_stale_header check_stale_header64
#define cleanup_dead_nodes cleanup_dead_nodes64
#define cleanup_dead_nodes_callback cleanup_dead_nodes_callback64
#define closeversion closeversion64
......@@ -4575,9 +4575,9 @@ zone_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options,
}
static isc_boolean_t
check_stale_rdataset(dns_rbtnode_t *node, rdatasetheader_t *header,
isc_rwlocktype_t *locktype, nodelock_t *lock,
rbtdb_search_t *search, rdatasetheader_t **header_prev)
check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header,
isc_rwlocktype_t *locktype, nodelock_t *lock,
rbtdb_search_t *search, rdatasetheader_t **header_prev)
{
#if !defined(ISC_RWLOCK_USEATOMIC) || !defined(DNS_RBT_USEISCREFCOUNT)
......@@ -4664,9 +4664,9 @@ cache_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) {
header_prev = NULL;
for (header = node->data; header != NULL; header = header_next) {
header_next = header->next;
if (check_stale_rdataset(node, header,
&locktype, lock, search,
&header_prev)) {
if (check_stale_header(node, header,
&locktype, lock, search,
&header_prev)) {
/* Do nothing. */
} else if (header->type == dns_rdatatype_dname &&
EXISTS(header)) {
......@@ -4738,9 +4738,9 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node,
header_prev = NULL;
for (header = node->data; header != NULL; header = header_next) {
header_next = header->next;
if (check_stale_rdataset(node, header,
&locktype, lock, search,
&header_prev)) {
if (check_stale_header(node, header,
&locktype, lock, search,
&header_prev)) {
/* Do nothing. */
} else if (EXISTS(header)) {
/*
......@@ -4875,9 +4875,9 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep,
header_prev = NULL;
for (header = node->data; header != NULL; header = header_next) {
header_next = header->next;
if (check_stale_rdataset(node, header,
&locktype, lock, search,
&header_prev)) {
if (check_stale_header(node, header,
&locktype, lock, search,
&header_prev)) {
continue;
}
if (NONEXISTENT(header) ||
......@@ -5060,11 +5060,11 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
header_prev = NULL;
for (header = node->data; header != NULL; header = header_next) {
header_next = header->next;
if (check_stale_rdataset(node, header,
&locktype, lock, &search,
&header_prev)) {
if (check_stale_header(node, header,
&locktype, lock, &search,
&header_prev)) {
/* Do nothing. */
} else if (EXISTS(header)) {
} else if (EXISTS(header) && (!STALE(header))) {
/*
* We now know that there is at least one active
* non-stale rdataset at this node.
......@@ -5335,9 +5335,9 @@ cache_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options,
header_prev = NULL;
for (header = node->data; header != NULL; header = header_next) {
header_next = header->next;
if (check_stale_rdataset(node, header,
&locktype, lock, &search,
&header_prev)) {
if (check_stale_header(node, header,
&locktype, lock, &search,
&header_prev)) {
/* Do nothing. */
} else if (EXISTS(header)) {
/*
......@@ -5809,7 +5809,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
*/
mark_stale_header(rbtdb, header);
}
} else if (EXISTS(header)) {
} else if (EXISTS(header) && (!STALE(header))) {
if (header->type == matchtype)
found = header;
else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
......
Markdown is supported
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