]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove dns_db_findzonecut()
authorEvan Hunt <each@isc.org>
Fri, 20 Feb 2026 23:17:03 +0000 (15:17 -0800)
committerColin Vidal <colin@isc.org>
Mon, 30 Mar 2026 18:41:13 +0000 (20:41 +0200)
This function is no longer used and has been removed, along with its
implementation in qpcache.

bin/tests/system/dyndb/driver/db.c
lib/dns/db.c
lib/dns/include/dns/db.h
lib/dns/qpcache.c

index c108bc318303b250d7ea63f53c130d35fac0ee76..0db774af880fedb45a0183eaf3aa8bd4fbb8c07b 100644 (file)
@@ -125,20 +125,6 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
        dns__db_closeversion(sampledb->db, versionp, commit DNS__DB_FLARG_PASS);
 }
 
-static isc_result_t
-findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
-           isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname,
-           dns_name_t *dcname, dns_rdataset_t *rdataset,
-           dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
-       sampledb_t *sampledb = (sampledb_t *)db;
-
-       REQUIRE(VALID_SAMPLEDB(sampledb));
-
-       return dns__db_findzonecut(sampledb->db, name, options, now, nodep,
-                                  foundname, dcname, rdataset,
-                                  sigrdataset DNS__DB_FLARG_PASS);
-}
-
 static isc_result_t
 createiterator(dns_db_t *db, unsigned int options,
               dns_dbiterator_t **iteratorp) {
@@ -363,7 +349,6 @@ static dns_dbmethods_t sampledb_methods = {
        .newversion = newversion,
        .attachversion = attachversion,
        .closeversion = closeversion,
-       .findzonecut = findzonecut,
        .createiterator = createiterator,
        .findrdataset = findrdataset,
        .allrdatasets = allrdatasets,
index aa305d542c9b58021bb9509c2563b01ee2b02839..2cbf50c2dac361f5a1e22d019411d94f42066ed9 100644 (file)
@@ -526,34 +526,6 @@ dns__db_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
        return ISC_R_NOTIMPLEMENTED;
 }
 
-isc_result_t
-dns__db_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
-                   isc_stdtime_t now, dns_dbnode_t **nodep,
-                   dns_name_t *foundname, dns_name_t *dcname,
-                   dns_rdataset_t *rdataset,
-                   dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
-       /*
-        * Find the deepest known zonecut which encloses 'name' in 'db'.
-        * foundname is the zonecut, dcname is the deepest name we have
-        * in database that is part of queried name.
-        */
-
-       REQUIRE(DNS_DB_VALID(db));
-       REQUIRE((db->attributes & DNS_DBATTR_CACHE) != 0);
-       REQUIRE(nodep == NULL || *nodep == NULL);
-       REQUIRE(dns_name_hasbuffer(foundname));
-       REQUIRE(sigrdataset == NULL ||
-               (DNS_RDATASET_VALID(sigrdataset) &&
-                !dns_rdataset_isassociated(sigrdataset)));
-
-       if (db->methods->findzonecut != NULL) {
-               return (db->methods->findzonecut)(
-                       db, name, options, now, nodep, foundname, dcname,
-                       rdataset, sigrdataset DNS__DB_FLARG_PASS);
-       }
-       return ISC_R_NOTIMPLEMENTED;
-}
-
 void
 dns__db_attachnode(dns_dbnode_t *source, dns_dbnode_t **targetp DNS__DB_FLARG) {
        /*
index 069f788cd84fd5b121a4724e83c24e6ab29b5afb..8682c720595ddb9eeaebca6d34f044f5a71120be 100644 (file)
@@ -101,12 +101,6 @@ typedef struct dns_db_methods {
                              dns_dbversion_t **targetp);
        void (*closeversion)(dns_db_t *db, dns_dbversion_t **versionp,
                             bool commit DNS__DB_FLARG);
-       isc_result_t (*findzonecut)(dns_db_t *db, const dns_name_t *name,
-                                   unsigned int options, isc_stdtime_t now,
-                                   dns_dbnode_t **nodep, dns_name_t *foundname,
-                                   dns_name_t                 *dcname,
-                                   dns_rdataset_t             *rdataset,
-                                   dns_rdataset_t *sigrdataset DNS__DB_FLARG);
        isc_result_t (*createiterator)(dns_db_t *db, unsigned int options,
                                       dns_dbiterator_t **iteratorp);
        isc_result_t (*findrdataset)(dns_db_t *db, dns_dbnode_t *node,
@@ -1008,61 +1002,6 @@ dns__db_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
  *             errors.
  */
 
-#define dns_db_findzonecut(db, name, options, now, nodep, foundname, dcname,  \
-                          rdataset, sigrdataset)                             \
-       dns__db_findzonecut(db, name, options, now, nodep, foundname, dcname, \
-                           rdataset, sigrdataset DNS__DB_FILELINE)
-isc_result_t
-dns__db_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
-                   isc_stdtime_t now, dns_dbnode_t **nodep,
-                   dns_name_t *foundname, dns_name_t *dcname,
-                   dns_rdataset_t             *rdataset,
-                   dns_rdataset_t *sigrdataset DNS__DB_FLARG);
-/*%<
- * Find the deepest known zonecut which encloses 'name' in 'db'.
- *
- * Notes:
- *
- * \li If the #DNS_DBFIND_NOEXACT option is set, then the zonecut returned
- *     (if any) will be the deepest known ancestor of 'name'.
- *
- * \li If 'now' is zero, then the current time will be used.
- *
- * Requires:
- *
- * \li 'db' is a valid database with cache semantics.
- *
- * \li 'nodep' is NULL, or nodep is a valid pointer and *nodep == NULL.
- *
- * \li 'foundname' is a valid name with a dedicated buffer.
- *
- * \li 'dcname' is a valid name with a dedicated buffer.
- *
- * \li 'rdataset' is NULL, or is a valid unassociated rdataset.
- *
- * Ensures, on a non-error completion:
- *
- * \li If nodep != NULL, then it is bound to the found node.
- *
- * \li If foundname != NULL, then it contains the full name of the
- *     found node.
- *
- * \li If dcname != NULL, then it contains the deepest cached name
- *      that exists in the database.
- *
- * \li If rdataset != NULL and type != dns_rdatatype_any, then
- *     rdataset is bound to the found rdataset.
- *
- * Non-error results are:
- *
- * \li #ISC_R_SUCCESS
- *
- * \li #ISC_R_NOTFOUND
- *
- * \li Other results are possible, and should all be treated as
- *     errors.
- */
-
 #define dns_db_attachnode(source, targetp) \
        dns__db_attachnode(source, targetp DNS__DB_FILELINE)
 void
index 3851480d40853f43d12d907adcba94255e4ebc43..1887dddf0d21de2dc8fe8e2410f64615258cd7c3 100644 (file)
@@ -1974,131 +1974,6 @@ tree_exit:
        return result;
 }
 
-static isc_result_t
-seek_ns_headers(qpc_search_t *search, qpcnode_t *node, dns_dbnode_t **nodep,
-               dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset,
-               dns_name_t *foundname, dns_name_t *dcname,
-               isc_rwlocktype_t *tlocktype) {
-       isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
-       isc_rwlock_t *nlock = &search->qpdb->buckets[node->locknum].lock;
-       dns_slabheader_t *found = NULL, *foundsig = NULL;
-
-       NODE_RDLOCK(nlock, &nlocktype);
-
-       find_headers(node, search, dns_rdatatype_ns, &found, &foundsig);
-
-       if (found == NULL) {
-               isc_result_t result;
-
-               /*
-                * No active NS records found. Call find_deepest_zonecut()
-                * to look for them in nodes above this one.
-                */
-               NODE_UNLOCK(nlock, &nlocktype);
-               result = find_deepest_zonecut(search, node, nodep, foundname,
-                                             rdataset,
-                                             sigrdataset DNS__DB_FLARG_PASS);
-               if (dcname != NULL) {
-                       dns_name_copy(foundname, dcname);
-               }
-               return result;
-       }
-
-       if (nodep != NULL) {
-               qpcnode_acquire(search->qpdb, node, nlocktype,
-                               *tlocktype DNS__DB_FLARG_PASS);
-               *nodep = (dns_dbnode_t *)node;
-       }
-
-       bindrdatasets(search->qpdb, node, found, foundsig, search->now,
-                     nlocktype, *tlocktype, rdataset,
-                     sigrdataset DNS__DB_FLARG_PASS);
-
-       NODE_UNLOCK(nlock, &nlocktype);
-
-       return ISC_R_SUCCESS;
-}
-
-static isc_result_t
-qpcache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
-                   isc_stdtime_t __now, dns_dbnode_t **nodep,
-                   dns_name_t *foundname, dns_name_t *dcname,
-                   dns_rdataset_t *rdataset,
-                   dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
-       qpcnode_t *node = NULL;
-       isc_result_t result;
-       isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
-       qpc_search_t search = (qpc_search_t){
-               .qpdb = (qpcache_t *)db,
-               .options = options,
-               .now = __now ? __now : isc_stdtime_now(),
-       };
-       unsigned int len = 0;
-
-       REQUIRE(VALID_QPDB((qpcache_t *)db));
-
-       TREE_RDLOCK(&search.qpdb->tree_lock, &tlocktype);
-
-       /*
-        * Search down from the root of the tree.
-        */
-       result = dns_qp_lookup(search.qpdb->tree, name, DNS_DBNAMESPACE_NORMAL,
-                              NULL, &search.chain, (void **)&node, NULL);
-
-       switch (result) {
-       case ISC_R_SUCCESS:
-               if ((options & DNS_DBFIND_NOEXACT) == 0) {
-                       if (dcname != NULL) {
-                               dns_name_copy(&node->name, dcname);
-                       }
-                       dns_name_copy(&node->name, foundname);
-                       result = seek_ns_headers(&search, node, nodep, rdataset,
-                                                sigrdataset, foundname, dcname,
-                                                &tlocktype);
-                       break;
-               }
-
-               len = dns_qpchain_length(&search.chain);
-               if (len < 2) {
-                       result = ISC_R_NOTFOUND;
-                       break;
-               }
-
-               FALLTHROUGH;
-       case DNS_R_PARTIALMATCH:
-               if (dcname != NULL) {
-                       dns_name_copy(&node->name, dcname);
-               }
-
-               if (result == ISC_R_SUCCESS) {
-                       /* Fell through from the previous case */
-                       INSIST(len >= 2);
-
-                       node = NULL;
-                       dns_qpchain_node(&search.chain, len - 2, (void **)&node,
-                                        NULL);
-                       search.chain.len = len - 1;
-               }
-
-               result = find_deepest_zonecut(&search, node, nodep, foundname,
-                                             rdataset,
-                                             sigrdataset DNS__DB_FLARG_PASS);
-               break;
-       default:
-               break;
-       }
-
-       TREE_UNLOCK(&search.qpdb->tree_lock, &tlocktype);
-
-       INSIST(!search.need_cleanup);
-
-       if (result == DNS_R_DELEGATION) {
-               result = ISC_R_SUCCESS;
-       }
-
-       return result;
-}
-
 static isc_result_t
 qpcache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
                     dns_rdatatype_t type, dns_rdatatype_t covers,
@@ -3852,7 +3727,6 @@ static dns_dbmethods_t qpdb_cachemethods = {
        .destroy = qpcache_destroy,
        .findnode = qpcache_findnode,
        .find = qpcache_find,
-       .findzonecut = qpcache_findzonecut,
        .createiterator = qpcache_createiterator,
        .findrdataset = qpcache_findrdataset,
        .allrdatasets = qpcache_allrdatasets,