Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fb06d7518 | ||
|
|
49dad2c12e | ||
|
|
3cd62b71e6 | ||
|
|
aae3d1064c | ||
|
|
7aa6322eb8 | ||
|
|
d3f41260af | ||
|
|
b156167620 | ||
|
|
42be125727 | ||
|
|
4b99ed8030 | ||
|
|
d88a79c145 | ||
|
|
d39934b4f1 | ||
|
|
a9a47938eb | ||
|
|
6e9e352068 | ||
|
|
394e0f1ddc | ||
|
|
996e3b7cee | ||
|
|
94540dc8e9 | ||
|
|
76820a8d29 | ||
|
|
87c456d1c0 | ||
|
|
a32fa928c2 | ||
|
|
2627d8fb69 | ||
|
|
cf1930d9ae | ||
|
|
09042cf347 | ||
|
|
d705175819 | ||
|
|
6a005bc6e8 | ||
|
|
151e85ae31 |
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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@; };
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
~~~~~~~~~
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+2489
File diff suppressed because it is too large
Load Diff
+4732
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user