mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
4439. [bug] Address race conditions getting ownernames of nodes.
[RT #43005]
This commit is contained in:
parent
d260d5ef4c
commit
c7e021e2e6
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
|||||||
|
4439. [bug] Address race conditions getting ownernames of nodes.
|
||||||
|
[RT #43005]
|
||||||
|
|
||||||
4438. [func] Use LIFO rather than FIFO when processing startup
|
4438. [func] Use LIFO rather than FIFO when processing startup
|
||||||
notify and refresh queries. [RT #42825]
|
notify and refresh queries. [RT #42825]
|
||||||
|
|
||||||
|
@ -622,7 +622,8 @@ static dns_dbmethods_t sampledb_methods = {
|
|||||||
findnodeext,
|
findnodeext,
|
||||||
findext,
|
findext,
|
||||||
setcachestats,
|
setcachestats,
|
||||||
hashsize
|
hashsize,
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Auxiliary driver functions. */
|
/* Auxiliary driver functions. */
|
||||||
|
11
lib/dns/db.c
11
lib/dns/db.c
@ -1100,3 +1100,14 @@ dns_db_updatenotify_unregister(dns_db_t *db,
|
|||||||
|
|
||||||
return (ISC_R_NOTFOUND);
|
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, /* findnodeext */
|
||||||
NULL, /* findext */
|
NULL, /* findext */
|
||||||
NULL, /* setcachestats */
|
NULL, /* setcachestats */
|
||||||
NULL /* hashsize */
|
NULL, /* hashsize */
|
||||||
|
NULL /* nodefullname */
|
||||||
};
|
};
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
@ -186,6 +186,8 @@ typedef struct dns_dbmethods {
|
|||||||
dns_rdataset_t *sigrdataset);
|
dns_rdataset_t *sigrdataset);
|
||||||
isc_result_t (*setcachestats)(dns_db_t *db, isc_stats_t *stats);
|
isc_result_t (*setcachestats)(dns_db_t *db, isc_stats_t *stats);
|
||||||
size_t (*hashsize)(dns_db_t *db);
|
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;
|
} dns_dbmethods_t;
|
||||||
|
|
||||||
typedef isc_result_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
|
ISC_LANG_ENDDECLS
|
||||||
|
|
||||||
#endif /* DNS_DB_H */
|
#endif /* DNS_DB_H */
|
||||||
|
@ -218,6 +218,7 @@ typedef isc_uint64_t rbtdb_serial_t;
|
|||||||
#define new_reference new_reference64
|
#define new_reference new_reference64
|
||||||
#define newversion newversion64
|
#define newversion newversion64
|
||||||
#define nodecount nodecount64
|
#define nodecount nodecount64
|
||||||
|
#define nodefullname nodefullname64
|
||||||
#define overmem overmem64
|
#define overmem overmem64
|
||||||
#define previous_closest_nsec previous_closest_nsec64
|
#define previous_closest_nsec previous_closest_nsec64
|
||||||
#define printnode printnode64
|
#define printnode printnode64
|
||||||
@ -6630,7 +6631,9 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
|
|
||||||
dns_fixedname_init(&fixed);
|
dns_fixedname_init(&fixed);
|
||||||
name = dns_fixedname_name(&fixed);
|
name = dns_fixedname_name(&fixed);
|
||||||
|
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
||||||
dns_rbt_fullnamefromnode(node, name);
|
dns_rbt_fullnamefromnode(node, name);
|
||||||
|
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
||||||
dns_rdataset_getownercase(rdataset, name);
|
dns_rdataset_getownercase(rdataset, name);
|
||||||
|
|
||||||
newheader = (rdatasetheader_t *)region.base;
|
newheader = (rdatasetheader_t *)region.base;
|
||||||
@ -8061,6 +8064,23 @@ getrrsetstats(dns_db_t *db) {
|
|||||||
return (rbtdb->rrsetstats);
|
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 = {
|
static dns_dbmethods_t zone_methods = {
|
||||||
attach,
|
attach,
|
||||||
detach,
|
detach,
|
||||||
@ -8104,7 +8124,8 @@ static dns_dbmethods_t zone_methods = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
hashsize
|
hashsize,
|
||||||
|
nodefullname
|
||||||
};
|
};
|
||||||
|
|
||||||
static dns_dbmethods_t cache_methods = {
|
static dns_dbmethods_t cache_methods = {
|
||||||
@ -8150,7 +8171,8 @@ static dns_dbmethods_t cache_methods = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
setcachestats,
|
setcachestats,
|
||||||
hashsize
|
hashsize,
|
||||||
|
nodefullname
|
||||||
};
|
};
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
@ -1289,7 +1289,8 @@ static dns_dbmethods_t sdb_methods = {
|
|||||||
findnodeext,
|
findnodeext,
|
||||||
findext,
|
findext,
|
||||||
NULL, /* setcachestats */
|
NULL, /* setcachestats */
|
||||||
NULL /* hashsize */
|
NULL, /* hashsize */
|
||||||
|
NULL /* nodefullname */
|
||||||
};
|
};
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
@ -1323,7 +1323,8 @@ static dns_dbmethods_t sdlzdb_methods = {
|
|||||||
findnodeext,
|
findnodeext,
|
||||||
findext,
|
findext,
|
||||||
NULL, /* setcachestats */
|
NULL, /* setcachestats */
|
||||||
NULL /* hashsize */
|
NULL, /* hashsize */
|
||||||
|
NULL /* nodefullname */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -227,6 +227,7 @@ dns_db_load2
|
|||||||
dns_db_load3
|
dns_db_load3
|
||||||
dns_db_newversion
|
dns_db_newversion
|
||||||
dns_db_nodecount
|
dns_db_nodecount
|
||||||
|
dns_db_nodefullname
|
||||||
dns_db_ondestroy
|
dns_db_ondestroy
|
||||||
dns_db_origin
|
dns_db_origin
|
||||||
dns_db_overmem
|
dns_db_overmem
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#include <dns/nsec3.h>
|
#include <dns/nsec3.h>
|
||||||
#include <dns/peer.h>
|
#include <dns/peer.h>
|
||||||
#include <dns/private.h>
|
#include <dns/private.h>
|
||||||
#include <dns/rbt.h>
|
|
||||||
#include <dns/rcode.h>
|
#include <dns/rcode.h>
|
||||||
#include <dns/rdata.h>
|
#include <dns/rdata.h>
|
||||||
#include <dns/rdataclass.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);
|
dns_rdataset_init(&temprdataset);
|
||||||
result = dns_rdatalist_tordataset(&temprdatalist, &temprdataset);
|
result = dns_rdatalist_tordataset(&temprdatalist, &temprdataset);
|
||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
dns_fixedname_init(&fixed);
|
dns_fixedname_init(&fixed);
|
||||||
name = dns_fixedname_name(&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_getownercase(rdataset, name);
|
||||||
dns_rdataset_setownercase(&temprdataset, name);
|
dns_rdataset_setownercase(&temprdataset, name);
|
||||||
return (dns_db_addrdataset(db, node, version, 0, &temprdataset,
|
return (dns_db_addrdataset(db, node, version, 0, &temprdataset,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user