2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 10:10:06 +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)); REQUIRE(VALID_FWDTABLE(fwdtable));
dns_qpmulti_query(fwdtable->table, &qpr); 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) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
dns_forwarders_t *fwdrs = pval; dns_forwarders_t *fwdrs = pval;
*forwardersp = fwdrs; *forwardersp = fwdrs;

View File

@ -545,11 +545,12 @@ dns_qp_getname(dns_qpreadable_t qpr, const dns_name_t *name,
isc_result_t isc_result_t
dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name, dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
dns_name_t *foundname, dns_qpiter_t *iter, dns_qpchain_t *chain, dns_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
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'. * '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 * 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
@ -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 * \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 isc_result_t
dns_qp_insert(dns_qp_t *qp, void *pval, uint32_t ival); 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); REQUIRE(foundname != NULL);
dns_qpmulti_query(keytable->table, &qpr); 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; keynode = pval;
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { 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); REQUIRE(wantdnssecp != NULL);
dns_qpmulti_query(keytable->table, &qpr); 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) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
keynode = pval; keynode = pval;
if (foundname != NULL) { 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)); REQUIRE(VALID_NAMETREE(nametree));
dns_qpmulti_query(nametree->table, &qpr); 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); 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) {

View File

@ -412,7 +412,7 @@ 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, NULL, NULL, NULL, &pval, NULL); result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, NULL, &pval, NULL);
nta = pval; nta = pval;
switch (result) { switch (result) {

View File

@ -2285,7 +2285,7 @@ fix_chain(dns_qpchain_t *chain, size_t offset) {
} }
isc_result_t isc_result_t
dns_qp_lookup2(dns_qpreadable_t qpr, const dns_name_t *name, 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_namespace_t space, dns_name_t *foundname, dns_qpiter_t *iter,
dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r) { dns_qpchain_t *chain, void **pval_r, uint32_t *ival_r) {
dns_qpreader_t *qp = dns_qpreader(qpr); dns_qpreader_t *qp = dns_qpreader(qpr);
@ -2433,12 +2433,4 @@ dns_qp_lookup2(dns_qpreadable_t qpr, const dns_name_t *name,
return ISC_R_NOTFOUND; 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. * Look for the node in the auxilary tree.
*/ */
result = dns_qp_lookup2(search->qpdb->nsec, name, DNS_DB_NSEC_NSEC, result = dns_qp_lookup(search->qpdb->nsec, name, DNS_DB_NSEC_NSEC, NULL,
NULL, &iter, NULL, (void **)&node, NULL); &iter, NULL, (void **)&node, NULL);
if (result != DNS_R_PARTIALMATCH) { if (result != DNS_R_PARTIALMATCH) {
return ISC_R_NOTFOUND; 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. * 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); &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,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. * 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); &search.chain, (void **)&node, NULL);
switch (result) { switch (result) {
@ -3427,7 +3427,7 @@ 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, NULL, result = dns_qp_lookup(qpdb->tree, qpdbiter->name, 0, NULL,
&qpdbiter->iter, NULL, NULL, NULL); &qpdbiter->iter, NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
} }
@ -3555,7 +3555,7 @@ 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, NULL, &qpdbiter->iter, NULL, result = dns_qp_lookup(qpdb->tree, name, 0, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL); (void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {

View File

@ -2934,7 +2934,7 @@ find_wildcard(qpz_search_t *search, qpznode_t **nodep, const dns_name_t *qname,
break; break;
} }
result = dns_qp_lookup2(&search->qpr, wname, nspace, result = dns_qp_lookup(&search->qpr, wname, nspace,
NULL, &wit, NULL, NULL, &wit, NULL,
(void **)&wnode, NULL); (void **)&wnode, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
@ -3026,7 +3026,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_lookup2(&qpr, name, DNS_DB_NSEC_NSEC, result = dns_qp_lookup(&qpr, name, DNS_DB_NSEC_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,7 +3060,7 @@ previous_closest_nsec(dns_rdatatype_t type, qpz_search_t *search,
} }
*nodep = NULL; *nodep = NULL;
result = dns_qp_lookup2(&search->qpr, name, DNS_DB_NSEC_NORMAL, result = dns_qp_lookup(&search->qpr, name, DNS_DB_NSEC_NORMAL,
NULL, &search->iter, &search->chain, NULL, &search->iter, &search->chain,
(void **)nodep, NULL); (void **)nodep, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
@ -3463,7 +3463,7 @@ qpzone_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_lookup2(&search.qpr, name, nspace, NULL, &search.iter, result = dns_qp_lookup(&search.qpr, name, nspace, NULL, &search.iter,
&search.chain, (void **)&node, NULL); &search.chain, (void **)&node, NULL);
if (result != ISC_R_NOTFOUND) { if (result != ISC_R_NOTFOUND) {
dns_name_copy(&node->name, foundname); 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 * NSEC3 follows after all non-nsec3 nodes, seek the NSEC3
* origin node. * origin node.
*/ */
result = dns_qp_lookup2(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter,
&qpdbiter->iter, NULL, NULL, (void **)&qpdbiter->node, 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))
{ {
@ -4434,7 +4433,7 @@ 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_lookup2(qpdbiter->snap, &qpdb->common.origin, result = dns_qp_lookup(qpdbiter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter, DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL); NULL, (void **)&qpdbiter->node, NULL);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
@ -4487,24 +4486,24 @@ dbiterator_seek(dns_dbiterator_t *iterator,
switch (qpdbiter->nsec3mode) { switch (qpdbiter->nsec3mode) {
case nsec3only: case nsec3only:
result = dns_qp_lookup2(qpdbiter->snap, name, DNS_DB_NSEC_NSEC3, result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NSEC3,
NULL, &qpdbiter->iter, NULL, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL); (void **)&qpdbiter->node, NULL);
break; break;
case nonsec3: case nonsec3:
result = dns_qp_lookup(qpdbiter->snap, name, NULL, result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL,
&qpdbiter->iter, NULL, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL); (void **)&qpdbiter->node, NULL);
break; break;
case full: case full:
result = dns_qp_lookup(qpdbiter->snap, name, NULL, result = dns_qp_lookup(qpdbiter->snap, name, DNS_DB_NSEC_NORMAL,
&qpdbiter->iter, NULL, NULL, &qpdbiter->iter, NULL,
(void **)&qpdbiter->node, NULL); (void **)&qpdbiter->node, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
tresult = dns_qp_lookup2( tresult = dns_qp_lookup(qpdbiter->snap, name,
qpdbiter->snap, name, DNS_DB_NSEC_NSEC3, NULL, DNS_DB_NSEC_NSEC3, NULL,
&qpdbiter->iter, NULL, (void **)&qpdbiter->node, &qpdbiter->iter, NULL,
NULL); (void **)&qpdbiter->node, NULL);
if (tresult == ISC_R_SUCCESS) { if (tresult == ISC_R_SUCCESS) {
result = tresult; result = tresult;
} }
@ -4580,7 +4579,7 @@ dbiterator_prev(dns_dbiterator_t *iterator DNS__DB_FLARG) {
} }
INSIST(qpdbiter->node->nspace == DNS_DB_NSEC_NSEC); 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, DNS_DB_NSEC_NSEC, NULL, &qpdbiter->iter,
NULL, (void **)&qpdbiter->node, NULL); 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); 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_NSEC3, NULL, DNS_DB_NSEC_NSEC3, NULL, &qpdbiter->iter,
&qpdbiter->iter, NULL, NULL, (void **)&qpdbiter->node, 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))
{ {
@ -4775,7 +4773,7 @@ qpzone_createiterator(dns_db_t *db, unsigned int options,
* NSEC3 follows after all non-nsec3 nodes, * NSEC3 follows after all non-nsec3 nodes,
* seek the NSEC3 origin node. * seek the NSEC3 origin node.
*/ */
result = dns_qp_lookup2(iter->snap, &qpdb->common.origin, result = dns_qp_lookup(iter->snap, &qpdb->common.origin,
DNS_DB_NSEC_NSEC3, NULL, &iter->iter, DNS_DB_NSEC_NSEC3, NULL, &iter->iter,
NULL, NULL, NULL); NULL, NULL, NULL);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);

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_qpmulti_query(rpzs->table, &qpr);
dns_qpchain_init(&qpr, &chain); 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); (void **)&data, NULL);
switch (result) { switch (result) {
case ISC_R_SUCCESS: 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) { if (exactopts == DNS_ZTFIND_EXACT) {
result = dns_qp_getname(&qpr, name, 0, &pval, NULL); result = dns_qp_getname(&qpr, name, 0, &pval, NULL);
} else { } else {
result = dns_qp_lookup(&qpr, name, NULL, NULL, &chain, &pval, result = dns_qp_lookup(&qpr, name, 0, NULL, NULL, &chain, &pval,
NULL); NULL);
if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS) if (exactopts == DNS_ZTFIND_NOEXACT && result == ISC_R_SUCCESS)
{ {

View File

@ -238,7 +238,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_lookup(qp, name, 0, NULL, NULL, NULL, NULL); dns_qp_lookup(qp, name, 0, NULL, NULL, NULL, NULL, NULL);
} }
stop = isc_time_monotonic(); stop = isc_time_monotonic();
@ -263,7 +263,7 @@ main(int argc, char **argv) {
++search->ndata[1]; ++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(); stop = isc_time_monotonic();

View File

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