Lines Matching defs:adb

41 #include <dns/adb.h>
109 /*% dns adb structure */
176 dns_adb_t *adb;
359 * Note: since we have removed the support of A6 in adb, FETCH_A and FETCH_AAAA
471 inc_stats(dns_adb_t *adb, isc_statscounter_t counter) {
472 if (adb->view->resstats != NULL)
473 isc_stats_increment(adb->view->resstats, counter);
496 dns_adb_t *adb;
511 adb = adbname->adb;
512 INSIST(DNS_ADB_VALID(adb));
542 nh = new_adbnamehook(adb, NULL);
549 foundentry = find_entry_and_lock(adb, &sockaddr, &addr_bucket,
554 entry = new_adbentry(adb);
566 link_entry(adb, addr_bucket, entry);
577 free_adbnamehook(adb, &nh);
589 free_adbnamehook(adb, &nh);
592 UNLOCK(&adb->entrylocks[addr_bucket]);
634 dns_adb_t *adb;
640 adb = name->adb;
641 INSIST(DNS_ADB_VALID(adb));
650 result = unlink_name(adb, name);
651 free_adbname(adb, &name);
653 result = dec_adb_irefcnt(adb);
662 result4 = clean_namehooks(adb, &name->v4);
663 result6 = clean_namehooks(adb, &name->v6);
664 clean_target(adb, &name->target);
673 result = unlink_name(adb, name);
674 free_adbname(adb, &name);
676 result = dec_adb_irefcnt(adb);
681 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
682 ISC_LIST_APPEND(adb->deadnames[bucket], name, plink);
694 dns_adb_t *adb;
699 adb = name->adb;
700 INSIST(DNS_ADB_VALID(adb));
708 result4 = clean_namehooks(adb, &name->v4);
721 result6 = clean_namehooks(adb, &name->v6);
732 clean_target(adb, &name->target);
742 link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) {
745 ISC_LIST_PREPEND(adb->names[bucket], name, plink);
747 adb->name_refcnt[bucket]++;
754 unlink_name(dns_adb_t *adb, dns_adbname_t *name) {
762 ISC_LIST_UNLINK(adb->deadnames[bucket], name, plink);
764 ISC_LIST_UNLINK(adb->names[bucket], name, plink);
766 INSIST(adb->name_refcnt[bucket] > 0);
767 adb->name_refcnt[bucket]--;
768 if (adb->name_sd[bucket] && adb->name_refcnt[bucket] == 0)
777 link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) {
781 if (isc_mem_isovermem(adb->mctx)) {
783 e = ISC_LIST_TAIL(adb->entries[bucket]);
787 unlink_entry(adb, e);
788 free_adbentry(adb, &e);
793 ISC_LIST_UNLINK(adb->entries[bucket], e, plink);
794 ISC_LIST_PREPEND(adb->deadentries[bucket], e, plink);
798 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
800 adb->entry_refcnt[bucket]++;
807 unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) {
815 ISC_LIST_UNLINK(adb->deadentries[bucket], entry, plink);
817 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
819 INSIST(adb->entry_refcnt[bucket] > 0);
820 adb->entry_refcnt[bucket]--;
821 if (adb->entry_sd[bucket] && adb->entry_refcnt[bucket] == 0)
840 shutdown_names(dns_adb_t *adb) {
847 LOCK(&adb->namelocks[bucket]);
848 adb->name_sd[bucket] = ISC_TRUE;
850 name = ISC_LIST_HEAD(adb->names[bucket]);
858 result = dec_adb_irefcnt(adb);
875 UNLOCK(&adb->namelocks[bucket]);
885 shutdown_entries(dns_adb_t *adb) {
892 LOCK(&adb->entrylocks[bucket]);
893 adb->entry_sd[bucket] = ISC_TRUE;
895 entry = ISC_LIST_HEAD(adb->entries[bucket]);
896 if (adb->entry_refcnt[bucket] == 0) {
902 result = dec_adb_irefcnt(adb);
912 result = unlink_entry(adb, entry);
913 free_adbentry(adb, &entry);
915 result = dec_adb_irefcnt(adb);
921 UNLOCK(&adb->entrylocks[bucket]);
942 clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) {
947 isc_boolean_t overmem = isc_mem_isovermem(adb->mctx);
963 UNLOCK(&adb->entrylocks[addr_bucket]);
966 LOCK(&adb->entrylocks[addr_bucket]);
969 result = dec_entry_refcnt(adb, overmem, entry,
978 free_adbnamehook(adb, &namehook);
984 UNLOCK(&adb->entrylocks[addr_bucket]);
989 clean_target(dns_adb_t *adb, dns_name_t *target) {
991 dns_name_free(target, adb->mctx);
997 set_target(dns_adb_t *adb, dns_name_t *name, dns_name_t *fname,
1023 result = dns_name_dup(&cname.cname, adb->mctx, target);
1056 result = dns_name_dup(new_target, adb->mctx, target);
1167 check_exit(dns_adb_t *adb) {
1170 * The caller must be holding the adb lock.
1172 if (adb->shutting_down) {
1177 INSIST(!adb->cevent_sent); /* Sanity check. */
1178 event = &adb->cevent;
1179 isc_task_send(adb->task, &event);
1180 adb->cevent_sent = ISC_TRUE;
1185 dec_adb_irefcnt(dns_adb_t *adb) {
1190 LOCK(&adb->reflock);
1192 INSIST(adb->irefcnt > 0);
1193 adb->irefcnt--;
1195 if (adb->irefcnt == 0) {
1196 event = ISC_LIST_HEAD(adb->whenshutdown);
1198 ISC_LIST_UNLINK(adb->whenshutdown, event, ev_link);
1200 event->ev_sender = adb;
1202 event = ISC_LIST_HEAD(adb->whenshutdown);
1206 if (adb->irefcnt == 0 && adb->erefcnt == 0)
1208 UNLOCK(&adb->reflock);
1213 inc_adb_irefcnt(dns_adb_t *adb) {
1214 LOCK(&adb->reflock);
1215 adb->irefcnt++;
1216 UNLOCK(&adb->reflock);
1220 inc_adb_erefcnt(dns_adb_t *adb) {
1221 LOCK(&adb->reflock);
1222 adb->erefcnt++;
1223 UNLOCK(&adb->reflock);
1227 inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) {
1233 LOCK(&adb->entrylocks[bucket]);
1238 UNLOCK(&adb->entrylocks[bucket]);
1242 dec_entry_refcnt(dns_adb_t *adb, isc_boolean_t overmem, dns_adbentry_t *entry,
1252 LOCK(&adb->entrylocks[bucket]);
1259 (adb->entry_sd[bucket] || entry->expires == 0 || overmem ||
1262 result = unlink_entry(adb, entry);
1266 UNLOCK(&adb->entrylocks[bucket]);
1273 free_adbentry(adb, &entry);
1275 result = dec_adb_irefcnt(adb);
1281 new_adbname(dns_adb_t *adb, dns_name_t *dnsname) {
1284 name = isc_mempool_get(adb->nmp);
1289 if (dns_name_dup(dnsname, adb->mctx, &name->name) != ISC_R_SUCCESS) {
1290 isc_mempool_put(adb->nmp, name);
1295 name->adb = adb;
1316 free_adbname(dns_adb_t *adb, dns_adbname_t **name) {
1329 INSIST(n->adb == adb);
1332 dns_name_free(&n->name, adb->mctx);
1334 isc_mempool_put(adb->nmp, n);
1338 new_adbnamehook(dns_adb_t *adb, dns_adbentry_t *entry) {
1341 nh = isc_mempool_get(adb->nhmp);
1353 free_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook) {
1364 isc_mempool_put(adb->nhmp, nh);
1368 new_adblameinfo(dns_adb_t *adb, dns_name_t *qname, dns_rdatatype_t qtype) {
1371 li = isc_mempool_get(adb->limp);
1376 if (dns_name_dup(qname, adb->mctx, &li->qname) != ISC_R_SUCCESS) {
1377 isc_mempool_put(adb->limp, li);
1389 free_adblameinfo(dns_adb_t *adb, dns_adblameinfo_t **lameinfo) {
1398 dns_name_free(&li->qname, adb->mctx);
1402 isc_mempool_put(adb->limp, li);
1406 new_adbentry(dns_adb_t *adb) {
1410 e = isc_mempool_get(adb->emp);
1428 free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) {
1445 free_adblameinfo(adb, &li);
1449 isc_mempool_put(adb->emp, e);
1453 new_adbfind(dns_adb_t *adb) {
1457 h = isc_mempool_get(adb->ahmp);
1465 h->adb = adb;
1482 isc_mempool_put(adb->ahmp, h);
1489 inc_adb_irefcnt(adb);
1495 new_adbfetch(dns_adb_t *adb) {
1498 f = isc_mempool_get(adb->afmp);
1513 free_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch) {
1525 isc_mempool_put(adb->afmp, f);
1529 free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) {
1545 isc_mempool_put(adb->ahmp, find);
1546 return (dec_adb_irefcnt(adb));
1555 new_adbaddrinfo(dns_adb_t *adb, dns_adbentry_t *entry, in_port_t port) {
1558 ai = isc_mempool_get(adb->aimp);
1574 free_adbaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **ainfo) {
1586 isc_mempool_put(adb->aimp, ai);
1597 find_name_and_lock(dns_adb_t *adb, dns_name_t *name,
1606 LOCK(&adb->namelocks[bucket]);
1609 UNLOCK(&adb->namelocks[*bucketp]);
1610 LOCK(&adb->namelocks[bucket]);
1614 adbname = ISC_LIST_HEAD(adb->names[bucket]);
1639 find_entry_and_lock(dns_adb_t *adb, isc_sockaddr_t *addr, int *bucketp,
1648 LOCK(&adb->entrylocks[bucket]);
1651 UNLOCK(&adb->entrylocks[*bucketp]);
1652 LOCK(&adb->entrylocks[bucket]);
1657 for (entry = ISC_LIST_HEAD(adb->entries[bucket]);
1661 (void)check_expire_entry(adb, &entry, now);
1664 ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
1665 ISC_LIST_PREPEND(adb->entries[bucket], entry, plink);
1677 entry_is_lame(dns_adb_t *adb, dns_adbentry_t *entry, dns_name_t *qname,
1696 free_adblameinfo(adb, &li);
1716 copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_name_t *qname,
1733 LOCK(&adb->entrylocks[bucket]);
1736 && entry_is_lame(adb, entry, qname, qtype, now)) {
1740 addrinfo = new_adbaddrinfo(adb, entry, find->port);
1748 inc_entry_refcnt(adb, entry, ISC_FALSE);
1752 UNLOCK(&adb->entrylocks[bucket]);
1764 LOCK(&adb->entrylocks[bucket]);
1767 && entry_is_lame(adb, entry, qname, qtype, now)) {
1771 addrinfo = new_adbaddrinfo(adb, entry, find->port);
1779 inc_entry_refcnt(adb, entry, ISC_FALSE);
1783 UNLOCK(&adb->entrylocks[bucket]);
1791 UNLOCK(&adb->entrylocks[bucket]);
1796 dns_adb_t *adb;
1800 adb = ev->ev_arg;
1801 INSIST(DNS_ADB_VALID(adb));
1807 LOCK(&adb->lock);
1808 UNLOCK(&adb->lock);
1809 destroy(adb);
1813 * Name bucket must be locked; adb may be locked; no other locks held.
1856 * Name bucket must be locked; adb may be locked; no other locks held.
1859 check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1862 isc_boolean_t overmem = isc_mem_isovermem(adb->mctx);
1875 victim = ISC_LIST_TAIL(adb->names[bucket]);
1903 * Entry bucket must be locked; adb may be locked; no other locks held.
1906 check_expire_entry(dns_adb_t *adb, dns_adbentry_t **entryp, isc_stdtime_t now)
1925 result = unlink_entry(adb, entry);
1926 free_adbentry(adb, &entry);
1928 dec_adb_irefcnt(adb);
1937 cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1944 LOCK(&adb->namelocks[bucket]);
1945 if (adb->name_sd[bucket]) {
1946 UNLOCK(&adb->namelocks[bucket]);
1950 name = ISC_LIST_HEAD(adb->names[bucket]);
1959 UNLOCK(&adb->namelocks[bucket]);
1967 cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) {
1973 LOCK(&adb->entrylocks[bucket]);
1974 entry = ISC_LIST_HEAD(adb->entries[bucket]);
1978 result = check_expire_entry(adb, &entry, now);
1981 UNLOCK(&adb->entrylocks[bucket]);
1986 destroy(dns_adb_t *adb) {
1987 adb->magic = 0;
1989 isc_task_detach(&adb->task);
1991 isc_mempool_destroy(&adb->nmp);
1992 isc_mempool_destroy(&adb->nhmp);
1993 isc_mempool_destroy(&adb->limp);
1994 isc_mempool_destroy(&adb->emp);
1995 isc_mempool_destroy(&adb->ahmp);
1996 isc_mempool_destroy(&adb->aimp);
1997 isc_mempool_destroy(&adb->afmp);
1999 DESTROYMUTEXBLOCK(adb->entrylocks, NBUCKETS);
2000 DESTROYMUTEXBLOCK(adb->namelocks, NBUCKETS);
2002 DESTROYLOCK(&adb->reflock);
2003 DESTROYLOCK(&adb->lock);
2004 DESTROYLOCK(&adb->mplock);
2005 DESTROYLOCK(&adb->overmemlock);
2007 isc_mem_putanddetach(&adb->mctx, adb, sizeof(dns_adb_t));
2019 dns_adb_t *adb;
2031 adb = isc_mem_get(mem, sizeof(dns_adb_t));
2032 if (adb == NULL)
2039 adb->magic = 0;
2040 adb->erefcnt = 1;
2041 adb->irefcnt = 0;
2042 adb->nmp = NULL;
2043 adb->nhmp = NULL;
2044 adb->limp = NULL;
2045 adb->emp = NULL;
2046 adb->ahmp = NULL;
2047 adb->aimp = NULL;
2048 adb->afmp = NULL;
2049 adb->task = NULL;
2050 adb->mctx = NULL;
2051 adb->view = view;
2052 adb->taskmgr = taskmgr;
2053 adb->next_cleanbucket = 0;
2054 ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL,
2055 DNS_EVENT_ADBCONTROL, shutdown_task, adb,
2056 adb, NULL, NULL);
2057 adb->cevent_sent = ISC_FALSE;
2058 adb->shutting_down = ISC_FALSE;
2059 ISC_LIST_INIT(adb->whenshutdown);
2061 isc_mem_attach(mem, &adb->mctx);
2063 result = isc_mutex_init(&adb->lock);
2067 result = isc_mutex_init(&adb->mplock);
2071 result = isc_mutex_init(&adb->reflock);
2075 result = isc_mutex_init(&adb->overmemlock);
2083 result = isc_mutexblock_init(adb->namelocks, NBUCKETS);
2087 ISC_LIST_INIT(adb->names[i]);
2088 ISC_LIST_INIT(adb->deadnames[i]);
2089 adb->name_sd[i] = ISC_FALSE;
2090 adb->name_refcnt[i] = 0;
2091 adb->irefcnt++;
2094 ISC_LIST_INIT(adb->entries[i]);
2095 ISC_LIST_INIT(adb->deadentries[i]);
2096 adb->entry_sd[i] = ISC_FALSE;
2097 adb->entry_refcnt[i] = 0;
2098 adb->irefcnt++;
2100 result = isc_mutexblock_init(adb->entrylocks, NBUCKETS);
2114 isc_mempool_associatelock((p), &adb->mplock); \
2117 MPINIT(dns_adbname_t, adb->nmp, "adbname");
2118 MPINIT(dns_adbnamehook_t, adb->nhmp, "adbnamehook");
2119 MPINIT(dns_adblameinfo_t, adb->limp, "adblameinfo");
2120 MPINIT(dns_adbentry_t, adb->emp, "adbentry");
2121 MPINIT(dns_adbfind_t, adb->ahmp, "adbfind");
2122 MPINIT(dns_adbaddrinfo_t, adb->aimp, "adbaddrinfo");
2123 MPINIT(dns_adbfetch_t, adb->afmp, "adbfetch");
2130 result = isc_task_create(adb->taskmgr, 0, &adb->task);
2133 isc_task_setname(adb->task, "ADB", adb);
2138 adb->magic = DNS_ADB_MAGIC;
2139 *newadb = adb;
2143 if (adb->task != NULL)
2144 isc_task_detach(&adb->task);
2147 DESTROYMUTEXBLOCK(adb->entrylocks, NBUCKETS);
2150 DESTROYMUTEXBLOCK(adb->namelocks, NBUCKETS);
2153 if (adb->nmp != NULL)
2154 isc_mempool_destroy(&adb->nmp);
2155 if (adb->nhmp != NULL)
2156 isc_mempool_destroy(&adb->nhmp);
2157 if (adb->limp != NULL)
2158 isc_mempool_destroy(&adb->limp);
2159 if (adb->emp != NULL)
2160 isc_mempool_destroy(&adb->emp);
2161 if (adb->ahmp != NULL)
2162 isc_mempool_destroy(&adb->ahmp);
2163 if (adb->aimp != NULL)
2164 isc_mempool_destroy(&adb->aimp);
2165 if (adb->afmp != NULL)
2166 isc_mempool_destroy(&adb->afmp);
2168 DESTROYLOCK(&adb->overmemlock);
2170 DESTROYLOCK(&adb->reflock);
2172 DESTROYLOCK(&adb->mplock);
2174 DESTROYLOCK(&adb->lock);
2176 isc_mem_putanddetach(&adb->mctx, adb, sizeof(dns_adb_t));
2182 dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbx) {
2184 REQUIRE(DNS_ADB_VALID(adb));
2187 inc_adb_erefcnt(adb);
2188 *adbx = adb;
2193 dns_adb_t *adb;
2198 adb = *adbx;
2201 INSIST(adb->erefcnt > 0);
2203 LOCK(&adb->reflock);
2204 adb->erefcnt--;
2205 need_exit_check = ISC_TF(adb->erefcnt == 0 && adb->irefcnt == 0);
2206 UNLOCK(&adb->reflock);
2209 LOCK(&adb->lock);
2210 INSIST(adb->shutting_down);
2211 check_exit(adb);
2212 UNLOCK(&adb->lock);
2217 dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) {
2223 * Send '*eventp' to 'task' when 'adb' has shutdown.
2226 REQUIRE(DNS_ADB_VALID(adb));
2232 LOCK(&adb->lock);
2234 LOCK(&adb->reflock);
2235 zeroirefcnt = ISC_TF(adb->irefcnt == 0);
2237 if (adb->shutting_down && zeroirefcnt &&
2238 isc_mempool_getallocated(adb->ahmp) == 0) {
2242 event->ev_sender = adb;
2248 ISC_LIST_APPEND(adb->whenshutdown, event, ev_link);
2251 UNLOCK(&adb->reflock);
2252 UNLOCK(&adb->lock);
2256 dns_adb_shutdown(dns_adb_t *adb) {
2260 * Shutdown 'adb'.
2263 LOCK(&adb->lock);
2265 if (!adb->shutting_down) {
2266 adb->shutting_down = ISC_TRUE;
2267 isc_mem_setwater(adb->mctx, water, adb, 0, 0);
2268 need_check_exit = shutdown_names(adb);
2270 need_check_exit = shutdown_entries(adb);
2272 check_exit(adb);
2275 UNLOCK(&adb->lock);
2279 dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
2294 REQUIRE(DNS_ADB_VALID(adb));
2338 find = new_adbfind(adb);
2357 adbname = find_name_and_lock(adb, name, find->options, &bucket);
2359 if (adb->name_sd[bucket]) {
2362 RUNTIME_CHECK(free_adbfind(adb, &find) == ISC_FALSE);
2375 check_stale_name(adb, bucket, now);
2377 adbname = new_adbname(adb, name);
2379 RUNTIME_CHECK(free_adbfind(adb, &find) == ISC_FALSE);
2383 link_name(adb, bucket, adbname);
2392 ISC_LIST_UNLINK(adb->names[bucket], adbname, plink);
2393 ISC_LIST_PREPEND(adb->names[bucket], adbname, plink);
2539 copy_namehook_lists(adb, find, qname, qtype, adbname, now);
2615 UNLOCK(&adb->namelocks[bucket]);
2626 dns_adb_t *adb;
2637 adb = find->adb;
2638 REQUIRE(DNS_ADB_VALID(adb));
2649 * Return the find to the memory pool, and decrement the adb's
2652 overmem = isc_mem_isovermem(adb->mctx);
2659 RUNTIME_CHECK(dec_entry_refcnt(adb, overmem, entry, ISC_TRUE) ==
2661 free_adbaddrinfo(adb, &ai);
2666 * WARNING: The find is freed with the adb locked. This is done
2672 LOCK(&adb->lock);
2673 if (free_adbfind(adb, &find))
2674 check_exit(adb);
2675 UNLOCK(&adb->lock);
2682 dns_adb_t *adb;
2690 adb = find->adb;
2691 REQUIRE(DNS_ADB_VALID(adb));
2704 violate_locking_hierarchy(&find->lock, &adb->namelocks[unlock_bucket]);
2711 UNLOCK(&adb->namelocks[unlock_bucket]);
2737 dns_adb_dump(dns_adb_t *adb, FILE *f) {
2741 REQUIRE(DNS_ADB_VALID(adb));
2745 * Lock the adb itself, lock all the name buckets, then lock all
2746 * the entry buckets. This should put the adb into a state where
2751 LOCK(&adb->lock);
2755 RUNTIME_CHECK(cleanup_names(adb, i, now) == ISC_FALSE);
2757 RUNTIME_CHECK(cleanup_entries(adb, i, now) == ISC_FALSE);
2759 dump_adb(adb, f, ISC_FALSE, now);
2760 UNLOCK(&adb->lock);
2771 dump_adb(dns_adb_t *adb, FILE *f, isc_boolean_t debug, isc_stdtime_t now) {
2779 adb, adb->erefcnt, adb->irefcnt,
2780 isc_mempool_getallocated(adb->nhmp));
2783 LOCK(&adb->namelocks[i]);
2785 LOCK(&adb->entrylocks[i]);
2791 name = ISC_LIST_HEAD(adb->names[i]);
2835 entry = ISC_LIST_HEAD(adb->entries[i]);
2847 UNLOCK(&adb->entrylocks[i]);
2849 UNLOCK(&adb->namelocks[i]);
2991 dns_adb_t *adb;
2996 adb = adbname->adb;
2997 INSIST(DNS_ADB_VALID(adb));
3009 result = dns_view_find(adb->view, &adbname->name, rdtype, now,
3043 "adb name %p: Caching auth negative entry for A",
3051 "adb name %p: Caching auth negative entry for AAAA",
3074 "adb name %p: Caching negative entry for A (ttl %u)",
3078 "adb name %p: Caching negative entry for AAAA (ttl %u)",
3096 clean_target(adb, &adbname->target);
3098 result = set_target(adb, &adbname->name, fname, &rdataset,
3103 "adb name %p: caching alias target",
3124 dns_adb_t *adb;
3139 adb = name->adb;
3140 INSIST(DNS_ADB_VALID(adb));
3143 LOCK(&adb->namelocks[bucket]);
3179 free_adbfetch(adb, &fetch);
3184 UNLOCK(&adb->namelocks[bucket]);
3187 LOCK(&adb->lock);
3188 check_exit(adb);
3189 UNLOCK(&adb->lock);
3203 DP(NCACHE_LEVEL, "adb fetch name %p: "
3212 inc_stats(adb, dns_resstatscounter_gluefetchv4fail);
3214 DP(NCACHE_LEVEL, "adb fetch name %p: "
3223 inc_stats(adb, dns_resstatscounter_gluefetchv6fail);
3233 clean_target(adb, &name->target);
3235 result = set_target(adb, &name->name,
3241 "adb fetch name %p: caching alias target",
3256 DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s",
3263 inc_stats(adb, dns_resstatscounter_gluefetchv4fail);
3267 inc_stats(adb, dns_resstatscounter_gluefetchv6fail);
3287 free_adbfetch(adb, &fetch);
3292 UNLOCK(&adb->namelocks[bucket]);
3302 dns_adb_t *adb;
3310 adb = adbname->adb;
3311 INSIST(DNS_ADB_VALID(adb));
3329 result = dns_view_findzonecut2(adb->view, &adbname->name, name,
3338 fetch = new_adbfetch(adb);
3344 result = dns_resolver_createfetch(adb->view->resolver, &adbname->name,
3346 options, adb->task, fetch_callback,
3354 inc_stats(adb, dns_resstatscounter_gluefetchv4);
3357 inc_stats(adb, dns_resstatscounter_gluefetchv6);
3363 free_adbfetch(adb, &fetch);
3371 * XXXMLG Needs to take a find argument and an address info, no zone or adb,
3375 dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname,
3382 REQUIRE(DNS_ADB_VALID(adb));
3387 LOCK(&adb->entrylocks[bucket]);
3397 li = new_adblameinfo(adb, qname, qtype);
3407 UNLOCK(&adb->entrylocks[bucket]);
3413 dns_adb_adjustsrtt(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
3420 REQUIRE(DNS_ADB_VALID(adb));
3425 LOCK(&adb->entrylocks[bucket]);
3441 UNLOCK(&adb->entrylocks[bucket]);
3445 dns_adb_changeflags(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
3451 REQUIRE(DNS_ADB_VALID(adb));
3455 LOCK(&adb->entrylocks[bucket]);
3469 UNLOCK(&adb->entrylocks[bucket]);
3473 dns_adb_findaddrinfo(dns_adb_t *adb, isc_sockaddr_t *sa,
3482 REQUIRE(DNS_ADB_VALID(adb));
3489 entry = find_entry_and_lock(adb, sa, &bucket, now);
3491 if (adb->entry_sd[bucket]) {
3499 entry = new_adbentry(adb);
3505 link_entry(adb, bucket, entry);
3511 addr = new_adbaddrinfo(adb, entry, port);
3515 inc_entry_refcnt(adb, entry, ISC_FALSE);
3520 UNLOCK(&adb->entrylocks[bucket]);
3526 dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) {
3534 REQUIRE(DNS_ADB_VALID(adb));
3542 overmem = isc_mem_isovermem(adb->mctx);
3545 LOCK(&adb->entrylocks[bucket]);
3552 want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE);
3554 UNLOCK(&adb->entrylocks[bucket]);
3557 free_adbaddrinfo(adb, &addr);
3560 LOCK(&adb->lock);
3561 check_exit(adb);
3562 UNLOCK(&adb->lock);
3567 dns_adb_flush(dns_adb_t *adb) {
3570 INSIST(DNS_ADB_VALID(adb));
3572 LOCK(&adb->lock);
3578 RUNTIME_CHECK(cleanup_names(adb, i, INT_MAX) == ISC_FALSE);
3580 RUNTIME_CHECK(cleanup_entries(adb, i, INT_MAX) == ISC_FALSE);
3583 dump_adb(adb, stdout, ISC_TRUE, INT_MAX);
3586 UNLOCK(&adb->lock);
3590 dns_adb_flushname(dns_adb_t *adb, dns_name_t *name) {
3595 INSIST(DNS_ADB_VALID(adb));
3597 LOCK(&adb->lock);
3599 LOCK(&adb->namelocks[bucket]);
3600 adbname = ISC_LIST_HEAD(adb->names[bucket]);
3611 UNLOCK(&adb->namelocks[bucket]);
3612 UNLOCK(&adb->lock);
3625 dns_adb_t *adb = arg;
3628 REQUIRE(DNS_ADB_VALID(adb));
3631 "adb reached %s water mark", overmem ? "high" : "low");
3635 dns_adb_setadbsize(dns_adb_t *adb, isc_uint32_t size) {
3639 INSIST(DNS_ADB_VALID(adb));
3648 isc_mem_setwater(adb->mctx, water, adb, 0, 0);
3650 isc_mem_setwater(adb->mctx, water, adb, hiwater, lowater);