Lines Matching refs:search
2995 rbtdb_search_t *search = arg;
3007 if (search->zonecut != NULL) {
3013 onode = search->rbtdb->origin_node;
3015 NODE_LOCK(&(search->rbtdb->node_locks[node->locknum].lock),
3031 if (header->serial <= search->serial &&
3054 IS_STUB(search->rbtdb))
3073 if (!IS_CACHE(search->rbtdb) && !IS_STUB(search->rbtdb) &&
3081 search->zonecut_sigrdataset = NULL;
3084 search->zonecut_sigrdataset = sigdname_header;
3087 search->zonecut_sigrdataset = NULL;
3093 * search->zonecut_rdataset will still be valid later.
3095 new_reference(search->rbtdb, node, isc_rwlocktype_read);
3096 search->zonecut = node;
3097 search->zonecut_rdataset = found;
3098 search->need_cleanup = true;
3102 * may clear search->wild.
3104 search->wild = false;
3105 if ((search->options & DNS_DBFIND_GLUEOK) == 0) {
3108 * this is the best answer and the search should
3116 * The search will continue beneath the zone cut.
3120 zcname = dns_fixedname_name(&search->zonecut_name);
3122 search->copy_name = true;
3134 if (node->wild && (search->options & DNS_DBFIND_NOWILD) == 0) {
3135 search->wild = true;
3139 NODE_UNLOCK(&(search->rbtdb->node_locks[node->locknum].lock),
3267 setup_delegation(rbtdb_search_t *search, dns_dbnode_t **nodep,
3278 node = search->zonecut;
3279 type = search->zonecut_rdataset->type;
3288 if (foundname != NULL && search->copy_name) {
3289 zcname = dns_fixedname_name(&search->zonecut_name);
3296 * already have in the search block.
3299 search->need_cleanup = false;
3302 NODE_LOCK(&(search->rbtdb->node_locks[node->locknum].lock),
3304 bind_rdataset(search->rbtdb, node, search->zonecut_rdataset,
3305 search->now, isc_rwlocktype_read, rdataset);
3306 if (sigrdataset != NULL && search->zonecut_sigrdataset != NULL)
3308 bind_rdataset(search->rbtdb, node,
3309 search->zonecut_sigrdataset, search->now,
3312 NODE_UNLOCK(&(search->rbtdb->node_locks[node->locknum].lock),
3323 valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type,
3342 if (node != search->zonecut) {
3351 header = search->zonecut_rdataset;
3379 activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain,
3392 rbtdb = search->rbtdb;
3410 if (header->serial <= search->serial &&
3433 activeemptynode(rbtdb_search_t *search, const dns_name_t *qname,
3454 rbtdb = search->rbtdb;
3468 chain = search->chain;
3479 if (header->serial <= search->serial &&
3510 if (header->serial <= search->serial &&
3555 find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep,
3576 * search for it. If the wildcard node exists, and is active in
3580 * continue the search.
3583 rbtdb = search->rbtdb;
3584 i = search->chain.level_matches;
3593 * the search's version. We do this now, even though we
3599 if (header->serial <= search->serial &&
3633 level_node = search->chain.levels[j];
3653 * is active in the search's version, we're
3661 if (header->serial <= search->serial &&
3670 activeempty(search, &wchain, wname))
3672 if (activeemptynode(search, qname,
3708 node = search->chain.levels[i];
3718 matchparams(rdatasetheader_t *header, rbtdb_search_t *search) {
3737 dns_rdata_fromregion(&rdata, search->rbtdb->common.rdclass,
3742 if (nsec3.hash == search->rbtversion->hash &&
3743 nsec3.iterations == search->rbtversion->iterations &&
3744 nsec3.salt_length == search->rbtversion->salt_length &&
3745 memcmp(nsec3.salt, search->rbtversion->salt,
3759 previous_closest_nsec(dns_rdatatype_t type, rbtdb_search_t *search,
3772 result = dns_rbtnodechain_prev(&search->chain, NULL, NULL);
3776 result = dns_rbtnodechain_current(&search->chain, name, origin,
3798 search->rbtdb->nsec, target, NULL, &nsecnode,
3848 result = dns_rbt_findnode(search->rbtdb->tree, target, NULL,
3849 nodep, &search->chain,
3872 * search chain. For NSEC3 records only NSEC3 records that match the
3876 find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep,
3893 if (tree == search->rbtdb->nsec3) {
3912 result = dns_rbtnodechain_current(&search->chain, name, origin, &node);
3917 NODE_LOCK(&(search->rbtdb->node_locks[node->locknum].lock),
3929 if (header->serial <= search->serial &&
3964 if (found != NULL && search->rbtversion->havensec3 &&
3966 !matchparams(found, search))
3972 type, search, name, origin, &prevnode,
3991 search->rbtdb, node,
3995 bind_rdataset(search->rbtdb, node,
3996 found, search->now,
4001 search->rbtdb, node,
4002 foundsig, search->now,
4012 * relevant for our search. Treat the
4017 type, search, name, origin, &prevnode,
4032 result = previous_closest_nsec(type, search, name,
4036 NODE_UNLOCK(&(search->rbtdb->node_locks[node->locknum].lock),
4047 result = dns_rbtnodechain_last(&search->chain, tree, NULL,
4074 rbtdb_search_t search;
4088 search.rbtdb = (dns_rbtdb_t *)db;
4090 REQUIRE(VALID_RBTDB(search.rbtdb));
4108 search.rbtversion = version;
4109 search.serial = search.rbtversion->serial;
4110 search.options = options;
4111 search.copy_name = false;
4112 search.need_cleanup = false;
4113 search.wild = false;
4114 search.zonecut = NULL;
4115 dns_fixedname_init(&search.zonecut_name);
4116 dns_rbtnodechain_init(&search.chain);
4117 search.now = 0;
4124 RWLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
4128 * encounter a callback node, zone_zonecut_callback() will search the
4131 tree = (options & DNS_DBFIND_FORCENSEC3) != 0 ? search.rbtdb->nsec3
4132 : search.rbtdb->tree;
4133 result = dns_rbt_findnode(tree, name, foundname, &node, &search.chain,
4135 &search);
4139 if (search.zonecut != NULL) {
4140 result = setup_delegation(&search, nodep, foundname,
4145 if (search.wild) {
4147 * At least one of the levels in the search chain
4152 result = find_wildcard(&search, &node, name);
4168 dns_rbtnodechain_t chain = search.chain;
4169 active = activeempty(&search, &chain, name);
4176 if ((search.rbtversion->secure == dns_db_secure &&
4177 !search.rbtversion->havensec3) ||
4178 (search.options & DNS_DBFIND_FORCENSEC) != 0 ||
4179 (search.options & DNS_DBFIND_FORCENSEC3) != 0)
4181 result = find_closest_nsec(&search, nodep, foundname,
4183 search.rbtversion->secure);
4202 if (search.zonecut != NULL) {
4220 ((node != search.rbtdb->origin_node &&
4222 IS_STUB(search.rbtdb)))
4243 lock = &search.rbtdb->node_locks[node->locknum].lock;
4259 if (header->serial <= search.serial && !IGNORE(header))
4286 * ensure that search->zonecut_rdataset will
4289 new_reference(search.rbtdb, node,
4291 search.zonecut = node;
4292 search.zonecut_rdataset = header;
4293 search.zonecut_sigrdataset = NULL;
4294 search.need_cleanup = true;
4303 if ((search.options & DNS_DBFIND_GLUEOK) == 0 &&
4325 !matchparams(header, &search))
4360 * If we've got all we need, end the search.
4372 * If we've got all we need, end the search.
4378 !search.rbtversion->havensec3)
4387 !search.rbtversion->havensec3)
4423 if (search.zonecut != NULL) {
4431 result = setup_delegation(&search, nodep, foundname,
4439 if (search.rbtversion->secure == dns_db_secure &&
4440 !search.rbtversion->havensec3 &&
4453 result = find_closest_nsec(&search, nodep, foundname,
4455 search.rbtdb->tree,
4456 search.rbtversion->secure);
4462 if ((search.options & DNS_DBFIND_FORCENSEC) != 0 &&
4473 new_reference(search.rbtdb, node, isc_rwlocktype_read);
4476 if ((search.rbtversion->secure == dns_db_secure &&
4477 !search.rbtversion->havensec3) ||
4478 (search.options & DNS_DBFIND_FORCENSEC) != 0)
4480 bind_rdataset(search.rbtdb, node, nsecheader, 0,
4483 bind_rdataset(search.rbtdb, node, nsecsig, 0,
4506 } else if (search.zonecut != NULL) {
4512 if (search.zonecut == node) {
4540 (search.options & DNS_DBFIND_VALIDATEGLUE) != 0 &&
4541 !valid_glue(&search, foundname, type, node))
4544 result = setup_delegation(&search, nodep, foundname,
4557 new_reference(search.rbtdb, node, isc_rwlocktype_read);
4559 search.need_cleanup = false;
4565 bind_rdataset(search.rbtdb, node, found, 0, isc_rwlocktype_read,
4568 bind_rdataset(search.rbtdb, node, foundsig, 0,
4581 RWUNLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
4587 if (search.need_cleanup) {
4588 node = search.zonecut;
4590 lock = &(search.rbtdb->node_locks[node->locknum].lock);
4593 decrement_reference(search.rbtdb, node, 0, isc_rwlocktype_read,
4602 dns_rbtnodechain_reset(&search.chain);
4631 rbtdb_search_t *search, rdatasetheader_t **header_prev) {
4632 if (!ACTIVE(header, search->now)) {
4634 search->rbtdb->serve_stale_ttl;
4643 if (!ZEROTTL(header) && KEEPSTALE(search->rbtdb) &&
4644 stale > search->now)
4646 mark_header_stale(search->rbtdb, header);
4654 if ((search->options & DNS_DBFIND_STALESTART) != 0) {
4657 search->now);
4658 } else if ((search->options &
4660 search->now <
4663 search->rbtdb->serve_stale_refresh))
4674 } else if ((search->options &
4683 return ((search->options & DNS_DBFIND_STALEOK) == 0);
4692 if ((header->rdh_ttl < search->now - RBTDB_VIRTUAL) &&
4717 mctx = search->rbtdb->common.mctx;
4718 clean_stale_headers(search->rbtdb, mctx,
4725 free_rdataset(search->rbtdb, mctx, header);
4727 mark_header_ancient(search->rbtdb, header);
4740 rbtdb_search_t *search = arg;
4749 REQUIRE(search->zonecut == NULL);
4756 lock = &(search->rbtdb->node_locks[node->locknum].lock);
4768 if (check_stale_header(node, header, &locktype, lock, search,
4789 (search->options & DNS_DBFIND_PENDINGOK) != 0))
4793 * search->zonecut_rdataset will still be valid later.
4795 new_reference(search->rbtdb, node, locktype);
4796 search->zonecut = node;
4797 search->zonecut_rdataset = dname_header;
4798 search->zonecut_sigrdataset = sigdname_header;
4799 search->need_cleanup = true;
4811 find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node,
4829 rbtdb = search->rbtdb;
4830 i = search->chain.level_matches;
4847 search, &header_prev))
4889 level_node = search->chain.levels[i];
4905 new_reference(search->rbtdb, node, locktype);
4908 bind_rdataset(search->rbtdb, node, found, search->now,
4911 bind_rdataset(search->rbtdb, node, foundsig,
4912 search->now, locktype,
4915 if (need_headerupdate(found, search->now) ||
4917 need_headerupdate(foundsig, search->now)))
4925 if (need_headerupdate(found, search->now)) {
4926 update_header(search->rbtdb, found,
4927 search->now);
4930 need_headerupdate(foundsig, search->now))
4932 update_header(search->rbtdb, foundsig,
4933 search->now);
4943 node = search->chain.levels[i];
4953 find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep,
4968 chain = search->chain;
4983 lock = &(search->rbtdb->node_locks[node->locknum].lock);
4993 search, &header_prev))
5025 bind_rdataset(search->rbtdb, node, found, now, locktype,
5028 bind_rdataset(search->rbtdb, node, foundsig,
5031 new_reference(search->rbtdb, node, locktype);
5052 rbtdb_search_t search;
5066 search.rbtdb = (dns_rbtdb_t *)db;
5068 REQUIRE(VALID_RBTDB(search.rbtdb));
5075 search.rbtversion = NULL;
5076 search.serial = 1;
5077 search.options = options;
5078 search.copy_name = false;
5079 search.need_cleanup = false;
5080 search.wild = false;
5081 search.zonecut = NULL;
5082 dns_fixedname_init(&search.zonecut_name);
5083 dns_rbtnodechain_init(&search.chain);
5084 search.now = now;
5088 RWLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
5092 * encounter a callback node, cache_zonecut_callback() will search the
5095 result = dns_rbt_findnode(search.rbtdb->tree, name, foundname, &node,
5096 &search.chain, DNS_RBTFIND_EMPTYDATA,
5097 cache_zonecut_callback, &search);
5100 if ((search.options & DNS_DBFIND_COVERINGNSEC) != 0) {
5101 result = find_coveringnsec(&search, nodep, now,
5108 if (search.zonecut != NULL) {
5109 result = setup_delegation(&search, nodep, foundname,
5114 result = find_deepest_zonecut(&search, node, nodep,
5138 lock = &(search.rbtdb->node_locks[node->locknum].lock);
5155 if (check_stale_header(node, header, &locktype, lock, &search,
5257 if ((search.options & DNS_DBFIND_COVERINGNSEC) != 0 &&
5261 new_reference(search.rbtdb, node, locktype);
5264 bind_rdataset(search.rbtdb, node, nsecheader,
5265 search.now, locktype, rdataset);
5266 if (need_headerupdate(nsecheader, search.now)) {
5270 bind_rdataset(search.rbtdb, node, nsecsig,
5271 search.now, locktype,
5273 if (need_headerupdate(nsecsig, search.now)) {
5287 new_reference(search.rbtdb, node, locktype);
5290 bind_rdataset(search.rbtdb, node, nsheader, search.now,
5292 if (need_headerupdate(nsheader, search.now)) {
5296 bind_rdataset(search.rbtdb, node, nssig,
5297 search.now, locktype,
5299 if (need_headerupdate(nssig, search.now)) {
5319 new_reference(search.rbtdb, node, locktype);
5351 bind_rdataset(search.rbtdb, node, found, search.now, locktype,
5353 if (need_headerupdate(found, search.now)) {
5357 bind_rdataset(search.rbtdb, node, foundsig, search.now,
5359 if (need_headerupdate(foundsig, search.now)) {
5374 if (update != NULL && need_headerupdate(update, search.now)) {
5375 update_header(search.rbtdb, update, search.now);
5377 if (updatesig != NULL && need_headerupdate(updatesig, search.now)) {
5378 update_header(search.rbtdb, updatesig, search.now);
5384 RWUNLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
5390 if (search.need_cleanup) {
5391 node = search.zonecut;
5393 lock = &(search.rbtdb->node_locks[node->locknum].lock);
5396 decrement_reference(search.rbtdb, node, 0, isc_rwlocktype_read,
5401 dns_rbtnodechain_reset(&search.chain);
5403 update_cachestats(search.rbtdb, result);
5415 rbtdb_search_t search;
5422 search.rbtdb = (dns_rbtdb_t *)db;
5424 REQUIRE(VALID_RBTDB(search.rbtdb));
5430 search.rbtversion = NULL;
5431 search.serial = 1;
5432 search.options = options;
5433 search.copy_name = false;
5434 search.need_cleanup = false;
5435 search.wild = false;
5436 search.zonecut = NULL;
5437 dns_fixedname_init(&search.zonecut_name);
5438 dns_rbtnodechain_init(&search.chain);
5439 search.now = now;
5449 RWLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
5454 result = dns_rbt_findnode(search.rbtdb->tree, name, dcname, &node,
5455 &search.chain, rbtoptions, NULL, &search);
5458 result = find_deepest_zonecut(&search, node, nodep, foundname,
5471 lock = &(search.rbtdb->node_locks[node->locknum].lock);
5480 if (check_stale_header(node, header, &locktype, lock, &search,
5494 result = find_deepest_zonecut(&search, node, nodep,
5529 result = find_deepest_zonecut(&search, node, nodep, foundname,
5535 new_reference(search.rbtdb, node, locktype);
5539 bind_rdataset(search.rbtdb, node, found, search.now, locktype,
5542 bind_rdataset(search.rbtdb, node, foundsig, search.now,
5546 if (need_headerupdate(found, search.now) ||
5547 (foundsig != NULL && need_headerupdate(foundsig, search.now)))
5555 if (need_headerupdate(found, search.now)) {
5556 update_header(search.rbtdb, found, search.now);
5558 if (foundsig != NULL && need_headerupdate(foundsig, search.now))
5560 update_header(search.rbtdb, foundsig, search.now);
5567 RWUNLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
5569 INSIST(!search.need_cleanup);
5571 dns_rbtnodechain_reset(&search.chain);