2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 01:59:26 +00:00

Rename dns_qp_lookup2 back to dns_qp_lookup

Now that we have to code working, rename 'dns_qp_lookup2' back to
'dns_qp_lookup' and adjust all remaining 'dns_qp_lookup' occurrences
to take a space=0 parameter.
This commit is contained in:
Matthijs Mekking 2025-05-27 10:57:11 +02:00
parent e052e14b40
commit a7021a3a51
12 changed files with 62 additions and 81 deletions

View File

@ -163,7 +163,7 @@ dns_fwdtable_find(dns_fwdtable_t *fwdtable, const dns_name_t *name,
REQUIRE(VALID_FWDTABLE(fwdtable));
dns_qpmulti_query(fwdtable->table, &qpr);
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, &pval, NULL);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
dns_forwarders_t *fwdrs = pval;
*forwardersp = fwdrs;

View File

@ -545,11 +545,12 @@ dns_qp_getname(dns_qpreadable_t qpr, const dns_name_t *name,
isc_result_t
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
dns_name_t *foundname, dns_qpiter_t *iter, dns_qpchain_t *chain,
void **pval_r, uint32_t *ival_r);
dns_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
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,
* 'name'.
* 'name' in the namespace 'space'. The namespace can either be
* 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
* that was found (if any). The return code, ISC_R_SUCCESS or
@ -587,16 +588,6 @@ dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
* \li ISC_R_NOTFOUND if no match was found
*/
isc_result_t
dns_qp_lookup2(dns_qpreadable_t qpr, const dns_name_t *name,
dns_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r);
/*%<
* The same as 'dns_qp_lookup', but with the possibility to set a namespace,
* either DNS_DB_NSEC_NORMAL (or 0, which is the equivalent of 'dns_qp_lookup'),
* DNS_DB_NSEC_NSEC, OR DNS_DB_NSEC3.
*/
isc_result_t
dns_qp_insert(dns_qp_t *qp, void *pval, uint32_t ival);
/*%<

View File

@ -506,7 +506,7 @@ dns_keytable_finddeepestmatch(dns_keytable_t *keytable, const dns_name_t *name,
REQUIRE(foundname != NULL);
dns_qpmulti_query(keytable->table, &qpr);
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, &pval, NULL);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL);
keynode = pval;
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
@ -535,7 +535,7 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name,
REQUIRE(wantdnssecp != NULL);
dns_qpmulti_query(keytable->table, &qpr);
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, &pval, NULL);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
keynode = pval;
if (foundname != NULL) {

View File

@ -278,7 +278,7 @@ dns_nametree_covered(dns_nametree_t *nametree, const dns_name_t *name,
REQUIRE(VALID_NAMETREE(nametree));
dns_qpmulti_query(nametree->table, &qpr);
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, (void **)&node,
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, (void **)&node,
NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
if (found != NULL) {

View File

@ -412,7 +412,7 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now,
RWLOCK(&ntatable->rwlock, isc_rwlocktype_read);
dns_qpmulti_query(ntatable->table, &qpr);
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, &pval, NULL);
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL);
nta = pval;
switch (result) {

View File

@ -2285,9 +2285,9 @@ fix_chain(dns_qpchain_t *chain, size_t offset) {
}
isc_result_t
dns_qp_lookup2(dns_qpreadable_t qpr, const dns_name_t *name,
dns_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r) {
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
dns_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r) {
dns_qpreader_t *qp = dns_qpreader(qpr);
dns_qpkey_t search, found;
size_t searchlen, foundlen;
@ -2433,12 +2433,4 @@ dns_qp_lookup2(dns_qpreadable_t qpr, const dns_name_t *name,
return ISC_R_NOTFOUND;
}
isc_result_t
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
dns_name_t *foundname, dns_qpiter_t *iter, dns_qpchain_t *chain,
void **pval_r, uint32_t *ival_r) {
return dns_qp_lookup2(qpr, name, 0, foundname, iter, chain, pval_r,
ival_r);
}
/**********************************************************************/

View File

@ -1395,8 +1395,8 @@ find_coveringnsec(qpc_search_t *search, const dns_name_t *name,
/*
* Look for the node in the auxilary tree.
*/
result = dns_qp_lookup2(search->qpdb->nsec, name, DNS_DB_NSEC_NSEC,
NULL, &iter, NULL, (void **)&node, NULL);
result = dns_qp_lookup(search->qpdb->nsec, name, DNS_DB_NSEC_NSEC, NULL,
&iter, NULL, (void **)&node, NULL);
if (result != DNS_R_PARTIALMATCH) {
return ISC_R_NOTFOUND;
}
@ -1524,7 +1524,7 @@ qpcache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
/*
* Search down from the root of the tree.
*/
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
result = dns_qp_lookup(search.qpdb->tree, name, 0, NULL, NULL,
&search.chain, (void **)&node, NULL);
if (result != ISC_R_NOTFOUND && foundname != NULL) {
dns_name_copy(&node->name, foundname);
@ -1964,7 +1964,7 @@ qpcache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
/*
* Search down from the root of the tree.
*/
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
result = dns_qp_lookup(search.qpdb->tree, name, 0, NULL, NULL,
&search.chain, (void **)&node, NULL);
switch (result) {
@ -3427,7 +3427,7 @@ resume_iteration(qpc_dbit_t *qpdbiter, bool continuing) {
*/
if (continuing && qpdbiter->node != NULL) {
isc_result_t result;
result = dns_qp_lookup(qpdb->tree, qpdbiter->name, NULL,
result = dns_qp_lookup(qpdb->tree, qpdbiter->name, 0, NULL,
&qpdbiter->iter, NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS);
}
@ -3555,7 +3555,7 @@ dbiterator_seek(dns_dbiterator_t *iterator,
dereference_iter_node(qpdbiter DNS__DB_FLARG_PASS);
result = dns_qp_lookup(qpdb->tree, name, NULL, &qpdbiter->iter, NULL,
result = dns_qp_lookup(qpdb->tree, name, 0, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {

View File

@ -2934,9 +2934,9 @@ find_wildcard(qpz_search_t *search, qpznode_t **nodep, const dns_name_t *qname,
break;
}
result = dns_qp_lookup2(&search->qpr, wname, nspace,
NULL, &wit, NULL,
(void **)&wnode, NULL);
result = dns_qp_lookup(&search->qpr, wname, nspace,
NULL, &wit, NULL,
(void **)&wnode, NULL);
if (result == ISC_R_SUCCESS) {
/*
* We have found the wildcard node. If it
@ -3026,8 +3026,8 @@ previous_closest_nsec(dns_rdatatype_t type, qpz_search_t *search,
* It is the first node sought in the NSEC tree.
*/
*firstp = false;
result = dns_qp_lookup2(&qpr, name, DNS_DB_NSEC_NSEC,
NULL, nit, NULL, NULL, NULL);
result = dns_qp_lookup(&qpr, name, DNS_DB_NSEC_NSEC,
NULL, nit, NULL, NULL, NULL);
INSIST(result != ISC_R_NOTFOUND);
if (result == ISC_R_SUCCESS) {
/*
@ -3060,9 +3060,9 @@ previous_closest_nsec(dns_rdatatype_t type, qpz_search_t *search,
}
*nodep = NULL;
result = dns_qp_lookup2(&search->qpr, name, DNS_DB_NSEC_NORMAL,
NULL, &search->iter, &search->chain,
(void **)nodep, NULL);
result = dns_qp_lookup(&search->qpr, name, DNS_DB_NSEC_NORMAL,
NULL, &search->iter, &search->chain,
(void **)nodep, NULL);
if (result == ISC_R_SUCCESS) {
break;
}
@ -3463,8 +3463,8 @@ qpzone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
/*
* Search down from the root of the tree.
*/
result = dns_qp_lookup2(&search.qpr, name, nspace, NULL, &search.iter,
&search.chain, (void **)&node, NULL);
result = dns_qp_lookup(&search.qpr, name, nspace, NULL, &search.iter,
&search.chain, (void **)&node, NULL);
if (result != ISC_R_NOTFOUND) {
dns_name_copy(&node->name, foundname);
}
@ -4345,10 +4345,9 @@ dbiterator_first(dns_dbiterator_t *iterator DNS__DB_FLARG) {
* NSEC3 follows after all non-nsec3 nodes, seek the NSEC3
* origin node.
*/
result = dns_qp_lookup2(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL,
&qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{
@ -4434,9 +4433,9 @@ dbiterator_last(dns_dbiterator_t *iterator DNS__DB_FLARG) {
/*
* The final non-nsec node is before the the NSEC origin node.
*/
result = dns_qp_lookup2(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) {
INSIST(QPDBITER_NSEC_ORIGIN_NODE(qpdb, qpdbiter));
/* skip the NSEC origin node */
@ -4487,24 +4486,24 @@ dbiterator_seek(dns_dbiterator_t *iterator,
switch (qpdbiter->nsec3mode) {
case nsec3only:
result = dns_qp_lookup2(qpdbiter->snap, name, DNS_DB_NSEC_NSEC3,
NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NSEC3,
NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
break;
case nonsec3:
result = dns_qp_lookup(qpdbiter->snap, name, NULL,
&qpdbiter->iter, NULL,
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL,
NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
break;
case full:
result = dns_qp_lookup(qpdbiter->snap, name, NULL,
&qpdbiter->iter, NULL,
result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL,
NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS) {
tresult = dns_qp_lookup2(
qpdbiter->snap, name, DNS_DB_NSEC_NSEC3, NULL,
&qpdbiter->iter, NULL, (void **)&qpdbiter->node,
NULL);
tresult = dns_qp_lookup(qpdbiter->snap, name,
DNS_DB_NSEC_NSEC3, NULL,
&qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
if (tresult == ISC_R_SUCCESS) {
result = tresult;
}
@ -4580,7 +4579,7 @@ dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) {
}
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC);
result = dns_qp_lookup2(qpdbiter->snap, &qpdb->common.origin,
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL);
@ -4669,10 +4668,9 @@ dbiterator_next(dns_dbiterator_t *iterator DNS__DB_FLARG) {
}
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC);
result = dns_qp_lookup2(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL,
&qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL);
result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS ||
QPDBITER_NSEC3_ORIGIN_NODE(qpdb, qpdbiter))
{
@ -4775,9 +4773,9 @@ qpzone_createiterator(dns_db_t *db, unsigned int options,
* NSEC3 follows after all non-nsec3 nodes,
* seek the NSEC3 origin node.
*/
result = dns_qp_lookup2(iter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &iter->iter,
NULL, NULL, NULL);
result = dns_qp_lookup(iter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &iter->iter,
NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS);
break;
default:

View File

@ -2516,7 +2516,7 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
dns_qpmulti_query(rpzs->table, &qpr);
dns_qpchain_init(&qpr, &chain);
result = dns_qp_lookup(&qpr, trig_name, NULL, NULL, &chain,
result = dns_qp_lookup(&qpr, trig_name, 0, NULL, NULL, &chain,
(void **)&data, NULL);
switch (result) {
case ISC_R_SUCCESS:

View File

@ -181,7 +181,7 @@ dns_zt_find(dns_zt_t *zt, const dns_name_t *name, dns_ztfind_t options,
if (exactopts == DNS_ZTFIND_EXACT) {
result = dns_qp_getname(&qpr, name, 0, &pval, NULL);
} else {
result = dns_qp_lookup(&qpr, name, NULL, NULL, &chain, &pval,
result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, &chain, &pval,
NULL);
if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS)
{

View File

@ -238,7 +238,7 @@ main(int argc, char **argv) {
start = isc_time_monotonic();
for (i = 0; i < n; i++) {
name = dns_fixedname_name(&items[i]);
dns_qp_lookup(qp, name, 0, NULL, NULL, NULL, NULL);
dns_qp_lookup(qp, name, 0, NULL, NULL, NULL, NULL, NULL);
}
stop = isc_time_monotonic();
@ -263,7 +263,7 @@ main(int argc, char **argv) {
++search->ndata[1];
}
dns_qp_lookup(qp, search, 0, NULL, NULL, NULL, NULL);
dns_qp_lookup(qp, search, 0, NULL, NULL, NULL, NULL, NULL);
}
stop = isc_time_monotonic();

View File

@ -415,8 +415,8 @@ check_partialmatch(dns_qp_t *qp, struct check_partialmatch check[],
void *pval = NULL;
dns_test_namefromstring(check[i].query, &fn1);
result = dns_qp_lookup2(qp, name, space, foundname, NULL, NULL,
&pval, NULL);
result = dns_qp_lookup(qp, name, space, foundname, NULL, NULL,
&pval, NULL);
#if 0
fprintf(stderr, "%s%s %s (expected %s) "
@ -578,8 +578,8 @@ check_qpchainiter(dns_qp_t *qp, struct check_qpchain check[],
dns_qpchain_init(qp, &chain);
dns_test_namefromstring(check[i].query, &fn1);
result = dns_qp_lookup2(qp, name, check[i].space, NULL, iter,
&chain, NULL, NULL);
result = dns_qp_lookup(qp, name, check[i].space, NULL, iter,
&chain, NULL, NULL);
#if 0
fprintf(stderr,
"%s %s (expected %s), "
@ -800,8 +800,8 @@ check_predecessors_withchain(dns_qp_t *qp, struct check_predecessors check[],
result = dns_name_tostring(expred, &predstr, mctx);
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_qp_lookup2(qp, name, check[i].space, NULL, &it,
chain, NULL, NULL);
result = dns_qp_lookup(qp, name, check[i].space, NULL, &it,
chain, NULL, NULL);
#if 0
fprintf(stderr, "%s %s: expected %s got %s\n", check[i].query,
check[i].space == DNS_DB_NSEC_NSEC3