Commit c7e021e2 authored by Mark Andrews's avatar Mark Andrews

4439. [bug] Address race conditions getting ownernames of nodes.

                        [RT #43005]
parent d260d5ef
4439. [bug] Address race conditions getting ownernames of nodes.
[RT #43005]
4438. [func] Use LIFO rather than FIFO when processing startup
notify and refresh queries. [RT #42825]
......
......@@ -622,7 +622,8 @@ static dns_dbmethods_t sampledb_methods = {
findnodeext,
findext,
setcachestats,
hashsize
hashsize,
NULL
};
/* Auxiliary driver functions. */
......
......@@ -1100,3 +1100,14 @@ dns_db_updatenotify_unregister(dns_db_t *db,
return (ISC_R_NOTFOUND);
}
isc_result_t
dns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) {
REQUIRE(db != NULL);
REQUIRE(node != NULL);
REQUIRE(name != NULL);
if (db->methods->nodefullname == NULL)
return (ISC_R_NOTIMPLEMENTED);
return ((db->methods->nodefullname)(db, node, name));
}
......@@ -581,7 +581,8 @@ static dns_dbmethods_t ecdb_methods = {
NULL, /* findnodeext */
NULL, /* findext */
NULL, /* setcachestats */
NULL /* hashsize */
NULL, /* hashsize */
NULL /* nodefullname */
};
static isc_result_t
......
......@@ -186,6 +186,8 @@ typedef struct dns_dbmethods {
dns_rdataset_t *sigrdataset);
isc_result_t (*setcachestats)(dns_db_t *db, isc_stats_t *stats);
size_t (*hashsize)(dns_db_t *db);
isc_result_t (*nodefullname)(dns_db_t *db, dns_dbnode_t *node,
dns_name_t *name);
} dns_dbmethods_t;
typedef isc_result_t
......@@ -1654,6 +1656,16 @@ dns_db_updatenotify_unregister(dns_db_t *db,
*
*/
isc_result_t
dns_db_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name);
/*%<
* Get the name associated with a database node.
*
* Requires:
*
* \li 'db' is a valid database
* \li 'node' and 'name' are not NULL
*/
ISC_LANG_ENDDECLS
#endif /* DNS_DB_H */
......@@ -218,6 +218,7 @@ typedef isc_uint64_t rbtdb_serial_t;
#define new_reference new_reference64
#define newversion newversion64
#define nodecount nodecount64
#define nodefullname nodefullname64
#define overmem overmem64
#define previous_closest_nsec previous_closest_nsec64
#define printnode printnode64
......@@ -6630,7 +6631,9 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
dns_rbt_fullnamefromnode(node, name);
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
dns_rdataset_getownercase(rdataset, name);
newheader = (rdatasetheader_t *)region.base;
......@@ -8061,6 +8064,23 @@ getrrsetstats(dns_db_t *db) {
return (rbtdb->rrsetstats);
}
static isc_result_t
nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) {
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
dns_rbtnode_t *rbtnode = (dns_rbtnode_t *)node;
isc_result_t result;
REQUIRE(VALID_RBTDB(rbtdb));
REQUIRE(node != NULL);
REQUIRE(name != NULL);
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
result = dns_rbt_fullnamefromnode(rbtnode, name);
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
return (result);
}
static dns_dbmethods_t zone_methods = {
attach,
detach,
......@@ -8104,7 +8124,8 @@ static dns_dbmethods_t zone_methods = {
NULL,
NULL,
NULL,
hashsize
hashsize,
nodefullname
};
static dns_dbmethods_t cache_methods = {
......@@ -8150,7 +8171,8 @@ static dns_dbmethods_t cache_methods = {
NULL,
NULL,
setcachestats,
hashsize
hashsize,
nodefullname
};
isc_result_t
......
......@@ -1289,7 +1289,8 @@ static dns_dbmethods_t sdb_methods = {
findnodeext,
findext,
NULL, /* setcachestats */
NULL /* hashsize */
NULL, /* hashsize */
NULL /* nodefullname */
};
static isc_result_t
......
......@@ -1323,7 +1323,8 @@ static dns_dbmethods_t sdlzdb_methods = {
findnodeext,
findext,
NULL, /* setcachestats */
NULL /* hashsize */
NULL, /* hashsize */
NULL /* nodefullname */
};
/*
......
......@@ -227,6 +227,7 @@ dns_db_load2
dns_db_load3
dns_db_newversion
dns_db_nodecount
dns_db_nodefullname
dns_db_ondestroy
dns_db_origin
dns_db_overmem
......
......@@ -53,7 +53,6 @@
#include <dns/nsec3.h>
#include <dns/peer.h>
#include <dns/private.h>
#include <dns/rbt.h>
#include <dns/rcode.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
......@@ -13980,9 +13979,11 @@ checkandaddsoa(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
dns_rdataset_init(&temprdataset);
result = dns_rdatalist_tordataset(&temprdatalist, &temprdataset);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
dns_rbtnode_nodename(node, name);
result = dns_db_nodefullname(db, node, name);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_getownercase(rdataset, name);
dns_rdataset_setownercase(&temprdataset, name);
return (dns_db_addrdataset(db, node, version, 0, &temprdataset,
......
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