*
* 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
- * DNS_R_PARTIALMATCH, indicates whether the name found is name that
- * was requested, or an ancestor. If the result is ISC_R_NOTFOUND,
- * 'foundname' will not be updated.
+ * DNS_R_PARTIALMATCH, indicates whether the name found is the name
+ * that was requested, or an ancestor. If the result is ISC_R_NOTFOUND,
+ * 'foundname' will not be updated. (NOTE: the name will be constructed
+ * from the QP key of the found node, and this can be time-consuming.
+ * In performance-critical code, it is faster to store a copy of the
+ * name in the node data and use that instead of passing 'foundname'.)
*
* If 'chain' is not NULL, it is updated to contain a QP chain with
* references to the populated nodes in the tree between the root and
REQUIRE(VALID_NAMETREE(nametree));
dns_qpmulti_query(nametree->table, &qpr);
- result = dns_qp_lookup(&qpr, name, found, NULL, NULL, (void **)&node,
+ result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, (void **)&node,
NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
+ if (found != NULL) {
+ dns_name_copy(&node->name, found);
+ }
switch (nametree->type) {
case DNS_NAMETREE_BOOL:
ret = node->set;
* Lookup the predecessor in the main tree.
*/
node = NULL;
- result = dns_qp_lookup(search->qpdb->tree, predecessor, fname, NULL,
+ result = dns_qp_lookup(search->qpdb->tree, predecessor, NULL, NULL,
NULL, (void **)&node, NULL);
if (result != ISC_R_SUCCESS) {
return (ISC_R_NOTFOUND);
}
+ dns_name_copy(&node->name, fname);
lock = &(search->qpdb->node_locks[node->locknum].lock);
NODE_RDLOCK(lock, &nlocktype);
/*
* Search down from the root of the tree.
*/
- result = dns_qp_lookup(search.qpdb->tree, name, foundname, NULL,
+ result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
&search.chain, (void **)&node, NULL);
+ if (result != ISC_R_NOTFOUND && foundname != NULL) {
+ dns_name_copy(&node->name, foundname);
+ }
/*
* Check the QP chain to see if there's a node above us with a
dns_qpchain_node(&search.chain, i, NULL, (void **)&encloser,
NULL);
- if (encloser->delegating) {
- zcresult = check_zonecut(
- encloser, (void *)&search DNS__DB_FLARG_PASS);
- if (zcresult != DNS_R_CONTINUE) {
- result = DNS_R_PARTIALMATCH;
- dns_qpchain_node(&search.chain, i, foundname,
- NULL, NULL);
- search.chain.len = i - 1;
- node = encloser;
- break;
+ zcresult = check_zonecut(encloser,
+ (void *)&search DNS__DB_FLARG_PASS);
+ if (zcresult != DNS_R_CONTINUE) {
+ result = DNS_R_PARTIALMATCH;
+ search.chain.len = i - 1;
+ node = encloser;
+ if (foundname != NULL) {
+ dns_name_copy(&node->name, foundname);
}
+ break;
}
}
/*
* Search down from the root of the tree.
*/
- result = dns_qp_lookup(search.qpdb->tree, name, dcname, NULL,
+ result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
&search.chain, (void **)&node, NULL);
+ if (result != ISC_R_NOTFOUND) {
+ dns_name_copy(&node->name, dcname);
+ }
if ((options & DNS_DBFIND_NOEXACT) != 0 && result == ISC_R_SUCCESS) {
int len = dns_qpchain_length(&search.chain);
if (len >= 2) {
/*
* Search down from the root of the tree.
*/
- result = dns_qp_lookup(&search.qpr, name, foundname, &search.iter,
+ result = dns_qp_lookup(&search.qpr, name, NULL, &search.iter,
&search.chain, (void **)&node, NULL);
+ if (result != ISC_R_NOTFOUND) {
+ dns_name_copy(&node->name, foundname);
+ }
/*
* Check the QP chain to see if there's a node above us with a
tresult = check_zonecut(n, &search DNS__DB_FLARG_PASS);
if (tresult != DNS_R_CONTINUE) {
result = tresult;
- dns_qpchain_node(&search.chain, i, foundname, NULL,
- NULL);
search.chain.len = i - 1;
node = n;
+ if (foundname != NULL) {
+ dns_name_copy(&node->name, foundname);
+ }
}
}