* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbtdb.c,v 1.168.2.11.2.25 2006/02/16 01:24:07 marka Exp $ */
+/* $Id: rbtdb.c,v 1.168.2.11.2.26 2006/03/02 23:18:20 marka Exp $ */
/*
* Principal Author: Bob Halley
rdatasetheader_t *header, *header_prev, *header_next;
rdatasetheader_t *found, *nsheader;
rdatasetheader_t *foundsig, *nssig, *cnamesig;
- rbtdb_rdatatype_t sigtype, nsectype;
+ rbtdb_rdatatype_t sigtype, negtype;
UNUSED(version);
found = NULL;
foundsig = NULL;
sigtype = RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, type);
- nsectype = RBTDB_RDATATYPE_VALUE(0, type);
+ negtype = RBTDB_RDATATYPE_VALUE(0, type);
nsheader = NULL;
nssig = NULL;
cnamesig = NULL;
*/
foundsig = header;
} else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
- header->type == nsectype) {
+ header->type == negtype) {
/*
* We've found a negative cache entry.
*/
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
dns_rbtnode_t *rbtnode = (dns_rbtnode_t *)node;
rdatasetheader_t *header, *header_next, *found, *foundsig;
- rbtdb_rdatatype_t matchtype, sigmatchtype, nsectype;
+ rbtdb_rdatatype_t matchtype, sigmatchtype, negtype;
isc_result_t result;
REQUIRE(VALID_RBTDB(rbtdb));
found = NULL;
foundsig = NULL;
matchtype = RBTDB_RDATATYPE_VALUE(type, covers);
- nsectype = RBTDB_RDATATYPE_VALUE(0, type);
+ negtype = RBTDB_RDATATYPE_VALUE(0, type);
if (covers == 0)
sigmatchtype = RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, type);
else
if (header->type == matchtype)
found = header;
else if (header->type == RBTDB_RDATATYPE_NCACHEANY ||
- header->type == nsectype)
+ header->type == negtype)
found = header;
else if (header->type == sigmatchtype)
foundsig = header;
isc_boolean_t header_nx;
isc_boolean_t newheader_nx;
isc_boolean_t merge;
- dns_rdatatype_t nsectype, rdtype, covers;
+ dns_rdatatype_t rdtype, covers;
+ rbtdb_rdatatype_t negtype;
dns_trust_t trust;
/*
newheader_nx = NONEXISTENT(newheader) ? ISC_TRUE : ISC_FALSE;
topheader_prev = NULL;
- nsectype = 0;
+ negtype = 0;
if (rbtversion == NULL && !newheader_nx) {
rdtype = RBTDB_RDATATYPE_BASE(newheader->type);
if (rdtype == 0) {
covers = RBTDB_RDATATYPE_EXT(newheader->type);
if (covers == dns_rdatatype_any) {
/*
- * We're adding an NXDOMAIN negative cache
- * entry.
+ * We're adding an negative cache entry
+ * which covers all types (NXDOMAIN,
+ * NODATA(QTYPE=ANY)).
*
* We make all other data stale so that the
* only rdataset that can be found at this
- * node is the NXDOMAIN negative cache entry.
+ * node is the negative cache entry.
*/
for (topheader = rbtnode->data;
topheader != NULL;
rbtnode->dirty = 1;
goto find_header;
}
- nsectype = RBTDB_RDATATYPE_VALUE(covers, 0);
+ negtype = RBTDB_RDATATYPE_VALUE(covers, 0);
} else {
/*
* We're adding something that isn't a
* negative cache entry. Look for an extant
- * non-stale NXDOMAIN negative cache entry.
+ * non-stale NXDOMAIN/NODATA(QTYPE=ANY) negative
+ * cache entry.
*/
for (topheader = rbtnode->data;
topheader != NULL;
topheader = topheader->next) {
- if (NXDOMAIN(topheader))
+ if (topheader->type ==
+ RBTDB_RDATATYPE_NCACHEANY)
break;
}
if (topheader != NULL && EXISTS(topheader) &&
*/
if (trust < topheader->trust) {
/*
- * The NXDOMAIN is more trusted.
+ * The NXDOMAIN/NODATA(QTYPE=ANY)
+ * is more trusted.
*/
free_rdataset(rbtdb->common.mctx,
newheader);
}
/*
* The new rdataset is better. Expire the
- * NXDOMAIN.
+ * NXDOMAIN/NODATA(QTYPE=ANY).
*/
topheader->ttl = 0;
topheader->attributes |= RDATASET_ATTR_STALE;
topheader = NULL;
goto find_header;
}
- nsectype = RBTDB_RDATATYPE_VALUE(0, rdtype);
+ negtype = RBTDB_RDATATYPE_VALUE(0, rdtype);
}
}
topheader != NULL;
topheader = topheader->next) {
if (topheader->type == newheader->type ||
- topheader->type == nsectype)
+ topheader->type == negtype)
break;
topheader_prev = topheader;
}
rbtnode->dirty = 1;
if (changed != NULL)
changed->dirty = ISC_TRUE;
+ if (rbtversion == NULL) {
+ header->ttl = 0;
+ header->attributes |= RDATASET_ATTR_STALE;
+ }
}
} else {
/*
rdatasetheader_t *header, *top_next;
rbtdb_serial_t serial;
isc_stdtime_t now;
- rbtdb_rdatatype_t type;
+ rbtdb_rdatatype_t type, negtype;
+ dns_rdatatype_t rdtype, covers;
header = rbtiterator->current;
if (header == NULL)
LOCK(&rbtdb->node_locks[rbtnode->locknum].lock);
type = header->type;
+ rdtype = RBTDB_RDATATYPE_BASE(header->type);
+ if (rdtype == 0) {
+ covers = RBTDB_RDATATYPE_EXT(header->type);
+ negtype = RBTDB_RDATATYPE_VALUE(covers, 0);
+ } else
+ negtype = RBTDB_RDATATYPE_VALUE(0, rdtype);
for (header = header->next; header != NULL; header = top_next) {
top_next = header->next;
- if (header->type != type) {
+ /*
+ * If not walking back up the down list.
+ */
+ if (header->type != type && header->type != negtype) {
do {
if (header->serial <= serial &&
!IGNORE(header)) {