]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Rename dns_qp_lookup2 back to dns_qp_lookup
authorMatthijs Mekking <matthijs@isc.org>
Tue, 27 May 2025 08:57:11 +0000 (10:57 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 10 Jul 2025 13:52:59 +0000 (13:52 +0000)
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.

12 files changed:
lib/dns/forward.c
lib/dns/include/dns/qp.h
lib/dns/keytable.c
lib/dns/nametree.c
lib/dns/nta.c
lib/dns/qp.c
lib/dns/qpcache.c
lib/dns/qpzone.c
lib/dns/rpz.c
lib/dns/zt.c
tests/bench/qplookups.c
tests/dns/qp_test.c

index 5764917ed8e4d24d98bb7e2586a9dacc8e7073aa..9defcadeda844cb645a9d837c0731d7b6c4e33d3 100644 (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;
index 7fec992362eaacea2154a52d562da6fdb339b06f..077a4d508a90b948dec2e894aa38fb0b80a8a7e6 100644 (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);
 /*%<
index d4cc637ddeed781e007af6f20ef14285af682f7a..5175b9088409f294dfa30e8253ac11968accadeb 100644 (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) {
index 13b65bfef09a41c4ed0e4d4c55f0abdbddce4d09..03aad3408bb5d24671f27386f8185719fe5ea9b1 100644 (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) {
index 59613da29de10fcbaa05c80079c62f0693c364b4..c7705fd2f92a69c559e61dcffb0e7d8b853f8592 100644 (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) {
index f24417812313da27d4ab341a29331ce1d8d028a7..6cd99381659c169833ef69a0ed466d5eb8990c4d 100644 (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);
-}
-
 /**********************************************************************/
index 49d06eb45d4c7c5113ea308fb4e7f512876c8e8a..06196d39d729d6c04971d8a362df29777738f24c 100644 (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) {
index 9f11df09137ae3f5494335ee8ae239f9f2b28cfe..99cd54e05810c6237b7093cc0aa2fe6ddbaad608 100644 (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:
index 35dd80577a5e7f9028642e3a059592d3cedd0eaa..c72564b3174ddb2fe40fe75bbb8813f9c9f4ff66 100644 (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:
index 2ec4dd5fe2cf30155eea0b6769f5b13debde33e9..113e5d01396ad24026f0046f0a669d70aff1397a 100644 (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)
                {
index 612d15e8cca144acb51177970fd5d6323c87f341..50921dada4cf4303d85add56d74d60a8bf9a2f07 100644 (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();
 
index 0bf75d3bbd4e97f1e47d65218089993adab7ea51..ef8cd56b26593c5b85ead7ddb34333a811bf4424 100644 (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