Compare commits

...
25 Commits
Author SHA1 Message Date
Evan Hunt 7fb06d7518 add a compile-time option to select default zone and cache DB
by default, QPDB is the database used by named and all tools and
unit tests. the old default of RBTDB can now be restored by using
"configure --with-zonedb=rbt --with-cachedb-rbt".

some tests have been fixed so they will work correctly with either
database.

CHANGES and release notes have been updated to reflect this change.
2024-03-05 16:57:08 -08:00
Matthijs MekkingandEvan Hunt 49dad2c12e Fix xferquota system test
The change from RBT to QP has changed the contents of generated zone
files slightly: node names are now always absolute, so instead of using
$ORIGIN and relative names, generated zone files use full names for all
records.

This caused a failure in the xferquota system test, which was looking for a
relative name in secondary zone files. Replace the string matching with
a regular expression to fix the test.
2024-03-05 16:57:08 -08:00
Matthijs MekkingandEvan Hunt 3cd62b71e6 Fix race condition crash
When running resolver benchmark pipeline, a crash occurred:

https://gitlab.isc.org/isc-projects/bind9-shotgun-ci/-/pipelines/163946

In the code we are doing a lookup, it fails (meaning there is no node
with lookup name), we create the node and insert it and it fails.
But dns_qp_insert can only return ISC_R_SUCCESS or ISC_R_EXISTS.
So it must have been inserted in between. This is a race condition bug.

The first lookup only requires a write lock and if the lookup failed
the lock gets upgraded to a write lock and we insert the missing data.

To fix the race condition bug, we need to do a lookup again after we
have upgraded the lock to make sure it wasn't inserted in the mean
time.
2024-03-05 16:57:03 -08:00
Matthijs MekkingandEvan Hunt aae3d1064c Remove pruning tree code
Since qp-tries does not store interior nodes, we can remove all code
related to pruning the tree.
2024-03-05 16:54:11 -08:00
Matthijs MekkingandEvan Hunt 7aa6322eb8 Update rbtdb.c to make coccinelle happy
Applying semantic patch cocci/isc_mem_cget.spatch...
150 files match
diff -u -p a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c
--- a/lib/dns/rbtdb.c
+++ b/lib/dns/rbtdb.c
@@ -3801,16 +3801,15 @@ dns__rbtdb_create(isc_mem_t *mctx, const
		goto cleanup_tree_lock;
	}
	INSIST(rbtdb->node_lock_count < (1 << DNS_RBT_LOCKLENGTH));
-	rbtdb->node_locks = isc_mem_get(mctx, rbtdb->node_lock_count *
-						      sizeof(db_nodelock_t));
+	rbtdb->node_locks = isc_mem_cget(mctx, rbtdb->node_lock_count,
+					 sizeof(db_nodelock_t));

	rbtdb->common.update_listeners = cds_lfht_new(16, 16, 0, 0, NULL);

	if (IS_CACHE(rbtdb)) {
		dns_rdatasetstats_create(mctx, &rbtdb->rrsetstats);
-		rbtdb->lru = isc_mem_get(mctx,
-					 rbtdb->node_lock_count *
-						 sizeof(dns_slabheaderlist_t));
+		rbtdb->lru = isc_mem_cget(mctx, rbtdb->node_lock_count,
+					  sizeof(dns_slabheaderlist_t));
		for (i = 0; i < (int)rbtdb->node_lock_count; i++) {
			ISC_LIST_INIT(rbtdb->lru[i]);
		}
@@ -3819,8 +3818,8 @@ dns__rbtdb_create(isc_mem_t *mctx, const
	/*
	 * Create the heaps.
	 */
-	rbtdb->heaps = isc_mem_get(hmctx, rbtdb->node_lock_count *
-						  sizeof(isc_heap_t *));
+	rbtdb->heaps = isc_mem_cget(hmctx, rbtdb->node_lock_count,
+				    sizeof(isc_heap_t *));
	for (i = 0; i < (int)rbtdb->node_lock_count; i++) {
		rbtdb->heaps[i] = NULL;
	}
@@ -3834,8 +3833,8 @@ dns__rbtdb_create(isc_mem_t *mctx, const
	/*
	 * Create deadnode lists.
	 */
-	rbtdb->deadnodes = isc_mem_get(mctx, rbtdb->node_lock_count *
-						     sizeof(dns_qpdatalist_t));
+	rbtdb->deadnodes = isc_mem_cget(mctx, rbtdb->node_lock_count,
+					sizeof(dns_qpdatalist_t));
	for (i = 0; i < (int)rbtdb->node_lock_count; i++) {
		ISC_LIST_INIT(rbtdb->deadnodes[i]);
	}
2024-03-05 16:53:50 -08:00
Matthijs MekkingandEvan Hunt d3f41260af Add CHANGES and release notes for #4411
It is worthwile mentioning the switch to qp-tries.
2024-03-05 16:53:22 -08:00
Evan Hunt b156167620 add dns_db_nodefullname()
the dyndb test requires a mechanism to retrieve the name associated
with a database node, and since the database no longer uses RBT for
its underlying storage, dns_rbt_fullnamefromnode() doesn't work.
addressed this by adding dns_db_nodefullname() to the database API.
2024-03-05 16:53:22 -08:00
Matthijs MekkingandEvan Hunt 42be125727 Rework dbiterator implementation
If the iterator is paused, the tree is unlocked and may change.

In an RBT tree it's always possible to resume iteration as long
as a valid node pointer was still held, but now that the underlying
database structure is a QP trie, the iterator needs to be initialized
based on the existing structure of the trie or it will return
inconsistent results. We now call dns_qp_lookup() to reinitialize
the QP iterator whenever dbiterator_next() or dbiterator_prev() is
called on a paused iterator.
2024-03-05 16:53:20 -08:00
Evan Hunt 4b99ed8030 use masterfile-style full in tests where appropriate
the change from RBT to QP has changed the contents of generated zone
files slightly: node names are now always absolute, so instead of using
$ORIGIN and relative names, generated zone files use full names for all
records.

this caused a failure in the stub system test, which was grepping for a
relative name in a dumped zone file. using "masterfile-style full" makes
the test pass regardless of the database being used.
2024-03-05 16:52:54 -08:00
Matthijs MekkingandEvan Hunt d88a79c145 Improve node reference counting
QP database node data is not reference counted the same way RBT nodes
were: in the RBT, node->references could be zero if the node was in the
tree but was not in use by any caller, whereas in the QP trie, the
database itself uses reference counting of nodes internally.

this caused some subtle errors. in RBTDB, when the newref() function is
called and the node reference count was zero, the node lock reference
counter would also be incremented. in the QP trie, this can never
happen - because as long as the node is in the database its reference
count cannot be zero - and so the node lock reference counter was never
incremented.

reference counting will probably need to be refactored in more detail
later; the node lock reference count may not be needed at all.  but
for now, as a temporary measure, we add a third reference counter,
'erefs' (external references), to the dns_qpdata structure. this is
counted separately from the main reference counter, and should match
the node reference count as it would have been in RBTDB.

this change revealed a number of places where the node reference counter
was being incremented on behalf of a caller without newref() being
called; those were cleaned up as well.

This is an adaptation of commit 3dd686261d2c4bcd15a96ebfea10baffa277732b
2024-03-05 16:52:48 -08:00
Evan Hunt d39934b4f1 revise test for ENT NSEC3 cleanup
as a side effect of the switch from RBT to QBDB, NSEC3 records
are no longer created for empty non-terminal nodes when the
node only contains insecure delegations in an opt-out range.

such NSEC3 records are optional according to RFC 5155 (and,
for example, they are not created by dnssec-signzone), but they were
previously created by named, as a harmless side effect of the RBT
structure, which contains empty internal nodes that can be reached
by a DB iterator. these nodes are not present in the QPDB, so
NSEC3 records are not created unless they're actually required.

the autosign system test contained a test case (added in commit
ad91a70d as part of GL #4027) that checked whether ENT NSEC3
records were deleted when the delegations under the ENT removed.
this test no longer passes, because the NSEC3's are not created
in the first place, and therefore cannot be removed.

rather than "fix" the QPDB to add unnecessary NSEC3 records, this
commit instead revises the test to check for removal of ENT NSEC3
records when *not* using opt-out.
2024-03-05 16:52:45 -08:00
Matthijs MekkingandEvan Hunt a9a47938eb No special logic for relative names 2024-03-05 16:52:43 -08:00
Matthijs MekkingandEvan Hunt 6e9e352068 Change free_gluetable
Fixes a crash at shutdown.
2024-03-05 16:52:27 -08:00
Matthijs MekkingandEvan Hunt 394e0f1ddc Calculating hashsize is obsolete
We don't have hash tables for qp.
2024-03-05 16:52:26 -08:00
Matthijs MekkingandEvan Hunt 996e3b7cee Add proper qp cleanup
Fix reference counting: unreference nodes that are succesfully inserted
in the tree, detach created nodes, and cleanup the interior data in
dns_qpdata_destroy().
2024-03-05 16:52:26 -08:00
Matthijs MekkingandEvan Hunt 94540dc8e9 Replace dns_rbtnode_t with dns_qpdata_t
This for now has almost the same structure contents except for
dns_qpdata_t has 'fn' and 'name' to store the domain name.
2024-03-05 16:52:22 -08:00
Matthijs MekkingandEvan Hunt 76820a8d29 Replace dns_rbt_nodecount with dns_qp_memusage
We now count the nodes by getting the memory usage and return the
number of leaves.
2024-03-05 16:50:36 -08:00
Matthijs MekkingandEvan Hunt 87c456d1c0 Replace dns_rbt_namefromnode with dns_name_copy
The name will be stored inside the node now so we can just copy it.

These are leftovers, most of the namefromnode code has been replaced
already in previous commits.
2024-03-05 16:50:30 -08:00
Matthijs MekkingandEvan Hunt a32fa928c2 Replace rbtnodechain with qpchain and qpiter
The qp approach pulled apart the chain and iterator into two separate
things. Replace the rbtnodechain with qpchain and qpiter. Most of the
times we are interested in the iterator only, the rbtnodechain was
mainly used as an an iterator to get the previous and next name in the
DNS canonical order.

Since dns_qpiter_prev() and dns_qpiter_next() store the name, origin,
and node in the provided parameters, often there is no need to call
a current() function anymore.

Getting the first or last item from the iterator is done by
re-initializing the iterator and then call dns_qpiter_next() or
dns_qpiter_prev() respectively.

The dbiterator no longer needs to maintain a chain, only an iterator.
2024-03-05 16:50:20 -08:00
Matthijs MekkingandEvan Hunt 2627d8fb69 Replace rbt_findnode with qp_lookup
All dns_qp_lookup() calls assume it is okay to find empty data, so
we don't need to do anything special for the DNS_RBTFIND_EMPTYDATA.

You can pass a callback function to dns_rbt_findnode(), something that
qp does not support. Instead, call the function afterwards. This has
the drawback that we do more lookup work if there was a zonecut.

With dns_qp_lookup() we also don't pass any options. In this case,
when DNS_RBTFIND_NOEXACT was set, we adapt the result after the lookup.
2024-03-05 16:49:08 -08:00
Matthijs MekkingandEvan Hunt cf1930d9ae Replace rbt_deletenode with qp_deletename
Replace dns_rbt_deletenode calls with dns_qp_deletename. For removing
the name from the nsec tree, we no longer first have to find it: we can
just remove the key (retrieved by name).
2024-03-05 16:48:49 -08:00
Matthijs MekkingandEvan Hunt 09042cf347 Replace rbt_addnode with qp_insert
Replace dns_rbt_addnode calls with dns_qp_insert. With QP, it sometimes
makes more sense to first lookup the name and see if there is an
existing node (rather than create new data, insert, find out a node
already exists, and destroy the data again). This is done with
dns_qp_getname(), which is more lightweight than dns_qp_lookup(),
and we are only interested in if there is already a leaf node for this
name or not.
2024-03-05 16:48:40 -08:00
Evan Hunt d705175819 switch database defaults from "rbt" to "qp"
replace the string "rbt" throughout BIND with "qp" so that
qpdb databases will be used by default instead of rbtdb.
rbtdb databases can still be used by specifying "database rbt;"
in a zone statement.
2024-03-05 16:48:12 -08:00
Evan Hunt 6a005bc6e8 rename dns_rbtdb to dns_qpdb
this commit renames all variables and macros with the string "rbtdb"
or "RBDTB" to "qpdb" or "QPDB".
2024-03-05 16:47:50 -08:00
Matthijs MekkingandEvan Hunt 151e85ae31 Begin replacement of rbt with qp in rbtdb
- Copy rbtdb.c, rbt-zonedb.c and rbt-cachedb.c to qp-*.
- Added qpmethods.
- Added a new structure dns_qpdata that will replace dns_rbtnode.
- Replaced normal, nsec, and nsec3 dns_rbt trees with dns_qp tries.
- Replaced dns_rbt_create() calls with dns_qp_create().
- Replaced the dns_rbt_destroy() call with dns_qp_destroy().
- Create a dns_qpdata struct and create/destroy methods.

This commit will not build.
2024-03-05 15:47:59 -08:00
47 changed files with 9777 additions and 145 deletions
+30 -1
View File
@@ -1,3 +1,31 @@
6354. [func] The red-black tree structure underlying the
RBTDB has been replaced with QP-tries. This is
expected to improve scalability and reduce
CPU consumption under load. It is currently known to
have higher memory consumption than the traditional
RBTDB; this will be addressed in future releases.
Nodes in a QP-trie contain the full domain name,
while nodes in a red-black tree only contain names
relative to a parent. Because of this difference,
zone files dumped with masterfile-style "relative"
will no longer have multiple different $ORIGIN
statements throughout the file.
This version is a minimal adaptation, keeping RBTDB
code largely unchanged, except as needed to replace
the underlying data structure. It uses the
single-thread "dns_qp" interface with locks for
synchronization. A future version will use the
multithreaded "dns_qpmulti" interface instead,
and will be renamed to QPDB.
The RBT-based version of RBTDB is still in place
for now, and can be used by specifying "database rbt"
in a "zone" statement, or by compiling with
"configure --with-zonedb=rbt --with-cachedb=rbt".
[GL #4411]
6353. [bug] Improve the TTL-based cleaning by removing the expired
headers from the heap, so they don't block the next
cleaning round and clean more than a single item for
@@ -29,7 +57,8 @@
6345. [bug] Added missing dns_rdataset_disassociate calls in
validator.c:findnsec3proofs. [GL #4571]
6344. [placeholder]
6344. [bug] Fix case insensitive setting for isc_ht hashtable.
[GL #4568]
6343. [bug] Fix case insensitive setting for isc_ht hashtable.
[GL #4568]
+1 -1
View File
@@ -73,7 +73,7 @@
#define ERR_IS_MXCNAME 6
#define ERR_IS_SRVCNAME 7
static const char *dbtype[] = { "rbt" };
static const char *dbtype[] = { ZONEDB_DEFAULT };
int debug = 0;
const char *journal = NULL;
+3 -1
View File
@@ -242,7 +242,9 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
* Skip checks when using an alternate data source.
*/
cfg_map_get(zoptions, "database", &dbobj);
if (dbobj != NULL && strcmp("rbt", cfg_obj_asstring(dbobj)) != 0) {
if (dbobj != NULL &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(dbobj)) != 0)
{
return (ISC_R_SUCCESS);
}
+4 -4
View File
@@ -247,8 +247,8 @@ static void
load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
isc_result_t result;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, dbp);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, dns_masterformat_text,
@@ -979,8 +979,8 @@ update_diff(const char *cmd, uint32_t ttl, dns_rdataset_t *addset,
dns_rdataset_t diffset;
uint32_t save;
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &update_db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &update_db);
check_result(result, "dns_db_create()");
result = dns_db_newversion(update_db, &update_version);
+2 -2
View File
@@ -100,8 +100,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
+2 -2
View File
@@ -103,8 +103,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
dns_name_format(name, setname, sizeof(setname));
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS) {
fatal("can't create database");
}
+6 -6
View File
@@ -998,8 +998,8 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
}
isc_buffer_putuint8(&b, 0);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
rdclass, 0, NULL, dbp);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, inputformat, DNS_MASTER_HINT);
@@ -2572,8 +2572,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0);
@@ -3162,8 +3162,8 @@ writeset(const char *prefix, dns_rdatatype_t type) {
dns_diff_append(&diff, &tuple);
}
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
gclass, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, gclass, 0, NULL, &db);
check_result(result, "dns_db_create");
result = dns_db_newversion(db, &dbversion);
+2 -2
View File
@@ -109,8 +109,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_result_totext(result));
}
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, rdclass, 0,
NULL, db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
rdclass, 0, NULL, db);
check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0);
+7 -7
View File
@@ -3377,7 +3377,7 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
const cfg_obj_t *obj;
const cfg_obj_t *zconfig;
const cfg_obj_t *zoptions;
const char *rbt_dbtype[4] = { "rbt" };
const char *default_dbtype[4] = { ZONEDB_DEFAULT };
const char *sep = ": view ";
const char *str;
const char *viewname = view->name;
@@ -3390,7 +3390,7 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
dns_name_t *ns;
dns_name_t *zname;
dns_zone_t *zone = NULL;
int rbt_dbtypec = 1;
int default_dbtypec = 1;
isc_result_t result;
dns_namereln_t namereln;
int order;
@@ -3432,7 +3432,7 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
}
}
if (db == NULL) {
CHECK(dns_db_create(view->mctx, "rbt", name,
CHECK(dns_db_create(view->mctx, ZONEDB_DEFAULT, name,
dns_dbtype_zone, view->rdclass, 0,
NULL, &db));
CHECK(dns_db_newversion(db, &version));
@@ -3452,15 +3452,15 @@ create_empty_zone(dns_zone_t *pzone, dns_name_t *name, dns_view_t *view,
}
/*
* Is the existing zone the ok to use?
* Is the existing zone ok to use?
*/
if (pzone != NULL) {
unsigned int typec;
const char **dbargv;
const char **dbargv = NULL;
if (db != NULL) {
typec = rbt_dbtypec;
dbargv = rbt_dbtype;
typec = default_dbtypec;
dbargv = default_dbtype;
} else {
typec = empty_dbtypec;
dbargv = empty_dbtype;
+1 -1
View File
@@ -885,7 +885,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
uint32_t count;
unsigned int dbargc;
char **dbargv;
static char default_dbtype[] = "rbt";
static char default_dbtype[] = ZONEDB_DEFAULT;
static char dlz_dbtype[] = "dlz";
char *cpval = default_dbtype;
isc_mem_t *mctx = dns_zone_getmctx(zone);
+1 -1
View File
@@ -35,7 +35,7 @@ rm -f ns2/child.nsec3.example.db
rm -f ns2/child.optout.example.db
rm -f ns2/example.db
rm -f ns2/insecure.secure.example.db
rm -f ns2/optout-with-ent.db
rm -f ns2/nsec3-with-ent.db
rm -f ns2/private.secure.example.db
rm -f ns2/signing.*
rm -f ns3/*.nzd ns3/*.nzd-lock ns3/*.nzf
+3 -3
View File
@@ -55,9 +55,9 @@ $DSFROMKEY Kbar.+013+60101.key >dsset-bar.
$SIGNER -S -o bar. -O full $zonefile >signing.bar.out 2>&1
# a zone with empty non-terminals.
zone=optout-with-ent
zonefile=optout-with-ent.db
infile=optout-with-ent.db.in
zone=nsec3-with-ent
zonefile=nsec3-with-ent.db
infile=nsec3-with-ent.db.in
cat $infile >$zonefile
kskname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -3 -q -fk $zone)
$KEYGEN -a ${DEFAULT_ALGORITHM} -3 -q $zone >/dev/null
+3 -3
View File
@@ -134,14 +134,14 @@ zone "child.optout.example" {
dnssec-policy optout;
};
zone "optout-with-ent" {
zone "nsec3-with-ent" {
type primary;
file "optout-with-ent.db";
file "nsec3-with-ent.db";
allow-query { any; };
allow-transfer { any; };
allow-update { any; };
inline-signing no;
dnssec-policy optout;
dnssec-policy nsec3;
};
include "trusted.conf";
+3 -3
View File
@@ -1270,9 +1270,9 @@ n=$((n + 1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "check removal of ENT NSEC3 records when opt out delegations are removed ($n)"
zone=optout-with-ent
hash=JE76PJ65FUO86UIR594L8P0SNJJ6RMNI
echo_i "check removal of ENT NSEC3 records when delegations are removed ($n)"
zone=nsec3-with-ent
hash=M9SFFA181BCTR8D18LQUPST4N6BL304D
# check that NSEC3 for ENT is present
echo_i "check ENT NSEC3 is initially present"
+15 -18
View File
@@ -76,21 +76,6 @@ struct sampledb {
typedef struct sampledb sampledb_t;
/*
* Get full DNS name from the node.
*
* @warning
* The code silently expects that "node" came from RBTDB and thus
* assumption dns_dbnode_t (from RBTDB) == dns_rbtnode_t is correct.
*
* This should work as long as we use only RBTDB and nothing else.
*/
static isc_result_t
sample_name_fromnode(dns_dbnode_t *node, dns_name_t *name) {
dns_rbtnode_t *rbtnode = (dns_rbtnode_t *)node;
return (dns_rbt_fullnamefromnode(rbtnode, name));
}
static void
destroy(dns_db_t *db) {
sampledb_t *sampledb = (sampledb_t *)db;
@@ -252,7 +237,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
if (rdataset->type == dns_rdatatype_a ||
rdataset->type == dns_rdatatype_aaaa)
{
CHECK(sample_name_fromnode(node, dns_fixedname_name(&name)));
CHECK(dns_db_nodefullname(sampledb->rbtdb, node,
dns_fixedname_name(&name)));
CHECK(syncptrs(sampledb->inst, dns_fixedname_name(&name),
rdataset, DNS_DIFFOP_ADD));
}
@@ -282,7 +268,8 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
if (rdataset->type == dns_rdatatype_a ||
rdataset->type == dns_rdatatype_aaaa)
{
CHECK(sample_name_fromnode(node, dns_fixedname_name(&name)));
CHECK(dns_db_nodefullname(sampledb->rbtdb, node,
dns_fixedname_name(&name)));
CHECK(syncptrs(sampledb->inst, dns_fixedname_name(&name),
rdataset, DNS_DIFFOP_DEL));
}
@@ -431,6 +418,15 @@ setcachestats(dns_db_t *db, isc_stats_t *stats) {
return (dns_db_setcachestats(sampledb->rbtdb, stats));
}
static isc_result_t
nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name) {
sampledb_t *sampledb = (sampledb_t *)db;
REQUIRE(VALID_SAMPLEDB(sampledb));
return (dns_db_nodefullname(sampledb->rbtdb, node, name));
}
/*
* DB interface definition. Database driver uses this structure to
* determine which implementation of dns_db_*() function to call.
@@ -464,6 +460,7 @@ static dns_dbmethods_t sampledb_methods = {
.findnodeext = findnodeext,
.findext = findext,
.setcachestats = setcachestats,
.nodefullname = nodefullname,
};
/* Auxiliary driver functions. */
@@ -625,7 +622,7 @@ create_db(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
sampledb->inst = driverarg;
/* Create internal instance of RBT DB implementation from BIND. */
CHECK(dns_db_create(mctx, "rbt", origin, dns_dbtype_zone,
CHECK(dns_db_create(mctx, "qp", origin, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &sampledb->rbtdb));
/* Create fake SOA, NS, and A records to make database loadable. */
+1 -1
View File
@@ -67,7 +67,7 @@ loadzone(dns_db_t **db, const char *origin, const char *filename) {
return (result);
}
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
result = dns_db_create(mctx, ZONEDB_DEFAULT, name, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, db);
if (result != ISC_R_SUCCESS) {
return (result);
+2 -1
View File
@@ -19,7 +19,7 @@ options {
pid-file "named.pid";
listen-on { 10.53.0.5; };
listen-on-v6 { none; };
dnssec-validation no;
dnssec-validation no;
};
zone "." {
@@ -30,5 +30,6 @@ zone "." {
zone "example" {
type stub;
file "example.db";
masterfile-style full;
primaries { 10.53.0.4 port @PORT@; };
};
+2 -2
View File
@@ -85,8 +85,8 @@ if [ -f ns5/example.db ]; then
$DIG $DIGOPTS +nodnssec @10.53.0.5 target.example. txt >dig.out.ns5 || ret=1
grep 'target\.example.*TXT.*"test"' dig.out.ns5 >/dev/null || ret=1
# Ensure both ipv4 and ipv6 glue records were transferred.
grep -E 'ns4[[:space:]]+A[[:space:]]+10.53.0.4' ns5/example.db >/dev/null || ret=1
grep -E 'AAAA[[:space:]]+fd92:7065:b8e:ffff::4' ns5/example.db >/dev/null || ret=1
grep -E 'ns4.example.[[:space:]]+300 IN A[[:space:]]+10.53.0.4' ns5/example.db >/dev/null || ret=1
grep -E 'ns4.example.[[:space:]]+300 IN AAAA[[:space:]]+fd92:7065:b8e:ffff::4' ns5/example.db >/dev/null || ret=1
[ $ret = 0 ] || {
status=1
echo_i "failed"
@@ -36,7 +36,7 @@ def test_xferquota(named_port, servers):
with open(file_path, "r", encoding="utf-8") as zonefile:
# Count the number of lines containing the search string
for line in zonefile:
if "xyzzy A 10.0.0.2" in line:
if re.search(r"xyzzy.zone[0-9]+.example.*A\s+10\.0\.0\.2", line):
matching_line_count += 1
return matching_line_count == 300
+35
View File
@@ -1569,6 +1569,35 @@ AS_IF([test -z "$DTRACE"],
AC_SUBST([DTRACE])
#
# Which should be the default zone database, RBTDB or QPDB?
# [pairwise: --with-zonedb=qp, --with-zonedb=rbt]
#
AC_ARG_WITH([zonedb],
[AS_HELP_STRING([--with-zonedb=detect],[specify default zone database type (default is "qp")])],
[],[with_zonedb=qp])
zonedb="qp"
AS_CASE([$with_zonedb],
[RBT*|rbt*],[zonedb="rbt"],
[QP*|qp*],[],
[AC_MSG_ERROR([Unknown zone database type])]
)
AC_DEFINE_UNQUOTED([ZONEDB_DEFAULT], ["$zonedb"], [Default zone database type])
#
# Which should be the default cache database, RBTDB or QPDB?
# [pairwise: --with-cachedb=qp, --with-cachedb=rbt]
#
AC_ARG_WITH([cachedb],
[AS_HELP_STRING([--with-cachedb=detect],[specify default zone database type (default is "qp")])],
[],[with_cachedb=qp])
cachedb="qp"
AS_CASE([$with_cachedb],
[RBT*|rbt*],[cachedb="rbt"],
[QP*|qp*],[],
[AC_MSG_ERROR([Unknown zone database type])]
)
AC_DEFINE_UNQUOTED([CACHEDB_DEFAULT], ["$cachedb"], [Default cache database type])
#
# Files to configure. These are listed here because we used to
@@ -1668,6 +1697,12 @@ report() {
if test "yes" = "$with_jemalloc"; then
echo " Memory allocator: jemalloc"
fi
if test "yes" = "$enable_full_report" -o "rbt" = "$zonedb"; then
echo " Default zone database type: $zonedb"
fi
if test "yes" = "$enable_full_report" -o "rbt" = "$zonedb"; then
echo " Default cache database type: $cachedb"
fi
if test "yes" = "$enable_full_report" -o "standard" = "$with_locktype"; then
echo " Mutex lock type: $with_locktype"
fi
+17
View File
@@ -53,6 +53,23 @@ Feature Changes
operationally required, then please consider using ``dnssec-validation auto``
instead. :gl:`#4373`
- The red-black tree data structure used in the RBTDB (the default
database implementation for cache and zone databases),
has been replaced with QP-tries. This is expected to improve
performance and scalability, though in the current implementation
it is known to have larger memory consumption.
A side effect of this change is that zone files that are created with
:any:`masterfile-style` ``relative`` - for example, the output of
:any:`dnssec-signzone` - will no longer have multiple different
`$ORIGIN` statements. There should be no other changes to server
behavior.
The old RBT-based database still exists for now, and can be used by
specifying ``database rbt`` in a ``zone`` statement in ``named.conf``,
or by compiling with ``configure --with-zonedb=rbt --with-cachedb=rbt``.
:gl:`#4411`.
Bug Fixes
~~~~~~~~~
+3 -2
View File
@@ -49,8 +49,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
dns_db_t *db = NULL;
isc_mem_create(&mctx);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db);
if (result != ISC_R_SUCCESS) {
return 0;
}
+5 -1
View File
@@ -219,8 +219,12 @@ libdns_la_SOURCES = \
rbt.c \
rbt-cachedb.c \
rbt-zonedb.c \
rbtdb_p.h \
rbtdb.c \
rbtdb_p.h \
qp-cachedb.c \
qp-zonedb.c \
qpdb_p.h \
qpdb.c \
rcode.c \
rdata.c \
rdatalist.c \
+2 -2
View File
@@ -90,12 +90,12 @@ cache_create_db(dns_cache_t *cache, dns_db_t **db) {
char *argv[1] = { 0 };
/*
* For databases of type "rbt" (which is the only cache
* For databases of type "qp" (which is the only cache
* implementation currently in existence) we pass hmctx to
* dns_db_create() via argv[0].
*/
argv[0] = (char *)cache->hmctx;
result = dns_db_create(cache->mctx, "rbt", dns_rootname,
result = dns_db_create(cache->mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, cache->rdclass, 1, argv, db);
if (result == ISC_R_SUCCESS) {
dns_db_setservestalettl(*db, cache->serve_stale_ttl);
+3 -2
View File
@@ -216,8 +216,9 @@ createview(isc_mem_t *mctx, dns_rdataclass_t rdclass, isc_loopmgr_t *loopmgr,
CHECK(dns_view_createresolver(view, loopmgr, nm, 0, tlsctx_client_cache,
dispatchv4, dispatchv6));
CHECK(dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
rdclass, 0, NULL, &view->cachedb));
CHECK(dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, rdclass, 0, NULL,
&view->cachedb));
*viewp = view;
return (ISC_R_SUCCESS);
+29 -7
View File
@@ -62,6 +62,7 @@ struct dns_dbimplementation {
*/
#include "db_p.h"
#include "qpdb_p.h"
#include "rbtdb_p.h"
unsigned int dns_pps = 0U;
@@ -71,19 +72,28 @@ static isc_rwlock_t implock;
static isc_once_t once = ISC_ONCE_INIT;
static dns_dbimplementation_t rbtimp;
static dns_dbimplementation_t qpimp;
static void
initialize(void) {
isc_rwlock_init(&implock);
rbtimp.name = "rbt";
rbtimp.create = dns__rbtdb_create;
rbtimp.mctx = NULL;
rbtimp.driverarg = NULL;
ISC_LINK_INIT(&rbtimp, link);
ISC_LIST_INIT(implementations);
rbtimp = (dns_dbimplementation_t){
.name = "rbt",
.create = dns__rbtdb_create,
.link = ISC_LINK_INITIALIZER,
};
qpimp = (dns_dbimplementation_t){
.name = "qp",
.create = dns__qpdb_create,
.link = ISC_LINK_INITIALIZER,
};
ISC_LIST_APPEND(implementations, &rbtimp, link);
ISC_LIST_APPEND(implementations, &qpimp, link);
}
static dns_dbimplementation_t *
@@ -132,7 +142,7 @@ dns_db_create(isc_mem_t *mctx, const char *db_type, const dns_name_t *origin,
#if DNS_DB_TRACE
fprintf(stderr, "dns_db_create:%s:%s:%d:%p->references = 1\n",
__func__, __FILE__, __LINE__ + 1, *dbp);
__func__, __FILE__, __LINE__ 1, *dbp);
#endif
return (result);
}
@@ -1139,3 +1149,15 @@ dns_db_deletedata(dns_db_t *db, dns_dbnode_t *node, void *data) {
(db->methods->deletedata)(db, node, data);
}
}
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 ((db->methods->nodefullname)(db, node, name));
}
return (ISC_R_NOTIMPLEMENTED);
}
+12 -2
View File
@@ -179,6 +179,8 @@ typedef struct dns_dbmethods {
dns_rdataset_t *rdataset, dns_message_t *msg);
void (*expiredata)(dns_db_t *db, dns_dbnode_t *node, void *data);
void (*deletedata)(dns_db_t *db, dns_dbnode_t *node, void *data);
isc_result_t (*nodefullname)(dns_db_t *db, dns_dbnode_t *node,
dns_name_t *name);
} dns_dbmethods_t;
typedef isc_result_t (*dns_dbcreatefunc_t)(isc_mem_t *mctx,
@@ -1782,6 +1784,14 @@ dns_db_deletedata(dns_db_t *db, dns_dbnode_t *node, void *data);
* data from an LRU list or a heap.
*/
void
dns_db_expiredata(dns_db_t *db, dns_dbnode_t *node, void *data);
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
+9 -5
View File
@@ -130,6 +130,8 @@ typedef struct dns_slabheader_proof dns_slabheader_proof_t;
typedef struct dns_rbt dns_rbt_t;
typedef struct dns_rbtdb dns_rbtdb_t;
typedef struct dns_rbtdb_version dns_rbtdb_version_t;
typedef struct dns_qpdb dns_qpdb_t;
typedef struct dns_qpdb_version dns_qpdb_version_t;
typedef struct dns_rbtnode dns_rbtnode_t;
typedef ISC_LIST(dns_rbtnode_t) dns_rbtnodelist_t;
typedef uint16_t dns_rcode_t;
@@ -146,11 +148,13 @@ typedef struct dns_request dns_request_t;
typedef struct dns_requestmgr dns_requestmgr_t;
typedef struct dns_resolver dns_resolver_t;
typedef struct dns_rpsdb dns_rpsdb_t;
typedef struct dns_qpnode dns_qpnode_t;
typedef uint8_t dns_secalg_t;
typedef uint8_t dns_secproto_t;
typedef struct dns_signature dns_signature_t;
typedef struct dns_slabheader dns_slabheader_t;
typedef struct dns_qpdata dns_qpdata_t;
typedef ISC_LIST(dns_qpdata_t) dns_qpdatalist_t;
typedef struct dns_qpnode dns_qpnode_t;
typedef uint8_t dns_secalg_t;
typedef uint8_t dns_secproto_t;
typedef struct dns_signature dns_signature_t;
typedef struct dns_slabheader dns_slabheader_t;
typedef ISC_LIST(dns_slabheader_t) dns_slabheaderlist_t;
typedef struct dns_sortlist_arg dns_sortlist_arg_t;
typedef struct dns_ssurule dns_ssurule_t;
+1695
View File
File diff suppressed because it is too large Load Diff
+2489
View File
File diff suppressed because it is too large Load Diff
+4732
View File
File diff suppressed because it is too large Load Diff
+585
View File
@@ -0,0 +1,585 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
#include <isc/heap.h>
#include <isc/lang.h>
#include <isc/urcu.h>
#include <dns/nsec3.h>
#include <dns/qp.h>
#include <dns/rbt.h>
#include <dns/types.h>
/*%
* Note that "impmagic" is not the first four bytes of the struct, so
* ISC_MAGIC_VALID cannot be used.
*/
#define QPDB_MAGIC ISC_MAGIC('Q', 'P', 'D', '4')
#define VALID_QPDB(qpdb) \
((qpdb) != NULL && (qpdb)->common.impmagic == QPDB_MAGIC)
#define QPDB_HEADERNODE(h) ((dns_qpdata_t *)((h)->node))
/*
* Allow clients with a virtual time of up to 5 minutes in the past to see
* records that would have otherwise have expired.
*/
#define QPDB_VIRTUAL 300
/*****
***** Module Info
*****/
/*! \file
* \brief
* DNS QPDB Implementation (minimally adapted from RBTDB)
*/
ISC_LANG_BEGINDECLS
/*%
* This is the structure that is used for each node in the qp trie of trees.
* For now it is a copy of the dns_rbtnode structure.
*/
struct dns_qpdata {
unsigned int magic;
/*@{*/
/*!
* The following bitfields add up to a total bitwidth of 32.
* The range of values necessary for each item is indicated.
*
* In each case below the "range" indicated is what's _necessary_ for
* the bitfield to hold, not what it actually _can_ hold.
*
* Note: Tree lock must be held before modifying these
* bit-fields.
*
* Note: The two "unsigned int :0;" unnamed bitfields on either
* side of the bitfields below are scaffolding that border the
* set of bitfields which are accessed after acquiring the tree
* lock. Please don't insert any other bitfield members between
* the unnamed bitfields unless they should also be accessed
* after acquiring the tree lock.
*/
unsigned int : 0; /* start of bitfields c/o tree lock */
unsigned int is_root : 1; /*%< range is 0..1 */
unsigned int color : 1; /*%< range is 0..1 */
unsigned int find_callback : 1; /*%< range is 0..1 */
bool absolute : 1; /*%< node with absolute DNS name */
unsigned int nsec : 2; /*%< range is 0..3 */
unsigned int namelen : 8; /*%< range is 1..255 */
unsigned int offsetlen : 8; /*%< range is 1..128 */
unsigned int oldnamelen : 8; /*%< range is 1..255 */
unsigned int : 0; /* end of bitfields c/o tree lock */
/*@}*/
/*%
* This is needed for hashing.
*/
unsigned int hashval;
dns_fixedname_t fn;
dns_name_t *name;
isc_mem_t *mctx;
/*%
* Used for LRU cache. This linked list is used to mark nodes which
* have no data any longer, but we cannot unlink at that exact moment
* because we did not or could not obtain a write lock on the tree.
*/
ISC_LINK(dns_qpdata_t) deadlink;
/*@{*/
/*!
* These values are used in the RBT DB implementation. The appropriate
* node lock must be held before accessing them.
*
* Note: The two "unsigned int :0;" unnamed bitfields on either
* side of the bitfields below are scaffolding that border the
* set of bitfields which are accessed after acquiring the node
* lock. Please don't insert any other bitfield members between
* the unnamed bitfields unless they should also be accessed
* after acquiring the node lock.
*
* NOTE: Do not merge these fields into bitfields above, as
* they'll all be put in the same qword that could be accessed
* without the node lock as it shares the qword with other
* members. Leave these members here so that they occupy a
* separate region of memory.
*/
void *data;
uint8_t : 0; /* start of bitfields c/o node lock */
uint8_t dirty : 1;
uint8_t wild : 1;
uint8_t : 0; /* end of bitfields c/o node lock */
uint16_t locknum; /* note that this is not in the bitfield */
isc_refcount_t references;
isc_refcount_t erefs;
/*@}*/
};
typedef struct qpdb_changed {
dns_qpdata_t *node;
bool dirty;
ISC_LINK(struct qpdb_changed) link;
} qpdb_changed_t;
typedef ISC_LIST(qpdb_changed_t) qpdb_changedlist_t;
struct dns_qpdb_version {
/* Not locked */
uint32_t serial;
dns_qpdb_t *qpdb;
/*
* Protected in the refcount routines.
* XXXJT: should we change the lock policy based on the refcount
* performance?
*/
isc_refcount_t references;
/* Locked by database lock. */
bool writer;
bool commit_ok;
qpdb_changedlist_t changed_list;
dns_slabheaderlist_t resigned_list;
ISC_LINK(dns_qpdb_version_t) link;
bool secure;
bool havensec3;
/* NSEC3 parameters */
dns_hash_t hash;
uint8_t flags;
uint16_t iterations;
uint8_t salt_length;
unsigned char salt[DNS_NSEC3_SALTSIZE];
/*
* records and xfrsize are covered by rwlock.
*/
isc_rwlock_t rwlock;
uint64_t records;
uint64_t xfrsize;
struct cds_wfs_stack glue_stack;
};
typedef ISC_LIST(dns_qpdb_version_t) qpdb_versionlist_t;
struct dns_qpdb {
/* Unlocked. */
dns_db_t common;
/* Locks the data in this struct */
isc_rwlock_t lock;
/* Locks the tree structure (prevents nodes appearing/disappearing) */
isc_rwlock_t tree_lock;
/* Locks for individual tree nodes */
unsigned int node_lock_count;
db_nodelock_t *node_locks;
dns_qpdata_t *origin_node;
dns_qpdata_t *nsec3_origin_node;
dns_stats_t *rrsetstats; /* cache DB only */
isc_stats_t *cachestats; /* cache DB only */
isc_stats_t *gluecachestats; /* zone DB only */
/* Locked by lock. */
unsigned int active;
unsigned int attributes;
uint32_t current_serial;
uint32_t least_serial;
uint32_t next_serial;
dns_qpdb_version_t *current_version;
dns_qpdb_version_t *future_version;
qpdb_versionlist_t open_versions;
isc_loop_t *loop;
dns_dbnode_t *soanode;
dns_dbnode_t *nsnode;
/*
* The time after a failed lookup, where stale answers from cache
* may be used directly in a DNS response without attempting a
* new iterative lookup.
*/
uint32_t serve_stale_refresh;
/*
* This is an array of linked lists used to implement the LRU cache.
* There will be node_lock_count linked lists here. Nodes in bucket 1
* will be placed on the linked list lru[1].
*/
dns_slabheaderlist_t *lru;
/*
* Start point % node_lock_count for next LRU cleanup.
*/
atomic_uint lru_sweep;
/*
* When performing LRU cleaning limit cleaning to headers that were
* last used at or before this.
*/
_Atomic(isc_stdtime_t) last_used;
/*%
* Temporary storage for stale cache nodes and dynamically deleted
* nodes that await being cleaned up.
*/
dns_qpdatalist_t *deadnodes;
/*
* Heaps. These are used for TTL based expiry in a cache,
* or for zone resigning in a zone DB. hmctx is the memory
* context to use for the heap (which differs from the main
* database memory context in the case of a cache).
*/
isc_mem_t *hmctx;
isc_heap_t **heaps;
isc_heapcompare_t sooner;
/* Locked by tree_lock. */
dns_qp_t *tree;
dns_qp_t *nsec;
dns_qp_t *nsec3;
/* Unlocked */
unsigned int quantum;
};
/*%
* Search Context
*/
typedef struct {
dns_qpdb_t *qpdb;
dns_qpdb_version_t *rbtversion;
uint32_t serial;
unsigned int options;
dns_qpchain_t chain;
dns_qpiter_t iter;
bool copy_name;
bool need_cleanup;
bool wild;
dns_qpdata_t *zonecut;
dns_slabheader_t *zonecut_header;
dns_slabheader_t *zonecut_sigheader;
dns_fixedname_t zonecut_name;
isc_stdtime_t now;
} qpdb_search_t;
/*%
* Load Context
*/
typedef struct {
dns_db_t *db;
isc_stdtime_t now;
} qpdb_load_t;
/*%
* Prune context
*/
typedef struct {
dns_db_t *db;
dns_qpdata_t *node;
} qpdb_prune_t;
extern dns_dbmethods_t dns__qpdb_zonemethods;
extern dns_dbmethods_t dns__qpdb_cachemethods;
/*
* Common DB implementation methods shared by both cache and zone RBT
* databases:
*/
isc_result_t
dns__qpdb_create(isc_mem_t *mctx, const dns_name_t *base, dns_dbtype_t type,
dns_rdataclass_t rdclass, unsigned int argc, char *argv[],
void *driverarg, dns_db_t **dbp);
/*%<
* Create a new database of type "qp". Called via dns_db_create();
* see documentation for that function for more details.
*
* If argv[0] is set, it points to a valid memory context to be used for
* allocation of heap memory. Generally this is used for cache databases
* only.
*
* Requires:
*
* \li argc == 0 or argv[0] is a valid memory context.
*/
void
dns__qpdb_destroy(dns_db_t *arg);
/*%<
* Implement dns_db_destroy() for RBT databases, see documentation
* for that function for more details.
*/
void
dns__qpdb_currentversion(dns_db_t *db, dns_dbversion_t **versionp);
isc_result_t
dns__qpdb_newversion(dns_db_t *db, dns_dbversion_t **versionp);
void
dns__qpdb_attachversion(dns_db_t *db, dns_dbversion_t *source,
dns_dbversion_t **targetp);
void
dns__qpdb_closeversion(dns_db_t *db, dns_dbversion_t **versionp,
bool commit DNS__DB_FLARG);
/*%<
* Implement the dns_db_currentversion(), _newversion(),
* _attachversion() and _closeversion() methods for RBT databases;
* see documentation of those functions for more details.
*/
isc_result_t
dns__qpdb_findnode(dns_db_t *db, const dns_name_t *name, bool create,
dns_dbnode_t **nodep DNS__DB_FLARG);
isc_result_t
dns__qpdb_findnodeintree(dns_qpdb_t *qpdb, dns_qp_t *tree,
const dns_name_t *name, bool create,
dns_dbnode_t **nodep DNS__DB_FLARG);
/*%<
* Implement the dns_db_findnode() and _findnodeintree() methods for
* RBT databases; see documentation of those functions for more details.
*/
void
dns__qpdb_attachnode(dns_db_t *db, dns_dbnode_t *source,
dns_dbnode_t **targetp DNS__DB_FLARG);
void
dns__qpdb_detachnode(dns_db_t *db, dns_dbnode_t **targetp DNS__DB_FLARG);
/*%<
* Implement the dns_db_attachnode() and _detachnode() methods for
* RBT databases; see documentation of those functions for more details.
*/
isc_result_t
dns__qpdb_createiterator(dns_db_t *db, unsigned int options,
dns_dbiterator_t **iteratorp);
/*%<
* Implement dns_db_createiterator() for RBT databases; see documentation of
* that function for more details.
*/
isc_result_t
dns__qpdb_allrdatasets(dns_db_t *db, dns_dbnode_t *node,
dns_dbversion_t *version, unsigned int options,
isc_stdtime_t now,
dns_rdatasetiter_t **iteratorp DNS__DB_FLARG);
/*%<
* Implement dns_db_allrdatasets() for RBT databases; see documentation of
* that function for more details.
*/
isc_result_t
dns__qpdb_addrdataset(dns_db_t *db, dns_dbnode_t *node,
dns_dbversion_t *version, isc_stdtime_t now,
dns_rdataset_t *rdataset, unsigned int options,
dns_rdataset_t *addedrdataset DNS__DB_FLARG);
isc_result_t
dns__qpdb_subtractrdataset(dns_db_t *db, dns_dbnode_t *node,
dns_dbversion_t *version, dns_rdataset_t *rdataset,
unsigned int options,
dns_rdataset_t *newrdataset DNS__DB_FLARG);
isc_result_t
dns__qpdb_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
dns_dbversion_t *version, dns_rdatatype_t type,
dns_rdatatype_t covers DNS__DB_FLARG);
/*%<
* Implement the dns_db_addrdataset(), _subtractrdataset() and
* _deleterdataset() methods for RBT databases; see documentation of
* those functions for more details.
*/
unsigned int
dns__qpdb_nodecount(dns_db_t *db, dns_dbtree_t tree);
/*%<
* Implement dns_db_nodecount() for RBT databases; see documentation of
* that function for more details.
*/
void
dns__qpdb_setloop(dns_db_t *db, isc_loop_t *loop);
/*%<
* Implement dns_db_setloop() for RBT databases; see documentation of
* that function for more details.
*/
isc_result_t
dns__qpdb_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG);
/*%<
* Implement dns_db_getoriginnode() for RBT databases; see documentation of
* that function for more details.
*/
void
dns__qpdb_deletedata(dns_db_t *db ISC_ATTR_UNUSED,
dns_dbnode_t *node ISC_ATTR_UNUSED, void *data);
/*%<
* Implement dns_db_deletedata() for RBT databases; see documentation of
* that function for more details.
*/
void
dns__qpdb_locknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type);
void
dns__qpdb_unlocknode(dns_db_t *db, dns_dbnode_t *node, isc_rwlocktype_t type);
/*%<
* Implement the dns_db_locknode() and _unlocknode() methods for
* RBT databases; see documentation of those functions for more details.
*/
/*%
* Functions used for the RBT implementation which are defined and
* used in qpdb.c but may also be called from rbt-zonedb.c or
* rbt-cachedb.c:
*/
void
dns__qpdb_bindrdataset(dns_qpdb_t *qpdb, dns_qpdata_t *node,
dns_slabheader_t *header, isc_stdtime_t now,
isc_rwlocktype_t locktype,
dns_rdataset_t *rdataset DNS__DB_FLARG);
isc_result_t
dns__qpdb_nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name);
void
dns__qpdb_freeglue(dns_glue_t *glue_list);
void
dns__qpdb_newref(dns_qpdb_t *qpdb, dns_qpdata_t *node,
isc_rwlocktype_t locktype DNS__DB_FLARG);
/*%<
* Increment the reference counter to a node in an RBT database.
* If the caller holds a node lock then its lock type is specified
* as 'locktype'. If the node is write-locked, then the node can
* be removed from the dead nodes list. If not, the list can be
* cleaned up later.
*/
bool
dns__qpdb_decref(dns_qpdb_t *qpdb, dns_qpdata_t *node, uint32_t least_serial,
isc_rwlocktype_t *nlocktypep, isc_rwlocktype_t *tlocktypep,
bool tryupgrade, bool pruning DNS__DB_FLARG);
/*%<
* Decrement the reference counter to a node in an RBT database.
* 'nlocktypep' and 'tlocktypep' are pointers to the current status
* of the node lock and tree lock.
*
* If references go to 0, the node will be cleaned up, which may
* necessitate upgrading the locks.
*/
isc_result_t
dns__qpdb_add(dns_qpdb_t *qpdb, dns_qpdata_t *qpnode,
const dns_name_t *nodename, dns_qpdb_version_t *rbtversion,
dns_slabheader_t *newheader, unsigned int options, bool loading,
dns_rdataset_t *addedrdataset, isc_stdtime_t now DNS__DB_FLARG);
/*%<
* Add a slab header 'newheader' to a node in an RBT database.
* The caller must have the node write-locked.
*/
void
dns__qpdb_setsecure(dns_db_t *db, dns_qpdb_version_t *version,
dns_dbnode_t *origin);
/*%<
* Update the secure status for an RBT database version 'version'.
* The version will be marked secure if it is fully signed and
* and contains a complete NSEC/NSEC3 chain.
*/
void
dns__qpdb_mark(dns_slabheader_t *header, uint_least16_t flag);
/*%<
* Set attribute 'flag' in a slab header 'header' - for example,
* DNS_SLABHEADERATTR_STALE or DNS_SLABHEADERATTR_ANCIENT - and,
* in a cache database, update the rrset stats accordingly.
*/
void
dns__qpdb_setttl(dns_slabheader_t *header, dns_ttl_t newttl);
/*%<
* Set the TTL in a slab header 'header'. In a cache database,
* also update the TTL heap accordingly.
*/
/*
* Functions specific to zone databases that are also called from qpdb.c.
*/
void
dns__qpzone_resigninsert(dns_qpdb_t *qpdb, int idx,
dns_slabheader_t *newheader);
void
dns__qpzone_resigndelete(dns_qpdb_t *qpdb, dns_qpdb_version_t *version,
dns_slabheader_t *header DNS__DB_FLARG);
/*%<
* Insert/delete a node from the zone database's resigning heap.
*/
isc_result_t
dns__qpzone_wildcardmagic(dns_qpdb_t *qpdb, const dns_name_t *name, bool lock);
/*%<
* Add the necessary magic for the wildcard name 'name'
* to be found in 'qpdb'.
*
* In order for wildcard matching to work correctly in
* zone_find(), we must ensure that a node for the wildcarding
* level exists in the database, and has its 'find_callback'
* and 'wild' bits set.
*
* E.g. if the wildcard name is "*.sub.example." then we
* must ensure that "sub.example." exists and is marked as
* a wildcard level.
*
* The tree must be write-locked.
*/
isc_result_t
dns__qpzone_addwildcards(dns_qpdb_t *qpdb, const dns_name_t *name, bool lock);
/*%<
* If 'name' is or contains a wildcard name, create a node for it in the
* database. The tree must be write-locked.
*/
/*
* Cache-specific functions that are called from qpdb.c
*/
void
dns__qpcache_expireheader(dns_slabheader_t *header,
isc_rwlocktype_t *tlocktypep,
dns_expire_t reason DNS__DB_FLARG);
void
dns__qpcache_overmem(dns_qpdb_t *qpdb, dns_slabheader_t *newheader,
isc_rwlocktype_t *tlocktypep DNS__DB_FLARG);
/*
* Create a new qpdata node.
*/
dns_qpdata_t *
dns_qpdata_create(dns_qpdb_t *qpdb, const dns_name_t *name);
/*
* Destroy a qpdata node.
*/
void
dns_qpdata_destroy(dns_qpdata_t *qpdata);
#ifdef DNS_DB_NODETRACE
#define dns_qpdata_ref(ptr) dns_qpdata__ref(ptr, __func__, __FILE__, __LINE__)
#define dns_qpdata_unref(ptr) \
dns_qpdata__unref(ptr, __func__, __FILE__, __LINE__)
#define dns_qpdata_attach(ptr, ptrp) \
dns_qpdata__attach(ptr, ptrp, __func__, __FILE__, __LINE__)
#define dns_qpdata_detach(ptrp) \
dns_qpdata__detach(ptrp, __func__, __FILE__, __LINE__)
ISC_REFCOUNT_TRACE_DECL(dns_qpdata);
#else
ISC_REFCOUNT_DECL(dns_qpdata);
#endif
ISC_LANG_ENDDECLS
+3 -3
View File
@@ -1192,8 +1192,8 @@ is_leaf(dns_rbtnode_t *node) {
static void
send_to_prune_tree(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node,
isc_rwlocktype_t nlocktype DNS__DB_FLARG) {
prune_t *prune = isc_mem_get(rbtdb->common.mctx, sizeof(*prune));
*prune = (prune_t){ .node = node };
rbtdb_prune_t *prune = isc_mem_get(rbtdb->common.mctx, sizeof(*prune));
*prune = (rbtdb_prune_t){ .node = node };
dns_db_attach((dns_db_t *)rbtdb, &prune->db);
dns__rbtdb_newref(rbtdb, node, nlocktype DNS__DB_FLARG_PASS);
@@ -1501,7 +1501,7 @@ restore_locks:
*/
static void
prune_tree(void *arg) {
prune_t *prune = (prune_t *)arg;
rbtdb_prune_t *prune = (rbtdb_prune_t *)arg;
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)prune->db;
dns_rbtnode_t *node = prune->node;
dns_rbtnode_t *parent = NULL;
+1 -1
View File
@@ -204,7 +204,7 @@ typedef struct {
typedef struct {
dns_db_t *db;
dns_rbtnode_t *node;
} prune_t;
} rbtdb_prune_t;
extern dns_dbmethods_t dns__rbtdb_zonemethods;
extern dns_dbmethods_t dns__rbtdb_cachemethods;
+2 -2
View File
@@ -238,8 +238,8 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
REQUIRE(target != NULL && *target == NULL);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
rdclass, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, rdclass, 0, NULL, &db);
if (result != ISC_R_SUCCESS) {
goto failure;
}
+2 -5
View File
@@ -297,11 +297,8 @@ static isc_result_t
axfr_makedb(dns_xfrin_t *xfr, dns_db_t **dbp) {
isc_result_t result;
result = dns_db_create(xfr->mctx, /* XXX */
"rbt", /* XXX guess */
&xfr->name, dns_dbtype_zone, xfr->rdclass, 0,
NULL, /* XXX guess */
dbp);
result = dns_db_create(xfr->mctx, ZONEDB_DEFAULT, &xfr->name,
dns_dbtype_zone, xfr->rdclass, 0, NULL, dbp);
if (result == ISC_R_SUCCESS) {
dns_zone_rpz_enable_db(xfr->zone, *dbp);
dns_zone_catz_enable_db(xfr->zone, *dbp);
+4 -4
View File
@@ -1006,7 +1006,7 @@ zmgr_tlsctx_attach(dns_zonemgr_t *zmgr, isc_tlsctx_cache_t **ptlsctx_cache);
#define ENTER zone_debuglog(zone, __func__, 1, "enter")
static const unsigned int dbargc_default = 1;
static const char *dbargv_default[] = { "rbt" };
static const char *dbargv_default[] = { ZONEDB_DEFAULT };
#define DNS_ZONE_JITTER_ADD(a, b, c) \
do { \
@@ -1876,7 +1876,7 @@ dns_zone_rpz_enable(dns_zone_t *zone, dns_rpz_zones_t *rpzs,
* Only zones that are loaded instead of mmap()ed create the
* summary data and so can be policy zones.
*/
if (strcmp(zone->db_argv[0], "rbt") != 0) {
if (strcmp(zone->db_argv[0], "qp") != 0) {
return (ISC_R_NOTIMPLEMENTED);
}
@@ -2118,7 +2118,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, bool locked) {
INSIST(zone->db_argc >= 1);
rbt = strcmp(zone->db_argv[0], "rbt") == 0;
rbt = strcmp(zone->db_argv[0], ZONEDB_DEFAULT) == 0;
if (zone->db != NULL && zone->masterfile == NULL && rbt) {
/*
@@ -11324,7 +11324,7 @@ zone_expire(dns_zone_t *zone) {
isc_result_t result;
dns_rpz_zone_t *rpz = zone->rpzs->zones[zone->rpz_num];
CHECK(dns_db_create(zone->mctx, "rbt", &zone->origin,
CHECK(dns_db_create(zone->mctx, ZONEDB_DEFAULT, &zone->origin,
dns_dbtype_zone, zone->rdclass, 0, NULL,
&db));
CHECK(dns_rpz_dbupdate_callback(db, rpz));
+4 -3
View File
@@ -3986,9 +3986,10 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
"and 'database'",
znamestr);
result = ISC_R_FAILURE;
} else if (!dlz && (tresult == ISC_R_NOTFOUND ||
(tresult == ISC_R_SUCCESS &&
strcmp("rbt", cfg_obj_asstring(obj)) == 0)))
} else if (!dlz &&
(tresult == ISC_R_NOTFOUND ||
(tresult == ISC_R_SUCCESS &&
strcmp(ZONEDB_DEFAULT, cfg_obj_asstring(obj)) == 0)))
{
isc_result_t res1;
const cfg_obj_t *fileobj = NULL;
+1 -1
View File
@@ -463,7 +463,7 @@ static struct fun fun_list[] = {
{ "lfht", new_lfht, thread_lfht },
{ "ht", new_ht, thread_ht },
{ "hashmap", new_hashmap, thread_hashmap },
{ "rbt", new_rbt, thread_rbt },
{ "qp", new_rbt, thread_rbt },
{ "qp", new_qp, thread_qp },
{ "qp+nosqz", new_qp, thread_qp_nosqz },
{ "qp+barrier", new_qp, thread_qp_brr },
+1 -1
View File
@@ -35,8 +35,8 @@ check_PROGRAMS = \
private_test \
qp_test \
qpmulti_test \
qpdb_test \
rbt_test \
rbtdb_test \
rdata_test \
rdataset_test \
rdatasetstats_test \
+20 -17
View File
@@ -46,8 +46,9 @@ ISC_RUN_TEST_IMPL(getoriginnode) {
UNUSED(state);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_getoriginnode(db, &node);
@@ -69,8 +70,9 @@ ISC_RUN_TEST_IMPL(getsetservestalettl) {
UNUSED(state);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
ttl = 5000;
@@ -107,8 +109,9 @@ ISC_RUN_TEST_IMPL(dns_dbfind_staleok) {
UNUSED(state);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
example = dns_fixedname_initname(&example_fixed);
@@ -249,8 +252,9 @@ ISC_RUN_TEST_IMPL(class) {
UNUSED(state);
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_load(db, TESTS_DIR "/testdata/db/data.db",
@@ -270,8 +274,9 @@ ISC_RUN_TEST_IMPL(dbtype) {
UNUSED(state);
/* DB has zone semantics */
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname,
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_load(db, TESTS_DIR "/testdata/db/data.db",
dns_masterformat_text, 0);
@@ -281,14 +286,12 @@ ISC_RUN_TEST_IMPL(dbtype) {
dns_db_detach(&db);
/* DB has cache semantics */
result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_load(db, TESTS_DIR "/testdata/db/data.db",
dns_masterformat_text, 0);
assert_int_equal(result, ISC_R_SUCCESS);
assert_false(dns_db_iscache(db));
assert_true(dns_db_iszone(db));
assert_true(dns_db_iscache(db));
assert_false(dns_db_iszone(db));
dns_db_detach(&db);
}
+2 -2
View File
@@ -78,13 +78,13 @@ setup_test(void **state) {
isc_assertion_setcallback(local_callback);
res = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
res = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db1);
assert_int_equal(res, ISC_R_SUCCESS);
dns_db_newversion(db1, &v1);
assert_non_null(v1);
res = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
res = dns_db_create(mctx, ZONEDB_DEFAULT, dns_rootname, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db2);
assert_int_equal(res, ISC_R_SUCCESS);
dns_db_newversion(db2, &v2);
+3 -2
View File
@@ -472,8 +472,9 @@ ISC_RUN_TEST_IMPL(dumpraw) {
&target);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_db_create(mctx, "rbt", &dnsorigin, dns_dbtype_zone,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx, ZONEDB_DEFAULT, &dnsorigin,
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
result = isc_dir_chdir(SRCDIR);
@@ -36,7 +36,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#undef CHECK
#include "rbtdb.c"
#include "qpdb.c"
#pragma GCC diagnostic pop
#undef CHECK
@@ -97,20 +97,20 @@ static bool
ownercase_test_one(const char *str1, const char *str2) {
isc_result_t result;
db_nodelock_t node_locks[1];
dns_rbtdb_t rbtdb = {
.common.methods = &dns__rbtdb_zonemethods,
dns_qpdb_t qpdb = {
.common.methods = &dns__qpdb_zonemethods,
.common.mctx = mctx,
.node_locks = node_locks,
};
dns_rbtnode_t rbtnode = { .locknum = 0 };
dns_qpdata_t rbtnode = { .locknum = 0 };
dns_slabheader_t header = {
.node = &rbtnode,
.db = (dns_db_t *)&rbtdb,
.db = (dns_db_t *)&qpdb,
};
unsigned char *raw = (unsigned char *)(&header) + sizeof(header);
dns_rdataset_t rdataset = {
.magic = DNS_RDATASET_MAGIC,
.slab = { .db = (dns_db_t *)&rbtdb,
.slab = { .db = (dns_db_t *)&qpdb,
.node = &rbtnode,
.raw = raw },
.methods = &dns_rdataslab_rdatasetmethods,
@@ -122,7 +122,7 @@ ownercase_test_one(const char *str1, const char *str2) {
memset(node_locks, 0, sizeof(node_locks));
/* Minimal initialization of the mock objects */
NODE_INITLOCK(&rbtdb.node_locks[0].lock);
NODE_INITLOCK(&qpdb.node_locks[0].lock);
isc_buffer_constinit(&b, str1, strlen(str1));
isc_buffer_add(&b, strlen(str1));
@@ -142,7 +142,7 @@ ownercase_test_one(const char *str1, const char *str2) {
/* Retrieve the case to name2 */
dns_rdataset_getownercase(&rdataset, name2);
NODE_DESTROYLOCK(&rbtdb.node_locks[0].lock);
NODE_DESTROYLOCK(&qpdb.node_locks[0].lock);
return (dns_name_caseequal(name1, name2));
}
@@ -164,20 +164,20 @@ ISC_RUN_TEST_IMPL(ownercase) {
ISC_RUN_TEST_IMPL(setownercase) {
isc_result_t result;
db_nodelock_t node_locks[1];
dns_rbtdb_t rbtdb = {
.common.methods = &dns__rbtdb_zonemethods,
dns_qpdb_t qpdb = {
.common.methods = &dns__qpdb_zonemethods,
.common.mctx = mctx,
.node_locks = node_locks,
};
dns_rbtnode_t rbtnode = { .locknum = 0 };
dns_qpdata_t rbtnode = { .locknum = 0 };
dns_slabheader_t header = {
.node = &rbtnode,
.db = (dns_db_t *)&rbtdb,
.db = (dns_db_t *)&qpdb,
};
unsigned char *raw = (unsigned char *)(&header) + sizeof(header);
dns_rdataset_t rdataset = {
.magic = DNS_RDATASET_MAGIC,
.slab = { .db = (dns_db_t *)&rbtdb,
.slab = { .db = (dns_db_t *)&qpdb,
.node = &rbtnode,
.raw = raw },
.methods = &dns_rdataslab_rdatasetmethods,
@@ -193,7 +193,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
/* Minimal initialization of the mock objects */
memset(node_locks, 0, sizeof(node_locks));
NODE_INITLOCK(&rbtdb.node_locks[0].lock);
NODE_INITLOCK(&qpdb.node_locks[0].lock);
isc_buffer_constinit(&b, str1, strlen(str1));
isc_buffer_add(&b, strlen(str1));
@@ -210,7 +210,7 @@ ISC_RUN_TEST_IMPL(setownercase) {
/* Retrieve the case to name2 */
dns_rdataset_getownercase(&rdataset, name2);
NODE_DESTROYLOCK(&rbtdb.node_locks[0].lock);
NODE_DESTROYLOCK(&qpdb.node_locks[0].lock);
assert_true(dns_name_caseequal(name1, name2));
}
@@ -293,8 +293,9 @@ ISC_RUN_TEST_IMPL(overmempurge_bigrdata) {
isc_mem_create(&mctx2);
result = dns_db_create(mctx2, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx2, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
isc_mem_setwater(mctx2, hiwater, lowater);
@@ -337,8 +338,9 @@ ISC_RUN_TEST_IMPL(overmempurge_longname) {
isc_mem_create(&mctx2);
result = dns_db_create(mctx2, "rbt", dns_rootname, dns_dbtype_cache,
dns_rdataclass_in, 0, NULL, &db);
result = dns_db_create(mctx2, CACHEDB_DEFAULT, dns_rootname,
dns_dbtype_cache, dns_rdataclass_in, 0, NULL,
&db);
assert_int_equal(result, ISC_R_SUCCESS);
isc_mem_setwater(mctx2, hiwater, lowater);
+4 -2
View File
@@ -213,7 +213,9 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
const char *testfile) {
isc_result_t result;
dns_fixedname_t fixed;
dns_name_t *name;
dns_name_t *name = NULL;
const char *dbimp = (dbtype == dns_dbtype_zone) ? ZONEDB_DEFAULT
: CACHEDB_DEFAULT;
name = dns_fixedname_initname(&fixed);
@@ -222,7 +224,7 @@ dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
return (result);
}
result = dns_db_create(mctx, "rbt", name, dbtype, dns_rdataclass_in, 0,
result = dns_db_create(mctx, dbimp, name, dbtype, dns_rdataclass_in, 0,
NULL, db);
if (result != ISC_R_SUCCESS) {
return (result);
+4 -2
View File
@@ -530,7 +530,9 @@ ns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
const char *testfile) {
isc_result_t result;
dns_fixedname_t fixed;
dns_name_t *name;
dns_name_t *name = NULL;
const char *dbimp = (dbtype == dns_dbtype_zone) ? ZONEDB_DEFAULT
: CACHEDB_DEFAULT;
name = dns_fixedname_initname(&fixed);
@@ -539,7 +541,7 @@ ns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin,
return (result);
}
result = dns_db_create(mctx, "rbt", name, dbtype, dns_rdataclass_in, 0,
result = dns_db_create(mctx, dbimp, name, dbtype, dns_rdataclass_in, 0,
NULL, db);
if (result != ISC_R_SUCCESS) {
return (result);