2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00

Rename DNS_DB_NSEC_ constants to DNS_DBNAMESPACE_

Naming is hard exercise.
This commit is contained in:
Matthijs Mekking 2025-07-07 11:29:45 +02:00
parent a7021a3a51
commit df6763fd2a
16 changed files with 958 additions and 875 deletions

View File

@ -56,16 +56,17 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
CHECK(dns_name_fromwire(namein, &buf, DNS_DECOMPRESS_NEVER, NULL)); CHECK(dns_name_fromwire(namein, &buf, DNS_DECOMPRESS_NEVER, NULL));
/* verify round-trip conversion of first name */ /* verify round-trip conversion of first name */
size_t keylen = dns_qpkey_fromname(key, namein, 0); size_t keylen = dns_qpkey_fromname(key, namein, DNS_DBNAMESPACE_NORMAL);
dns_qpkey_toname(key, keylen, nameout, &space); dns_qpkey_toname(key, keylen, nameout, &space);
assert(dns_name_equal(namein, nameout)); assert(dns_name_equal(namein, nameout));
assert(space == 0); assert(space == DNS_DBNAMESPACE_NORMAL);
/* is there a second name? */ /* is there a second name? */
CHECK(dns_name_fromwire(namecmp, &buf, DNS_DECOMPRESS_NEVER, NULL)); CHECK(dns_name_fromwire(namecmp, &buf, DNS_DECOMPRESS_NEVER, NULL));
size_t cmplen = dns_qpkey_fromname(cmp, namecmp, 0); size_t cmplen = dns_qpkey_fromname(cmp, namecmp,
DNS_DBNAMESPACE_NORMAL);
size_t len = ISC_MIN(keylen, cmplen); size_t len = ISC_MIN(keylen, cmplen);
int namerel = dns_name_compare(namein, namecmp); int namerel = dns_name_compare(namein, namecmp);
@ -74,7 +75,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
assert((namerel < 0) == (keyrel < 0)); assert((namerel < 0) == (keyrel < 0));
assert((namerel == 0) == (keyrel == 0)); assert((namerel == 0) == (keyrel == 0));
assert((namerel > 0) == (keyrel > 0)); assert((namerel > 0) == (keyrel > 0));
assert(space == 0); assert(space == DNS_DBNAMESPACE_NORMAL);
return 0; return 0;
} }

View File

@ -163,7 +163,8 @@ dns_fwdtable_find(dns_fwdtable_t *fwdtable, const dns_name_t *name,
REQUIRE(VALID_FWDTABLE(fwdtable)); REQUIRE(VALID_FWDTABLE(fwdtable));
dns_qpmulti_query(fwdtable->table, &qpr); dns_qpmulti_query(fwdtable->table, &qpr);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL); result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
dns_forwarders_t *fwdrs = pval; dns_forwarders_t *fwdrs = pval;
*forwardersp = fwdrs; *forwardersp = fwdrs;
@ -233,7 +234,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
dns_forwarders_t *fwd = pval; dns_forwarders_t *fwd = pval;
return dns_qpkey_fromname(key, &fwd->name, 0); return dns_qpkey_fromname(key, &fwd->name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -238,9 +238,9 @@ struct dns_dbonupdatelistener {
* the beginning of the key, converting them to '0', '1', and '2'. * the beginning of the key, converting them to '0', '1', and '2'.
*/ */
typedef enum { typedef enum {
DNS_DB_NSEC_NORMAL = 0, /* regular namespace */ DNS_DBNAMESPACE_NORMAL = 0, /* regular namespace */
DNS_DB_NSEC_NSEC = 1, /* nsec namespace */ DNS_DBNAMESPACE_NSEC = 1, /* nsec namespace */
DNS_DB_NSEC_NSEC3 = 2, /* nsec3 namespace */ DNS_DBNAMESPACE_NSEC3 = 2, /* nsec3 namespace */
} dns_namespace_t; } dns_namespace_t;
/*@{*/ /*@{*/

View File

@ -477,11 +477,7 @@ size_t
dns_qpkey_fromname(dns_qpkey_t key, const dns_name_t *name, dns_qpkey_fromname(dns_qpkey_t key, const dns_name_t *name,
dns_namespace_t space); dns_namespace_t space);
/*%< /*%<
* Convert a DNS name into a trie lookup key. * Convert a DNS name into a trie lookup key in the right namespace.
*
* If 'space' is DNS_DB_NSEC_NORMAL (0), convert the name for a normal lookup.
* If 'space' is DNS_DB_NSEC_NSEC, convert the name for a NSEC lookup.
* If 'space' is DNS_DB_NSEC_NSEC3, convert the name for a NSEC3 lookup.
* *
* Requires: * Requires:
* \li `name` is a pointer to a valid `dns_name_t` * \li `name` is a pointer to a valid `dns_name_t`
@ -549,8 +545,7 @@ dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r); dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r);
/*%< /*%<
* Look up a leaf in a qp-trie that is equal to, or an ancestor domain of, * Look up a leaf in a qp-trie that is equal to, or an ancestor domain of,
* 'name' in the namespace 'space'. The namespace can either be * 'name' in the namespace 'space'.
* DNS_DB_NSEC_NORMAL, DNS_DB_NSEC_NSEC, or DNS_DB_NSEC3.
* *
* If 'foundname' is not NULL, it will be updated to contain the name * If 'foundname' is not NULL, it will be updated to contain the name
* that was found (if any). The return code, ISC_R_SUCCESS or * that was found (if any). The return code, ISC_R_SUCCESS or

View File

@ -273,7 +273,8 @@ delete_ds(dns_qp_t *qp, dns_keytable_t *keytable, dns_keynode_t *knode,
} }
} }
result = dns_qp_deletename(qp, &knode->name, 0, &pval, NULL); result = dns_qp_deletename(qp, &knode->name, DNS_DBNAMESPACE_NORMAL,
&pval, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
INSIST(pval == knode); INSIST(pval == knode);
@ -343,7 +344,8 @@ insert(dns_keytable_t *keytable, bool managed, bool initial,
dns_qpmulti_write(keytable->table, &qp); dns_qpmulti_write(keytable->table, &qp);
result = dns_qp_getname(qp, keyname, 0, &pval, NULL); result = dns_qp_getname(qp, keyname, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
/* /*
* There was no match for "keyname" in "keytable" yet, so one * There was no match for "keyname" in "keytable" yet, so one
@ -400,7 +402,8 @@ dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname,
REQUIRE(keyname != NULL); REQUIRE(keyname != NULL);
dns_qpmulti_write(keytable->table, &qp); dns_qpmulti_write(keytable->table, &qp);
result = dns_qp_deletename(qp, keyname, 0, &pval, NULL); result = dns_qp_deletename(qp, keyname, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
dns_keynode_t *n = pval; dns_keynode_t *n = pval;
if (callback != NULL) { if (callback != NULL) {
@ -430,7 +433,8 @@ dns_keytable_deletekey(dns_keytable_t *keytable, const dns_name_t *keyname,
REQUIRE(dnskey != NULL); REQUIRE(dnskey != NULL);
dns_qpmulti_write(keytable->table, &qp); dns_qpmulti_write(keytable->table, &qp);
result = dns_qp_getname(qp, keyname, 0, &pval, NULL); result = dns_qp_getname(qp, keyname, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
goto finish; goto finish;
} }
@ -479,7 +483,8 @@ dns_keytable_find(dns_keytable_t *keytable, const dns_name_t *keyname,
REQUIRE(keynodep != NULL && *keynodep == NULL); REQUIRE(keynodep != NULL && *keynodep == NULL);
dns_qpmulti_query(keytable->table, &qpr); dns_qpmulti_query(keytable->table, &qpr);
result = dns_qp_getname(&qpr, keyname, 0, &pval, NULL); result = dns_qp_getname(&qpr, keyname, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
dns_keynode_t *knode = pval; dns_keynode_t *knode = pval;
dns_keynode_attach(knode, keynodep); dns_keynode_attach(knode, keynodep);
@ -506,7 +511,8 @@ dns_keytable_finddeepestmatch(dns_keytable_t *keytable, const dns_name_t *name,
REQUIRE(foundname != NULL); REQUIRE(foundname != NULL);
dns_qpmulti_query(keytable->table, &qpr); dns_qpmulti_query(keytable->table, &qpr);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL); result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, &pval, NULL);
keynode = pval; keynode = pval;
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
@ -535,7 +541,8 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name,
REQUIRE(wantdnssecp != NULL); REQUIRE(wantdnssecp != NULL);
dns_qpmulti_query(keytable->table, &qpr); dns_qpmulti_query(keytable->table, &qpr);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL); result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
keynode = pval; keynode = pval;
if (foundname != NULL) { if (foundname != NULL) {
@ -830,7 +837,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
dns_keynode_t *keynode = pval; dns_keynode_t *keynode = pval;
return dns_qpkey_fromname(key, &keynode->name, 0); return dns_qpkey_fromname(key, &keynode->name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -164,14 +164,16 @@ dns_nametree_add(dns_nametree_t *nametree, const dns_name_t *name,
case DNS_NAMETREE_COUNT: case DNS_NAMETREE_COUNT:
new = newnode(nametree->mctx, name); new = newnode(nametree->mctx, name);
new->set = true; new->set = true;
result = dns_qp_deletename(qp, name, 0, (void **)&old, &count); result = dns_qp_deletename(qp, name, DNS_DBNAMESPACE_NORMAL,
(void **)&old, &count);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
count += 1; count += 1;
} }
break; break;
case DNS_NAMETREE_BITS: case DNS_NAMETREE_BITS:
result = dns_qp_getname(qp, name, 0, (void **)&old, NULL); result = dns_qp_getname(qp, name, DNS_DBNAMESPACE_NORMAL,
(void **)&old, NULL);
if (result == ISC_R_SUCCESS && matchbit(old->bits, value)) { if (result == ISC_R_SUCCESS && matchbit(old->bits, value)) {
goto out; goto out;
} }
@ -187,7 +189,8 @@ dns_nametree_add(dns_nametree_t *nametree, const dns_name_t *name,
new->bits = isc_mem_cget(nametree->mctx, size, sizeof(char)); new->bits = isc_mem_cget(nametree->mctx, size, sizeof(char));
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
memmove(new->bits, old->bits, old->bits[0]); memmove(new->bits, old->bits, old->bits[0]);
result = dns_qp_deletename(qp, name, 0, NULL, NULL); result = dns_qp_deletename(
qp, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
} }
@ -222,7 +225,8 @@ dns_nametree_delete(dns_nametree_t *nametree, const dns_name_t *name) {
REQUIRE(name != NULL); REQUIRE(name != NULL);
dns_qpmulti_write(nametree->table, &qp); dns_qpmulti_write(nametree->table, &qp);
result = dns_qp_deletename(qp, name, 0, (void **)&old, &count); result = dns_qp_deletename(qp, name, DNS_DBNAMESPACE_NORMAL,
(void **)&old, &count);
switch (nametree->type) { switch (nametree->type) {
case DNS_NAMETREE_BOOL: case DNS_NAMETREE_BOOL:
case DNS_NAMETREE_BITS: case DNS_NAMETREE_BITS:
@ -258,7 +262,8 @@ dns_nametree_find(dns_nametree_t *nametree, const dns_name_t *name,
REQUIRE(ntnodep != NULL && *ntnodep == NULL); REQUIRE(ntnodep != NULL && *ntnodep == NULL);
dns_qpmulti_query(nametree->table, &qpr); dns_qpmulti_query(nametree->table, &qpr);
result = dns_qp_getname(&qpr, name, 0, (void **)&node, NULL); result = dns_qp_getname(&qpr, name, DNS_DBNAMESPACE_NORMAL,
(void **)&node, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
dns_ntnode_attach(node, ntnodep); dns_ntnode_attach(node, ntnodep);
} }
@ -278,8 +283,8 @@ dns_nametree_covered(dns_nametree_t *nametree, const dns_name_t *name,
REQUIRE(VALID_NAMETREE(nametree)); REQUIRE(VALID_NAMETREE(nametree));
dns_qpmulti_query(nametree->table, &qpr); dns_qpmulti_query(nametree->table, &qpr);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, (void **)&node, result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL); NULL, (void **)&node, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
if (found != NULL) { if (found != NULL) {
dns_name_copy(&node->name, found); dns_name_copy(&node->name, found);
@ -319,7 +324,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
dns_ntnode_t *ntnode = pval; dns_ntnode_t *ntnode = pval;
return dns_qpkey_fromname(key, &ntnode->name, 0); return dns_qpkey_fromname(key, &ntnode->name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -316,7 +316,8 @@ dns_ntatable_add(dns_ntatable_t *ntatable, const dns_name_t *name, bool force,
result = dns_qp_insert(qp, nta, 0); result = dns_qp_insert(qp, nta, 0);
switch (result) { switch (result) {
case ISC_R_EXISTS: case ISC_R_EXISTS:
result = dns_qp_getname(qp, &nta->name, 0, &pval, NULL); result = dns_qp_getname(qp, &nta->name, DNS_DBNAMESPACE_NORMAL,
&pval, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
/* /*
* an NTA already existed: throw away the * an NTA already existed: throw away the
@ -355,7 +356,8 @@ dns_ntatable_delete(dns_ntatable_t *ntatable, const dns_name_t *name) {
REQUIRE(name != NULL); REQUIRE(name != NULL);
dns_qpmulti_write(ntatable->table, &qp); dns_qpmulti_write(ntatable->table, &qp);
result = dns_qp_deletename(qp, name, 0, &pval, NULL); result = dns_qp_deletename(qp, name, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
dns__nta_t *n = pval; dns__nta_t *n = pval;
dns__nta_shutdown(n); dns__nta_shutdown(n);
@ -379,7 +381,8 @@ delete_expired(void *arg) {
RWLOCK(&ntatable->rwlock, isc_rwlocktype_write); RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
dns_qpmulti_write(ntatable->table, &qp); dns_qpmulti_write(ntatable->table, &qp);
result = dns_qp_getname(qp, &nta->name, 0, &pval, NULL); result = dns_qp_getname(qp, &nta->name, DNS_DBNAMESPACE_NORMAL, &pval,
NULL);
if (result == ISC_R_SUCCESS && if (result == ISC_R_SUCCESS &&
((dns__nta_t *)pval)->expiry == nta->expiry && !nta->shuttingdown) ((dns__nta_t *)pval)->expiry == nta->expiry && !nta->shuttingdown)
{ {
@ -387,7 +390,8 @@ delete_expired(void *arg) {
dns_name_format(&nta->name, nb, sizeof(nb)); dns_name_format(&nta->name, nb, sizeof(nb));
isc_log_write(DNS_LOGCATEGORY_DNSSEC, DNS_LOGMODULE_NTA, isc_log_write(DNS_LOGCATEGORY_DNSSEC, DNS_LOGMODULE_NTA,
ISC_LOG_INFO, "deleting expired NTA at %s", nb); ISC_LOG_INFO, "deleting expired NTA at %s", nb);
dns_qp_deletename(qp, &nta->name, 0, NULL, NULL); dns_qp_deletename(qp, &nta->name, DNS_DBNAMESPACE_NORMAL, NULL,
NULL);
dns__nta_shutdown(nta); dns__nta_shutdown(nta);
dns__nta_unref(nta); dns__nta_unref(nta);
} }
@ -412,7 +416,8 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now,
RWLOCK(&ntatable->rwlock, isc_rwlocktype_read); RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
dns_qpmulti_query(ntatable->table, &qpr); dns_qpmulti_query(ntatable->table, &qpr);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL); result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, &pval, NULL);
nta = pval; nta = pval;
switch (result) { switch (result) {
@ -649,7 +654,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
dns__nta_t *nta = pval; dns__nta_t *nta = pval;
return dns_qpkey_fromname(key, &nta->name, 0); return dns_qpkey_fromname(key, &nta->name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -604,14 +604,14 @@ delete_node(qpcache_t *qpdb, qpcnode_t *node) {
} }
switch (node->nspace) { switch (node->nspace) {
case DNS_DB_NSEC_NORMAL: case DNS_DBNAMESPACE_NORMAL:
if (node->havensec) { if (node->havensec) {
/* /*
* Delete the corresponding node from the auxiliary NSEC * Delete the corresponding node from the auxiliary NSEC
* tree before deleting from the main tree. * tree before deleting from the main tree.
*/ */
result = dns_qp_deletename(qpdb->nsec, &node->name, result = dns_qp_deletename(qpdb->nsec, &node->name,
DNS_DB_NSEC_NSEC, NULL, DNS_DBNAMESPACE_NSEC, NULL,
NULL); NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(DNS_LOGCATEGORY_DATABASE, isc_log_write(DNS_LOGCATEGORY_DATABASE,
@ -625,7 +625,7 @@ delete_node(qpcache_t *qpdb, qpcnode_t *node) {
result = dns_qp_deletename(qpdb->tree, &node->name, result = dns_qp_deletename(qpdb->tree, &node->name,
node->nspace, NULL, NULL); node->nspace, NULL, NULL);
break; break;
case DNS_DB_NSEC_NSEC: case DNS_DBNAMESPACE_NSEC:
result = dns_qp_deletename(qpdb->nsec, &node->name, result = dns_qp_deletename(qpdb->nsec, &node->name,
node->nspace, NULL, NULL); node->nspace, NULL, NULL);
break; break;
@ -1395,8 +1395,8 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
/* /*
* Look for the node in the auxilary tree. * Look for the node in the auxilary tree.
*/ */
result = dns_qp_lookup(search->qpdb->nsec, name, DNS_DB_NSEC_NSEC, NULL, result = dns_qp_lookup(search->qpdb->nsec, name, DNS_DBNAMESPACE_NSEC,
&iter, NULL, (void **)&node, NULL); NULL, &iter, NULL, (void **)&node, NULL);
if (result != DNS_R_PARTIALMATCH) { if (result != DNS_R_PARTIALMATCH) {
return ISC_R_NOTFOUND; return ISC_R_NOTFOUND;
} }
@ -1417,7 +1417,7 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
*/ */
node = NULL; node = NULL;
result = dns_qp_getname(search->qpdb->tree, predecessor, result = dns_qp_getname(search->qpdb->tree, predecessor,
DNS_DB_NSEC_NORMAL, (void **)&node, NULL); DNS_DBNAMESPACE_NORMAL, (void **)&node, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return result; return result;
} }
@ -1524,8 +1524,8 @@ qpcache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
/* /*
* Search down from the root of the tree. * Search down from the root of the tree.
*/ */
result = dns_qp_lookup(search.qpdb->tree, name, 0, NULL, NULL, result = dns_qp_lookup(search.qpdb->tree, name, DNS_DBNAMESPACE_NORMAL,
&search.chain, (void **)&node, NULL); NULL, NULL, &search.chain, (void **)&node, NULL);
if (result != ISC_R_NOTFOUND && foundname != NULL) { if (result != ISC_R_NOTFOUND && foundname != NULL) {
dns_name_copy(&node->name, foundname); dns_name_copy(&node->name, foundname);
} }
@ -1964,8 +1964,8 @@ qpcache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
/* /*
* Search down from the root of the tree. * Search down from the root of the tree.
*/ */
result = dns_qp_lookup(search.qpdb->tree, name, 0, NULL, NULL, result = dns_qp_lookup(search.qpdb->tree, name, DNS_DBNAMESPACE_NORMAL,
&search.chain, (void **)&node, NULL); NULL, NULL, &search.chain, (void **)&node, NULL);
switch (result) { switch (result) {
case ISC_R_SUCCESS: case ISC_R_SUCCESS:
@ -2352,7 +2352,7 @@ qpcache_findnode(dns_db_t *db, const dns_name_t *name, bool create,
qpcnode_t *node = NULL; qpcnode_t *node = NULL;
isc_result_t result; isc_result_t result;
isc_rwlocktype_t tlocktype = isc_rwlocktype_none; isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
dns_namespace_t dopt = DNS_DB_NSEC_NORMAL; dns_namespace_t nspace = DNS_DBNAMESPACE_NORMAL;
TREE_RDLOCK(&qpdb->tree_lock, &tlocktype); TREE_RDLOCK(&qpdb->tree_lock, &tlocktype);
result = dns_qp_getname(qpdb->tree, name, nspace, (void **)&node, NULL); result = dns_qp_getname(qpdb->tree, name, nspace, (void **)&node, NULL);
@ -2368,7 +2368,7 @@ qpcache_findnode(dns_db_t *db, const dns_name_t *name, bool create,
(void **)&node, NULL); (void **)&node, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
node = new_qpcnode(qpdb, name); node = new_qpcnode(qpdb, name);
node->nspace = dopt; node->nspace = nspace;
result = dns_qp_insert(qpdb->tree, node, 0); result = dns_qp_insert(qpdb->tree, node, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
qpcnode_unref(node); qpcnode_unref(node);
@ -3045,12 +3045,12 @@ qpcache_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
if (newnsec && !qpnode->havensec) { if (newnsec && !qpnode->havensec) {
qpcnode_t *nsecnode = NULL; qpcnode_t *nsecnode = NULL;
result = dns_qp_getname(qpdb->nsec, name, DNS_DB_NSEC_NSEC, result = dns_qp_getname(qpdb->nsec, name, DNS_DBNAMESPACE_NSEC,
(void **)&nsecnode, NULL); (void **)&nsecnode, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
INSIST(nsecnode == NULL); INSIST(nsecnode == NULL);
nsecnode = new_qpcnode(qpdb, name); nsecnode = new_qpcnode(qpdb, name);
nsecnode->nspace = DNS_DB_NSEC_NSEC; nsecnode->nspace = DNS_DBNAMESPACE_NSEC;
result = dns_qp_insert(qpdb->nsec, nsecnode, 0); result = dns_qp_insert(qpdb->nsec, nsecnode, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
qpcnode_detach(&nsecnode); qpcnode_detach(&nsecnode);
@ -3427,7 +3427,8 @@ resume_iteration(qpc_dbit_t *qpdbiter, bool continuing) {
*/ */
if (continuing && qpdbiter->node != NULL) { if (continuing && qpdbiter->node != NULL) {
isc_result_t result; isc_result_t result;
result = dns_qp_lookup(qpdb->tree, qpdbiter->name, 0, NULL, result = dns_qp_lookup(qpdb->tree, qpdbiter->name,
DNS_DBNAMESPACE_NORMAL, NULL,
&qpdbiter->iter, NULL, NULL, NULL); &qpdbiter->iter, NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
} }
@ -3555,8 +3556,9 @@ dbiterator_seek(dns_dbiterator_t *iterator,
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS); dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
result = dns_qp_lookup(qpdb->tree, name, 0, NULL, &qpdbiter->iter, NULL, result = dns_qp_lookup(qpdb->tree, name, DNS_DBNAMESPACE_NORMAL, NULL,
(void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL, (void **)&qpdbiter->node,
NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
dns_name_copy(&qpdbiter->node->name, qpdbiter->name); dns_name_copy(&qpdbiter->node->name, qpdbiter->name);

View File

@ -767,7 +767,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
* we simply remember the node data's address. * we simply remember the node data's address.
*/ */
qpdb->origin = new_qpznode(qpdb, &qpdb->common.origin); qpdb->origin = new_qpznode(qpdb, &qpdb->common.origin);
qpdb->origin->nspace = DNS_DB_NSEC_NORMAL; qpdb->origin->nspace = DNS_DBNAMESPACE_NORMAL;
result = dns_qp_insert(qp, qpdb->origin, 0); result = dns_qp_insert(qp, qpdb->origin, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
@ -776,7 +776,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
* the NSEC nodes while iterating over the full tree. * the NSEC nodes while iterating over the full tree.
*/ */
qpdb->nsec_origin = new_qpznode(qpdb, &qpdb->common.origin); qpdb->nsec_origin = new_qpznode(qpdb, &qpdb->common.origin);
qpdb->nsec_origin->nspace = DNS_DB_NSEC_NSEC; qpdb->nsec_origin->nspace = DNS_DBNAMESPACE_NSEC;
result = dns_qp_insert(qp, qpdb->nsec_origin, 0); result = dns_qp_insert(qp, qpdb->nsec_origin, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
@ -786,7 +786,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
* record in the tree. * record in the tree.
*/ */
qpdb->nsec3_origin = new_qpznode(qpdb, &qpdb->common.origin); qpdb->nsec3_origin = new_qpznode(qpdb, &qpdb->common.origin);
qpdb->nsec3_origin->nspace = DNS_DB_NSEC_NSEC3; qpdb->nsec3_origin->nspace = DNS_DBNAMESPACE_NSEC3;
result = dns_qp_insert(qp, qpdb->nsec3_origin, 0); result = dns_qp_insert(qp, qpdb->nsec3_origin, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
@ -1712,13 +1712,14 @@ loading_addnode(qpz_load_t *loadctx, const dns_name_t *name,
qpznode_t *node = NULL, *nsecnode = NULL; qpznode_t *node = NULL, *nsecnode = NULL;
if (type == dns_rdatatype_nsec3 || covers == dns_rdatatype_nsec3) { if (type == dns_rdatatype_nsec3 || covers == dns_rdatatype_nsec3) {
result = dns_qp_getname(loadctx->tree, name, DNS_DB_NSEC_NSEC3, result = dns_qp_getname(loadctx->tree, name,
(void **)&node, NULL); DNS_DBNAMESPACE_NSEC3, (void **)&node,
NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
*nodep = node; *nodep = node;
} else { } else {
node = new_qpznode(qpdb, name); node = new_qpznode(qpdb, name);
node->nspace = DNS_DB_NSEC_NSEC3; node->nspace = DNS_DBNAMESPACE_NSEC3;
result = dns_qp_insert(loadctx->tree, node, 0); result = dns_qp_insert(loadctx->tree, node, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
*nodep = node; *nodep = node;
@ -1727,7 +1728,7 @@ loading_addnode(qpz_load_t *loadctx, const dns_name_t *name,
return; return;
} }
result = dns_qp_getname(loadctx->tree, name, DNS_DB_NSEC_NORMAL, result = dns_qp_getname(loadctx->tree, name, DNS_DBNAMESPACE_NORMAL,
(void **)&node, NULL); (void **)&node, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
if (type == dns_rdatatype_nsec && node->havensec) { if (type == dns_rdatatype_nsec && node->havensec) {
@ -1736,7 +1737,7 @@ loading_addnode(qpz_load_t *loadctx, const dns_name_t *name,
} else { } else {
INSIST(node == NULL); INSIST(node == NULL);
node = new_qpznode(qpdb, name); node = new_qpznode(qpdb, name);
node->nspace = DNS_DB_NSEC_NORMAL; node->nspace = DNS_DBNAMESPACE_NORMAL;
result = dns_qp_insert(loadctx->tree, node, 0); result = dns_qp_insert(loadctx->tree, node, 0);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
qpznode_unref(node); qpznode_unref(node);
@ -1755,7 +1756,7 @@ loading_addnode(qpz_load_t *loadctx, const dns_name_t *name,
*/ */
node->havensec = true; node->havensec = true;
nsecnode = new_qpznode(qpdb, name); nsecnode = new_qpznode(qpdb, name);
nsecnode->nspace = DNS_DB_NSEC_NSEC; nsecnode->nspace = DNS_DBNAMESPACE_NSEC;
(void)dns_qp_insert(loadctx->tree, nsecnode, 0); (void)dns_qp_insert(loadctx->tree, nsecnode, 0);
qpznode_detach(&nsecnode); qpznode_detach(&nsecnode);
@ -2192,7 +2193,7 @@ loading_addrdataset(void *arg, const dns_name_t *name,
if (rdataset->type != dns_rdatatype_nsec3 && if (rdataset->type != dns_rdatatype_nsec3 &&
rdataset->covers != dns_rdatatype_nsec3) rdataset->covers != dns_rdatatype_nsec3)
{ {
addwildcards(qpdb, loadctx->tree, name, DNS_DB_NSEC_NORMAL); addwildcards(qpdb, loadctx->tree, name, DNS_DBNAMESPACE_NORMAL);
} }
if (dns_name_iswildcard(name)) { if (dns_name_iswildcard(name)) {
@ -2210,7 +2211,8 @@ loading_addrdataset(void *arg, const dns_name_t *name,
return DNS_R_INVALIDNSEC3; return DNS_R_INVALIDNSEC3;
} }
wildcardmagic(qpdb, loadctx->tree, name, DNS_DB_NSEC_NORMAL); wildcardmagic(qpdb, loadctx->tree, name,
DNS_DBNAMESPACE_NORMAL);
} }
loading_addnode(loadctx, name, rdataset->type, rdataset->covers, &node); loading_addnode(loadctx, name, rdataset->type, rdataset->covers, &node);
@ -2548,7 +2550,8 @@ findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create,
bool nsec3, dns_dbnode_t **nodep DNS__DB_FLARG) { bool nsec3, dns_dbnode_t **nodep DNS__DB_FLARG) {
isc_result_t result; isc_result_t result;
qpznode_t *node = NULL; qpznode_t *node = NULL;
dns_namespace_t nspace = nsec3 ? DNS_DB_NSEC_NSEC3 : DNS_DB_NSEC_NORMAL; dns_namespace_t nspace = nsec3 ? DNS_DBNAMESPACE_NSEC3
: DNS_DBNAMESPACE_NORMAL;
dns_qpread_t qpr = { 0 }; dns_qpread_t qpr = { 0 };
dns_qp_t *qp = NULL; dns_qp_t *qp = NULL;
@ -2580,7 +2583,7 @@ findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create,
} }
} }
INSIST(node->nspace == DNS_DB_NSEC_NSEC3 || !nsec3); INSIST(node->nspace == DNS_DBNAMESPACE_NSEC3 || !nsec3);
qpznode_acquire(qpdb, node DNS__DB_FLARG_PASS); qpznode_acquire(qpdb, node DNS__DB_FLARG_PASS);
@ -3026,7 +3029,7 @@ previous_closest_nsec(dns_rdatatype_t type, qpz_search_t *search,
* It is the first node sought in the NSEC tree. * It is the first node sought in the NSEC tree.
*/ */
*firstp = false; *firstp = false;
result = dns_qp_lookup(&qpr, name, DNS_DB_NSEC_NSEC, result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NSEC,
NULL, nit, NULL, NULL, NULL); NULL, nit, NULL, NULL, NULL);
INSIST(result != ISC_R_NOTFOUND); INSIST(result != ISC_R_NOTFOUND);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
@ -3060,9 +3063,9 @@ previous_closest_nsec(dns_rdatatype_t type, qpz_search_t *search,
} }
*nodep = NULL; *nodep = NULL;
result = dns_qp_lookup(&search->qpr, name, DNS_DB_NSEC_NORMAL, result = dns_qp_lookup(
NULL, &search->iter, &search->chain, &search->qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
(void **)nodep, NULL); &search->iter, &search->chain, (void **)nodep, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
break; break;
} }
@ -3454,9 +3457,9 @@ qpzone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
if ((options & DNS_DBFIND_FORCENSEC3) != 0) { if ((options & DNS_DBFIND_FORCENSEC3) != 0) {
nsec3 = true; nsec3 = true;
nspace = DNS_DB_NSEC_NSEC3; nspace = DNS_DBNAMESPACE_NSEC3;
} else { } else {
nspace = DNS_DB_NSEC_NORMAL; nspace = DNS_DBNAMESPACE_NORMAL;
} }
dns_qpmulti_query(qpdb->tree, &search.qpr); dns_qpmulti_query(qpdb->tree, &search.qpr);
@ -4310,7 +4313,7 @@ dbiterator_first(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* If we immediately hit an NSEC/NSEC3 node, * If we immediately hit an NSEC/NSEC3 node,
* we don't have any non-nsec nodes. * we don't have any non-nsec nodes.
*/ */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NORMAL) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NORMAL) {
qpdbiter->node = NULL; qpdbiter->node = NULL;
result = ISC_R_NOMORE; result = ISC_R_NOMORE;
} }
@ -4334,10 +4337,10 @@ dbiterator_first(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* If we hit an NSEC node, we need to start at the NSEC3 part of * If we hit an NSEC node, we need to start at the NSEC3 part of
* the tree. * the tree.
*/ */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NSEC) {
break; break;
} }
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC); INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
/* FALLTHROUGH */ /* FALLTHROUGH */
case nsec3only: case nsec3only:
@ -4346,8 +4349,9 @@ dbiterator_first(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* origin node. * origin node.
*/ */
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter, DNS_DBNAMESPACE_NSEC3, NULL,
NULL, (void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS || if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter)) QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{ {
@ -4397,7 +4401,8 @@ dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) {
/* tree only has NSEC3 origin node. */ /* tree only has NSEC3 origin node. */
qpdbiter->node = NULL; qpdbiter->node = NULL;
result = ISC_R_NOMORE; result = ISC_R_NOMORE;
} else if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC3) } else if (qpdbiter->node->nspace !=
DNS_DBNAMESPACE_NSEC3)
{ {
/* tree has no NSEC3 nodes at all. */ /* tree has no NSEC3 nodes at all. */
qpdbiter->node = NULL; qpdbiter->node = NULL;
@ -4423,10 +4428,10 @@ dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* If we hit an NSEC node, we need to seek the final normal node * If we hit an NSEC node, we need to seek the final normal node
* of the tree. * of the tree.
*/ */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NSEC) {
break; break;
} }
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC); INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
/* FALLTHROUGH */ /* FALLTHROUGH */
case nonsec3: case nonsec3:
@ -4434,8 +4439,9 @@ dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* The final non-nsec node is before the the NSEC origin node. * The final non-nsec node is before the the NSEC origin node.
*/ */
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter, DNS_DBNAMESPACE_NSEC, NULL,
NULL, (void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter)); INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter));
/* skip the NSEC origin node */ /* skip the NSEC origin node */
@ -4452,7 +4458,8 @@ dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) {
(void **)&qpdbiter->node, (void **)&qpdbiter->node,
NULL); NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NORMAL); INSIST(qpdbiter->node->nspace ==
DNS_DBNAMESPACE_NORMAL);
} }
break; break;
default: default:
@ -4486,22 +4493,22 @@ dbiterator_seek(dns_dbiterator_t *iterator,
switch (qpdbiter->nsec3mode) { switch (qpdbiter->nsec3mode) {
case nsec3only: case nsec3only:
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NSEC3, result = dns_qp_lookup(
NULL, &qpdbiter->iter, NULL, qpdbiter->snap, name, DNS_DBNAMESPACE_NSEC3, NULL,
(void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
break; break;
case nonsec3: case nonsec3:
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL, result = dns_qp_lookup(
NULL, &qpdbiter->iter, NULL, qpdbiter->snap, name, DNS_DBNAMESPACE_NORMAL, NULL,
(void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
break; break;
case full: case full:
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL, result = dns_qp_lookup(
NULL, &qpdbiter->iter, NULL, qpdbiter->snap, name, DNS_DBNAMESPACE_NORMAL, NULL,
(void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
tresult = dns_qp_lookup(qpdbiter->snap, name, tresult = dns_qp_lookup(qpdbiter->snap, name,
DNS_DB_NSEC_NSEC3, NULL, DNS_DBNAMESPACE_NSEC3, NULL,
&qpdbiter->iter, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL); (void **)&qpdbiter->node, NULL);
if (tresult == ISC_R_SUCCESS) { if (tresult == ISC_R_SUCCESS) {
@ -4548,7 +4555,8 @@ dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) {
/* we hit the NSEC3 origin node. */ /* we hit the NSEC3 origin node. */
qpdbiter->node = NULL; qpdbiter->node = NULL;
result = ISC_R_NOMORE; result = ISC_R_NOMORE;
} else if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC3) } else if (qpdbiter->node->nspace !=
DNS_DBNAMESPACE_NSEC3)
{ {
/* we hit a non-NSEC3 node. */ /* we hit a non-NSEC3 node. */
qpdbiter->node = NULL; qpdbiter->node = NULL;
@ -4574,14 +4582,15 @@ dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* If we hit an NSEC node, we need to seek the final normal node * If we hit an NSEC node, we need to seek the final normal node
* of the tree. * of the tree.
*/ */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NSEC) {
break; break;
} }
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC); INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter, DNS_DBNAMESPACE_NSEC, NULL,
NULL, (void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter)); INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter));
@ -4599,7 +4608,8 @@ dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) {
(void **)&qpdbiter->node, (void **)&qpdbiter->node,
NULL); NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NORMAL); INSIST(qpdbiter->node->nspace ==
DNS_DBNAMESPACE_NORMAL);
} }
break; break;
case nonsec3: case nonsec3:
@ -4639,7 +4649,7 @@ dbiterator_next(dns_dbiterator_t *iterator DNS__DB_FLARG) {
case nonsec3: case nonsec3:
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
/* we hit an NSEC or NSEC3 node. */ /* we hit an NSEC or NSEC3 node. */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NORMAL) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NORMAL) {
qpdbiter->node = NULL; qpdbiter->node = NULL;
result = ISC_R_NOMORE; result = ISC_R_NOMORE;
} }
@ -4663,14 +4673,15 @@ dbiterator_next(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* If we hit an NSEC node, we need to start at the NSEC3 part of * If we hit an NSEC node, we need to start at the NSEC3 part of
* the tree. * the tree.
*/ */
if (qpdbiter->node->nspace != DNS_DB_NSEC_NSEC) { if (qpdbiter->node->nspace != DNS_DBNAMESPACE_NSEC) {
break; break;
} }
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC); INSIST(qpdbiter->node->nspace == DNS_DBNAMESPACE_NSEC);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter, DNS_DBNAMESPACE_NSEC3, NULL,
NULL, (void **)&qpdbiter->node, NULL); &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS || if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter)) QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{ {
@ -4774,7 +4785,7 @@ qpzone_createiterator(dns_db_t *db, unsigned int options,
* seek the NSEC3 origin node. * seek the NSEC3 origin node.
*/ */
result = dns_qp_lookup(iter->snap, &qpdb->common.origin, result = dns_qp_lookup(iter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &iter->iter, DNS_DBNAMESPACE_NSEC3, NULL, &iter->iter,
NULL, NULL, NULL); NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
break; break;
@ -4814,10 +4825,10 @@ qpzone_addrdataset(dns_db_t *db, dns_dbnode_t *dbnode,
return DNS_R_NOTZONETOP; return DNS_R_NOTZONETOP;
} }
REQUIRE((node->nspace == DNS_DB_NSEC_NSEC3 && REQUIRE((node->nspace == DNS_DBNAMESPACE_NSEC3 &&
(rdataset->type == dns_rdatatype_nsec3 || (rdataset->type == dns_rdatatype_nsec3 ||
rdataset->covers == dns_rdatatype_nsec3)) || rdataset->covers == dns_rdatatype_nsec3)) ||
(node->nspace != DNS_DB_NSEC_NSEC3 && (node->nspace != DNS_DBNAMESPACE_NSEC3 &&
rdataset->type != dns_rdatatype_nsec3 && rdataset->type != dns_rdatatype_nsec3 &&
rdataset->covers != dns_rdatatype_nsec3)); rdataset->covers != dns_rdatatype_nsec3));
@ -4884,7 +4895,7 @@ qpzone_addrdataset(dns_db_t *db, dns_dbnode_t *dbnode,
* move on. * move on.
*/ */
qpznode_t *nsecnode = new_qpznode(qpdb, name); qpznode_t *nsecnode = new_qpznode(qpdb, name);
nsecnode->nspace = DNS_DB_NSEC_NSEC; nsecnode->nspace = DNS_DBNAMESPACE_NSEC;
(void)dns_qp_insert(nsec, nsecnode, 0); (void)dns_qp_insert(nsec, nsecnode, 0);
qpznode_detach(&nsecnode); qpznode_detach(&nsecnode);
} }
@ -4935,10 +4946,10 @@ qpzone_subtractrdataset(dns_db_t *db, dns_dbnode_t *dbnode,
REQUIRE(VALID_QPZONE(qpdb)); REQUIRE(VALID_QPZONE(qpdb));
REQUIRE(version != NULL && version->qpdb == qpdb); REQUIRE(version != NULL && version->qpdb == qpdb);
REQUIRE((node->nspace == DNS_DB_NSEC_NSEC3 && REQUIRE((node->nspace == DNS_DBNAMESPACE_NSEC3 &&
(rdataset->type == dns_rdatatype_nsec3 || (rdataset->type == dns_rdatatype_nsec3 ||
rdataset->covers == dns_rdatatype_nsec3)) || rdataset->covers == dns_rdatatype_nsec3)) ||
(node->nspace != DNS_DB_NSEC_NSEC3 && (node->nspace != DNS_DBNAMESPACE_NSEC3 &&
rdataset->type != dns_rdatatype_nsec3 && rdataset->type != dns_rdatatype_nsec3 &&
rdataset->covers != dns_rdatatype_nsec3)); rdataset->covers != dns_rdatatype_nsec3));

View File

@ -1422,7 +1422,8 @@ add_nm(dns_rpz_zones_t *rpzs, dns_name_t *trig_name, const nmdata_t *new_data) {
dns_qp_t *qp = NULL; dns_qp_t *qp = NULL;
dns_qpmulti_write(rpzs->table, &qp); dns_qpmulti_write(rpzs->table, &qp);
result = dns_qp_getname(qp, trig_name, 0, (void **)&data, NULL); result = dns_qp_getname(qp, trig_name, DNS_DBNAMESPACE_NORMAL,
(void **)&data, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
INSIST(data == NULL); INSIST(data == NULL);
data = new_nmdata(rpzs->mctx, trig_name, new_data); data = new_nmdata(rpzs->mctx, trig_name, new_data);
@ -2291,7 +2292,8 @@ del_name(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
trig_name = dns_fixedname_initname(&trig_namef); trig_name = dns_fixedname_initname(&trig_namef);
name2data(rpz, rpz_type, src_name, trig_name, &del_data); name2data(rpz, rpz_type, src_name, trig_name, &del_data);
result = dns_qp_getname(qp, trig_name, 0, (void **)&data, NULL); result = dns_qp_getname(qp, trig_name, DNS_DBNAMESPACE_NORMAL,
(void **)&data, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return; return;
} }
@ -2314,7 +2316,8 @@ del_name(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
if (data->set.qname == 0 && data->set.ns == 0 && if (data->set.qname == 0 && data->set.ns == 0 &&
data->wild.qname == 0 && data->wild.ns == 0) data->wild.qname == 0 && data->wild.ns == 0)
{ {
result = dns_qp_deletename(qp, trig_name, 0, NULL, NULL); result = dns_qp_deletename(qp, trig_name,
DNS_DBNAMESPACE_NORMAL, NULL, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
/* /*
* bin/tests/system/rpz/tests.sh looks for * bin/tests/system/rpz/tests.sh looks for
@ -2516,8 +2519,8 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
dns_qpmulti_query(rpzs->table, &qpr); dns_qpmulti_query(rpzs->table, &qpr);
dns_qpchain_init(&qpr, &chain); dns_qpchain_init(&qpr, &chain);
result = dns_qp_lookup(&qpr, trig_name, 0, NULL, NULL, &chain, result = dns_qp_lookup(&qpr, trig_name, DNS_DBNAMESPACE_NORMAL, NULL,
(void **)&data, NULL); NULL, &chain, (void **)&data, NULL);
switch (result) { switch (result) {
case ISC_R_SUCCESS: case ISC_R_SUCCESS:
INSIST(data != NULL); INSIST(data != NULL);
@ -2667,7 +2670,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval, qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
nmdata_t *data = pval; nmdata_t *data = pval;
return dns_qpkey_fromname(key, &data->name, 0); return dns_qpkey_fromname(key, &data->name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -77,7 +77,7 @@ ztqpmakekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) { uint32_t ival ISC_ATTR_UNUSED) {
dns_zone_t *zone = pval; dns_zone_t *zone = pval;
dns_name_t *name = dns_zone_getorigin(zone); dns_name_t *name = dns_zone_getorigin(zone);
return dns_qpkey_fromname(key, name, 0); return dns_qpkey_fromname(key, name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void
@ -156,7 +156,8 @@ dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone) {
REQUIRE(VALID_ZT(zt)); REQUIRE(VALID_ZT(zt));
dns_qpmulti_write(zt->multi, &qp); dns_qpmulti_write(zt->multi, &qp);
result = dns_qp_deletename(qp, dns_zone_getorigin(zone), 0, NULL, NULL); result = dns_qp_deletename(qp, dns_zone_getorigin(zone),
DNS_DBNAMESPACE_NORMAL, NULL, NULL);
dns_qp_compact(qp, DNS_QPGC_MAYBE); dns_qp_compact(qp, DNS_QPGC_MAYBE);
dns_qpmulti_commit(zt->multi, &qp); dns_qpmulti_commit(zt->multi, &qp);
@ -179,10 +180,11 @@ dns_zt_find(dns_zt_t *zt, const dns_name_t *name, dns_ztfind_t options,
dns_qpmulti_query(zt->multi, &qpr); dns_qpmulti_query(zt->multi, &qpr);
if (exactopts == DNS_ZTFIND_EXACT) { if (exactopts == DNS_ZTFIND_EXACT) {
result = dns_qp_getname(&qpr, name, 0, &pval, NULL); result = dns_qp_getname(&qpr, name, DNS_DBNAMESPACE_NORMAL,
&pval, NULL);
} else { } else {
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, &chain, &pval, result = dns_qp_lookup(&qpr, name, DNS_DBNAMESPACE_NORMAL, NULL,
NULL); NULL, &chain, &pval, NULL);
if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS) if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS)
{ {
/* get pval from the previous chain link */ /* get pval from the previous chain link */

View File

@ -66,7 +66,8 @@ static size_t
item_makekey(dns_qpkey_t key, void *ctx, void *pval, uint32_t ival) { item_makekey(dns_qpkey_t key, void *ctx, void *pval, uint32_t ival) {
UNUSED(ctx); UNUSED(ctx);
assert(pval == &item[ival]); assert(pval == &item[ival]);
return dns_qpkey_fromname(key, &item[ival].fixed.name, 0); return dns_qpkey_fromname(key, &item[ival].fixed.name,
DNS_DBNAMESPACE_NORMAL);
} }
static void static void
@ -325,7 +326,8 @@ sqz_qp(void *qp) {
static isc_result_t static isc_result_t
get_qp(void *qp, size_t count, void **pval) { get_qp(void *qp, size_t count, void **pval) {
return dns_qp_getname(qp, &item[count].fixed.name, 0, pval, NULL); return dns_qp_getname(qp, &item[count].fixed.name,
DNS_DBNAMESPACE_NORMAL, pval, NULL);
} }
static void * static void *

View File

@ -87,7 +87,7 @@ qpkey_from_smallname(dns_qpkey_t key, void *ctx, void *pval, uint32_t ival) {
UNUSED(ctx); UNUSED(ctx);
dns_name_t name = DNS_NAME_INITEMPTY; dns_name_t name = DNS_NAME_INITEMPTY;
name_from_smallname(&name, pval, ival); name_from_smallname(&name, pval, ival);
return dns_qpkey_fromname(key, &name, 0); return dns_qpkey_fromname(key, &name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void

View File

@ -81,7 +81,7 @@ qpkey_from_smallname(dns_qpkey_t key, void *ctx, void *pval, uint32_t ival) {
UNUSED(ctx); UNUSED(ctx);
dns_name_t name = DNS_NAME_INITEMPTY; dns_name_t name = DNS_NAME_INITEMPTY;
name_from_smallname(&name, pval, ival); name_from_smallname(&name, pval, ival);
return dns_qpkey_fromname(key, &name, 0); return dns_qpkey_fromname(key, &name, DNS_DBNAMESPACE_NORMAL);
} }
static void static void
@ -228,7 +228,7 @@ main(int argc, char **argv) {
start = isc_time_monotonic(); start = isc_time_monotonic();
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
name = dns_fixedname_name(&items[i]); name = dns_fixedname_name(&items[i]);
dns_qp_getname(qp, name, 0, NULL, NULL); dns_qp_getname(qp, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL);
} }
stop = isc_time_monotonic(); stop = isc_time_monotonic();
@ -238,7 +238,8 @@ main(int argc, char **argv) {
start = isc_time_monotonic(); start = isc_time_monotonic();
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
name = dns_fixedname_name(&items[i]); name = dns_fixedname_name(&items[i]);
dns_qp_lookup(qp, name, 0, NULL, NULL, NULL, NULL, NULL); dns_qp_lookup(qp, name, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, NULL, NULL);
} }
stop = isc_time_monotonic(); stop = isc_time_monotonic();
@ -263,7 +264,8 @@ main(int argc, char **argv) {
++search->ndata[1]; ++search->ndata[1];
} }
dns_qp_lookup(qp, search, 0, NULL, NULL, NULL, NULL, NULL); dns_qp_lookup(qp, search, DNS_DBNAMESPACE_NORMAL, NULL, NULL,
NULL, NULL, NULL);
} }
stop = isc_time_monotonic(); stop = isc_time_monotonic();

File diff suppressed because it is too large Load Diff

View File

@ -349,8 +349,9 @@ qp_test_printkey(const dns_qpkey_t key, size_t keylen) {
dns_qpkey_toname(key, keylen, n, &s); dns_qpkey_toname(key, keylen, n, &s);
dns_name_format(n, txt, sizeof(txt)); dns_name_format(n, txt, sizeof(txt));
printf("%s%s%s\n", txt, printf("%s%s%s\n", txt,
s == DNS_DB_NSEC_NSEC3 ? "NSEC3:" s == DNS_DBNAMESPACE_NSEC3
: (s == DNS_DB_NSEC_NSEC ? "NSEC" : ""), ? "NSEC3:"
: (s == DNS_DBNAMESPACE_NSEC ? "NSEC" : ""),
dns_name_isabsolute(n) ? "." : ""); dns_name_isabsolute(n) ? "." : "");
} }