#include <config.h>
#include <limits.h>
#include <isc/mutexblock.h>
#include <isc/netaddr.h>
#include <isc/random.h>
#include <isc/stats.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/db.h>
#include <dns/events.h>
#include <dns/log.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/stats.h>
Go to the source code of this file.
Data Structures | |
struct | dns_adbname |
dns_adbname structure More... | |
struct | dns_adbfetch |
The adbfetch structure. More... | |
struct | dns_adbnamehook |
This is a small widget that dangles off a dns_adbname_t. It contains a pointer to the address information about this host, and a link to the next namehook that will contain the next address this host has. More... | |
struct | dns_adblameinfo |
This is a small widget that holds qname-specific information about an address. Currently limited to lameness, but could just as easily be extended to other types of information about zones. More... | |
struct | dns_adbentry |
An address entry. It holds quite a bit of information about addresses, including edns state (in "flags"), rtt, and of course the address of the host. More... | |
Defines | |
#define | DNS_ADB_MAGIC ISC_MAGIC('D', 'a', 'd', 'b') |
#define | DNS_ADB_VALID(x) ISC_MAGIC_VALID(x, DNS_ADB_MAGIC) |
#define | DNS_ADBNAME_MAGIC ISC_MAGIC('a', 'd', 'b', 'N') |
#define | DNS_ADBNAME_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAME_MAGIC) |
#define | DNS_ADBNAMEHOOK_MAGIC ISC_MAGIC('a', 'd', 'N', 'H') |
#define | DNS_ADBNAMEHOOK_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAMEHOOK_MAGIC) |
#define | DNS_ADBLAMEINFO_MAGIC ISC_MAGIC('a', 'd', 'b', 'Z') |
#define | DNS_ADBLAMEINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBLAMEINFO_MAGIC) |
#define | DNS_ADBENTRY_MAGIC ISC_MAGIC('a', 'd', 'b', 'E') |
#define | DNS_ADBENTRY_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBENTRY_MAGIC) |
#define | DNS_ADBFETCH_MAGIC ISC_MAGIC('a', 'd', 'F', '4') |
#define | DNS_ADBFETCH_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFETCH_MAGIC) |
#define | DNS_ADBFETCH6_MAGIC ISC_MAGIC('a', 'd', 'F', '6') |
#define | DNS_ADBFETCH6_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFETCH6_MAGIC) |
#define | ADB_CACHE_MINIMUM 10 |
seconds | |
#define | ADB_CACHE_MAXIMUM 86400 |
seconds (86400 = 24 hours) | |
#define | ADB_ENTRY_WINDOW 1800 |
seconds | |
#define | ADB_STALE_MARGIN 1800 |
The period in seconds after which an ADB name entry is regarded as stale and forced to be cleaned up. TODO: This should probably be configurable at run-time. | |
#define | FREE_ITEMS 64 |
free count for memory pools | |
#define | FILL_COUNT 16 |
fill count for memory pools | |
#define | DNS_ADB_INVALIDBUCKET (-1) |
invalid bucket address | |
#define | DNS_ADB_MINADBSIZE (1024U*1024U) |
1 Megabyte | |
#define | FIND_EVENT_SENT 0x40000000 |
#define | FIND_EVENT_FREED 0x80000000 |
#define | FIND_EVENTSENT(h) (((h)->flags & FIND_EVENT_SENT) != 0) |
#define | FIND_EVENTFREED(h) (((h)->flags & FIND_EVENT_FREED) != 0) |
#define | NAME_NEEDS_POKE 0x80000000 |
#define | NAME_IS_DEAD 0x40000000 |
#define | NAME_HINT_OK DNS_ADBFIND_HINTOK |
#define | NAME_GLUE_OK DNS_ADBFIND_GLUEOK |
#define | NAME_STARTATZONE DNS_ADBFIND_STARTATZONE |
#define | NAME_DEAD(n) (((n)->flags & NAME_IS_DEAD) != 0) |
#define | NAME_NEEDSPOKE(n) (((n)->flags & NAME_NEEDS_POKE) != 0) |
#define | NAME_GLUEOK(n) (((n)->flags & NAME_GLUE_OK) != 0) |
#define | NAME_HINTOK(n) (((n)->flags & NAME_HINT_OK) != 0) |
#define | ENTRY_IS_DEAD 0x00400000 |
#define | NAME_HAS_V4(n) (!ISC_LIST_EMPTY((n)->v4)) |
#define | NAME_HAS_V6(n) (!ISC_LIST_EMPTY((n)->v6)) |
#define | NAME_HAS_ADDRS(n) (NAME_HAS_V4(n) || NAME_HAS_V6(n)) |
#define | NAME_FETCH_A(n) ((n)->fetch_a != NULL) |
#define | NAME_FETCH_AAAA(n) ((n)->fetch_aaaa != NULL) |
#define | NAME_FETCH_V4(n) (NAME_FETCH_A(n)) |
#define | NAME_FETCH_V6(n) (NAME_FETCH_AAAA(n)) |
#define | NAME_FETCH(n) (NAME_FETCH_V4(n) || NAME_FETCH_V6(n)) |
#define | FIND_WANTEVENT(fn) (((fn)->options & DNS_ADBFIND_WANTEVENT) != 0) |
#define | FIND_WANTEMPTYEVENT(fn) (((fn)->options & DNS_ADBFIND_EMPTYEVENT) != 0) |
#define | FIND_AVOIDFETCHES(fn) |
#define | FIND_STARTATZONE(fn) |
#define | FIND_HINTOK(fn) (((fn)->options & DNS_ADBFIND_HINTOK) != 0) |
#define | FIND_GLUEOK(fn) (((fn)->options & DNS_ADBFIND_GLUEOK) != 0) |
#define | FIND_HAS_ADDRS(fn) (!ISC_LIST_EMPTY((fn)->list)) |
#define | FIND_RETURNLAME(fn) (((fn)->options & DNS_ADBFIND_RETURNLAME) != 0) |
#define | WANT_INET(x) (((x) & DNS_ADBFIND_INET) != 0) |
#define | WANT_INET6(x) (((x) & DNS_ADBFIND_INET6) != 0) |
#define | EXPIRE_OK(exp, now) ((exp == INT_MAX) || (exp < now)) |
#define | GLUE_OK(nf, o) (!NAME_GLUEOK(nf) || (((o) & DNS_ADBFIND_GLUEOK) != 0)) |
#define | HINT_OK(nf, o) (!NAME_HINTOK(nf) || (((o) & DNS_ADBFIND_HINTOK) != 0)) |
#define | GLUEHINT_OK(nf, o) (GLUE_OK(nf, o) || HINT_OK(nf, o)) |
#define | STARTATZONE_MATCHES(nf, o) |
#define | ENTER_LEVEL ISC_LOG_DEBUG(50) |
#define | EXIT_LEVEL ENTER_LEVEL |
#define | CLEAN_LEVEL ISC_LOG_DEBUG(100) |
#define | DEF_LEVEL ISC_LOG_DEBUG(5) |
#define | NCACHE_LEVEL ISC_LOG_DEBUG(20) |
#define | NCACHE_RESULT(r) |
#define | AUTH_NX(r) |
#define | NXDOMAIN_RESULT(r) |
#define | NXRRSET_RESULT(r) |
#define | FIND_ERR_SUCCESS 0 |
#define | FIND_ERR_CANCELED 1 |
#define | FIND_ERR_FAILURE 2 |
#define | FIND_ERR_NXDOMAIN 3 |
#define | FIND_ERR_NXRRSET 4 |
#define | FIND_ERR_UNEXPECTED 5 |
#define | FIND_ERR_NOTFOUND 6 |
#define | FIND_ERR_MAX 7 |
#define | NEWERR(old, new) (ISC_MIN((old), (new))) |
#define | ALLOCENTRY(adb, el) |
#define | ALLOCNAME(adb, el) |
#define | MPINIT(t, p, n) |
#define | EDNSTOS 3U |
Functions | |
typedef | ISC_LIST (dns_adbname_t) |
dns adb structure | |
static dns_adbname_t * | new_adbname (dns_adb_t *, dns_name_t *) |
static void | free_adbname (dns_adb_t *, dns_adbname_t **) |
static dns_adbnamehook_t * | new_adbnamehook (dns_adb_t *, dns_adbentry_t *) |
static void | free_adbnamehook (dns_adb_t *, dns_adbnamehook_t **) |
static dns_adblameinfo_t * | new_adblameinfo (dns_adb_t *, dns_name_t *, dns_rdatatype_t) |
static void | free_adblameinfo (dns_adb_t *, dns_adblameinfo_t **) |
static dns_adbentry_t * | new_adbentry (dns_adb_t *) |
static void | free_adbentry (dns_adb_t *, dns_adbentry_t **) |
static dns_adbfind_t * | new_adbfind (dns_adb_t *) |
static isc_boolean_t | free_adbfind (dns_adb_t *, dns_adbfind_t **) |
static dns_adbaddrinfo_t * | new_adbaddrinfo (dns_adb_t *, dns_adbentry_t *, in_port_t) |
static dns_adbfetch_t * | new_adbfetch (dns_adb_t *) |
static void | free_adbfetch (dns_adb_t *, dns_adbfetch_t **) |
static dns_adbname_t * | find_name_and_lock (dns_adb_t *, dns_name_t *, unsigned int, int *) |
static dns_adbentry_t * | find_entry_and_lock (dns_adb_t *, isc_sockaddr_t *, int *, isc_stdtime_t) |
static void | dump_adb (dns_adb_t *, FILE *, isc_boolean_t debug, isc_stdtime_t) |
static void | print_dns_name (FILE *, dns_name_t *) |
static void | print_namehook_list (FILE *, const char *legend, dns_adbnamehooklist_t *list, isc_boolean_t debug, isc_stdtime_t now) |
static void | print_find_list (FILE *, dns_adbname_t *) |
static void | print_fetch_list (FILE *, dns_adbname_t *) |
static isc_boolean_t | dec_adb_irefcnt (dns_adb_t *) |
static void | inc_adb_irefcnt (dns_adb_t *) |
static void | inc_adb_erefcnt (dns_adb_t *) |
static void | inc_entry_refcnt (dns_adb_t *, dns_adbentry_t *, isc_boolean_t) |
static isc_boolean_t | dec_entry_refcnt (dns_adb_t *, isc_boolean_t, dns_adbentry_t *, isc_boolean_t) |
static void | violate_locking_hierarchy (isc_mutex_t *, isc_mutex_t *) |
static isc_boolean_t | clean_namehooks (dns_adb_t *, dns_adbnamehooklist_t *) |
static void | clean_target (dns_adb_t *, dns_name_t *) |
static void | clean_finds_at_name (dns_adbname_t *, isc_eventtype_t, unsigned int) |
static isc_boolean_t | check_expire_namehooks (dns_adbname_t *, isc_stdtime_t) |
static isc_boolean_t | check_expire_entry (dns_adb_t *, dns_adbentry_t **, isc_stdtime_t) |
static void | cancel_fetches_at_name (dns_adbname_t *) |
static isc_result_t | dbfind_name (dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t) |
static isc_result_t | fetch_name (dns_adbname_t *, isc_boolean_t, unsigned int, isc_counter_t *qc, dns_rdatatype_t) |
static void | check_exit (dns_adb_t *) |
static void | destroy (dns_adb_t *) |
static isc_boolean_t | shutdown_names (dns_adb_t *) |
static isc_boolean_t | shutdown_entries (dns_adb_t *) |
static void | link_name (dns_adb_t *, int, dns_adbname_t *) |
static isc_boolean_t | unlink_name (dns_adb_t *, dns_adbname_t *) |
static void | link_entry (dns_adb_t *, int, dns_adbentry_t *) |
static isc_boolean_t | unlink_entry (dns_adb_t *, dns_adbentry_t *) |
static isc_boolean_t | kill_name (dns_adbname_t **, isc_eventtype_t) |
static void | water (void *, int) |
static void | dump_entry (FILE *, dns_adbentry_t *, isc_boolean_t, isc_stdtime_t) |
static void | adjustsrtt (dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor, isc_stdtime_t now) |
static void | shutdown_task (isc_task_t *task, isc_event_t *ev) |
static void | DP (int level, const char *format,...) ISC_FORMAT_PRINTF(2 |
static void | inc_stats (dns_adb_t *adb, isc_statscounter_t counter) |
Increment resolver-related statistics counters. | |
static void | set_adbstat (dns_adb_t *adb, isc_uint64_t val, isc_statscounter_t counter) |
Set adb-related statistics counters. | |
static void | dec_adbstats (dns_adb_t *adb, isc_statscounter_t counter) |
static void | inc_adbstats (dns_adb_t *adb, isc_statscounter_t counter) |
static dns_ttl_t | ttlclamp (dns_ttl_t ttl) |
static void | grow_entries (isc_task_t *task, isc_event_t *ev) |
static void | grow_names (isc_task_t *task, isc_event_t *ev) |
static isc_result_t | import_rdataset (dns_adbname_t *adbname, dns_rdataset_t *rdataset, isc_stdtime_t now) |
static isc_result_t | set_target (dns_adb_t *adb, dns_name_t *name, dns_name_t *fname, dns_rdataset_t *rdataset, dns_name_t *target) |
static void | event_free (isc_event_t *event) |
static void | free_adbaddrinfo (dns_adb_t *adb, dns_adbaddrinfo_t **ainfo) |
static isc_boolean_t | entry_is_lame (dns_adb_t *adb, dns_adbentry_t *entry, dns_name_t *qname, dns_rdatatype_t qtype, isc_stdtime_t now) |
static void | copy_namehook_lists (dns_adb_t *adb, dns_adbfind_t *find, dns_name_t *qname, dns_rdatatype_t qtype, dns_adbname_t *name, isc_stdtime_t now) |
static isc_boolean_t | check_expire_name (dns_adbname_t **namep, isc_stdtime_t now) |
static void | check_stale_name (dns_adb_t *adb, int bucket, isc_stdtime_t now) |
Examine the tail entry of the LRU list to see if it expires or is stale (unused for some period); if so, the name entry will be freed. If the ADB is in the overmem condition, the tail and the next to tail entries will be unconditionally removed (unless they have an outstanding fetch). We don't care about a race on 'overmem' at the risk of causing some collateral damage or a small delay in starting cleanup, so we don't bother to lock ADB (if it's not locked). | |
static isc_boolean_t | cleanup_names (dns_adb_t *adb, int bucket, isc_stdtime_t now) |
static isc_boolean_t | cleanup_entries (dns_adb_t *adb, int bucket, isc_stdtime_t now) |
isc_result_t | dns_adb_create (isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, isc_taskmgr_t *taskmgr, dns_adb_t **newadb) |
Create a new ADB. | |
void | dns_adb_attach (dns_adb_t *adb, dns_adb_t **adbx) |
void | dns_adb_detach (dns_adb_t **adbx) |
Attach to an 'adb' to 'adbp'. | |
void | dns_adb_whenshutdown (dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) |
Delete the ADB. Sets *ADB to NULL. Cancels any outstanding requests. | |
static void | shutdown_stage2 (isc_task_t *task, isc_event_t *event) |
void | dns_adb_shutdown (dns_adb_t *adb) |
Send '*eventp' to 'task' when 'adb' has shutdown. | |
isc_result_t | dns_adb_createfind (dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *qname, dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, dns_adbfind_t **findp) |
isc_result_t | dns_adb_createfind2 (dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, void *arg, dns_name_t *name, dns_name_t *qname, dns_rdatatype_t qtype, unsigned int options, isc_stdtime_t now, dns_name_t *target, in_port_t port, unsigned int depth, isc_counter_t *qc, dns_adbfind_t **findp) |
Main interface for clients. The adb will look up the name given in "name" and will build up a list of found addresses, and perhaps start internal fetches to resolve names that are unknown currently. | |
void | dns_adb_destroyfind (dns_adbfind_t **findp) |
Destroys the find reference. | |
void | dns_adb_cancelfind (dns_adbfind_t *find) |
Cancels the find, and sends the event off to the caller. | |
void | dns_adb_dump (dns_adb_t *adb, FILE *f) |
This function is only used for debugging. It will dump as much of the state of the running system as possible. | |
static void | dump_ttl (FILE *f, const char *legend, isc_stdtime_t value, isc_stdtime_t now) |
void | dns_adb_dumpfind (dns_adbfind_t *find, FILE *f) |
This function is only used for debugging. Dump the data associated with a find. | |
static void | print_fetch (FILE *f, dns_adbfetch_t *ft, const char *type) |
static void | fetch_callback (isc_task_t *task, isc_event_t *ev) |
isc_result_t | dns_adb_marklame (dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *qname, dns_rdatatype_t qtype, isc_stdtime_t expire_time) |
Mark the given address as lame for the <qname,qtype>. expire_time should be set to the time when the entry should expire. That is, if it is to expire 10 minutes in the future, it should set it to (now + 10 * 60). | |
void | dns_adb_adjustsrtt (dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor) |
Mix the round trip time into the existing smoothed rtt. | |
void | dns_adb_agesrtt (dns_adb_t *adb, dns_adbaddrinfo_t *addr, isc_stdtime_t now) |
void | dns_adb_changeflags (dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int bits, unsigned int mask) |
isc_boolean_t | dns_adb_noedns (dns_adb_t *adb, dns_adbaddrinfo_t *addr) |
Record a failed EDNS UDP response and the advertised EDNS UDP buffer size used. | |
void | dns_adb_plainresponse (dns_adb_t *adb, dns_adbaddrinfo_t *addr) |
Return suggested EDNS UDP size based on observed responses / failures. 'lookups' is the number of times the current lookup has been attempted. | |
void | dns_adb_timeout (dns_adb_t *adb, dns_adbaddrinfo_t *addr) |
Record a successful plain DNS response. | |
void | dns_adb_ednsto (dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size) |
Record a plain DNS UDP query failed. | |
void | dns_adb_setudpsize (dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size) |
Change Flags. | |
unsigned int | dns_adb_getudpsize (dns_adb_t *adb, dns_adbaddrinfo_t *addr) |
Update seen UDP response size. The largest seen will be returned by dns_adb_getudpsize(). | |
unsigned int | dns_adb_probesize (dns_adb_t *adb, dns_adbaddrinfo_t *addr) |
Return the largest seen UDP response size. | |
unsigned int | dns_adb_probesize2 (dns_adb_t *adb, dns_adbaddrinfo_t *addr, int lookups) |
void | dns_adb_setsit (dns_adb_t *adb, dns_adbaddrinfo_t *addr, const unsigned char *sit, size_t len) |
Record the Source Identity Token (SIT) associated with this addresss. If sit is NULL or len is zero. The recorded SIT is cleared. | |
size_t | dns_adb_getsit (dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned char *sit, size_t len) |
isc_result_t | dns_adb_findaddrinfo (dns_adb_t *adb, isc_sockaddr_t *sa, dns_adbaddrinfo_t **addrp, isc_stdtime_t now) |
Return whether EDNS should be disabled for this server. | |
void | dns_adb_freeaddrinfo (dns_adb_t *adb, dns_adbaddrinfo_t **addrp) |
Free a dns_adbaddrinfo_t allocated by dns_adb_findaddrinfo(). | |
void | dns_adb_flush (dns_adb_t *adb) |
Flushes all cached data from the adb. | |
void | dns_adb_flushname (dns_adb_t *adb, dns_name_t *name) |
Flush 'name' from the adb cache. | |
void | dns_adb_flushnames (dns_adb_t *adb, dns_name_t *name) |
Flush 'name' and all subdomains from the adb cache. | |
void | dns_adb_setadbsize (dns_adb_t *adb, size_t size) |
Set a target memory size. If memory usage exceeds the target size entries will be removed before they would have expired on a random basis. | |
Variables | |
static const char * | errnames [] |
static isc_result_t | find_err_map [FIND_ERR_MAX] |
static const unsigned | nbuckets [] |
Definition in file adb.c.
#define DNS_ADB_MAGIC ISC_MAGIC('D', 'a', 'd', 'b') |
#define DNS_ADB_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADB_MAGIC) |
Definition at line 52 of file adb.c.
Referenced by check_expire_namehooks(), dbfind_name(), dns_adb_adjustsrtt(), dns_adb_agesrtt(), dns_adb_attach(), dns_adb_cancelfind(), dns_adb_changeflags(), dns_adb_createfind2(), dns_adb_destroyfind(), dns_adb_detach(), dns_adb_dump(), dns_adb_ednsto(), dns_adb_findaddrinfo(), dns_adb_flush(), dns_adb_flushname(), dns_adb_flushnames(), dns_adb_freeaddrinfo(), dns_adb_getsit(), dns_adb_getudpsize(), dns_adb_marklame(), dns_adb_noedns(), dns_adb_plainresponse(), dns_adb_probesize2(), dns_adb_setadbsize(), dns_adb_setsit(), dns_adb_setudpsize(), dns_adb_timeout(), dns_adb_whenshutdown(), fetch_callback(), fetch_name(), grow_entries(), grow_names(), import_rdataset(), kill_name(), shutdown_stage2(), shutdown_task(), and water().
#define DNS_ADBNAME_MAGIC ISC_MAGIC('a', 'd', 'b', 'N') |
#define DNS_ADBNAME_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBNAME_MAGIC) |
Definition at line 54 of file adb.c.
Referenced by check_expire_name(), check_expire_namehooks(), dbfind_name(), fetch_callback(), fetch_name(), free_adbname(), import_rdataset(), and kill_name().
#define DNS_ADBNAMEHOOK_MAGIC ISC_MAGIC('a', 'd', 'N', 'H') |
#define DNS_ADBNAMEHOOK_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBNAMEHOOK_MAGIC) |
#define DNS_ADBLAMEINFO_MAGIC ISC_MAGIC('a', 'd', 'b', 'Z') |
#define DNS_ADBLAMEINFO_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBLAMEINFO_MAGIC) |
#define DNS_ADBENTRY_MAGIC ISC_MAGIC('a', 'd', 'b', 'E') |
#define DNS_ADBENTRY_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBENTRY_MAGIC) |
Definition at line 60 of file adb.c.
Referenced by check_expire_entry(), clean_namehooks(), dns_adb_destroyfind(), dns_adb_freeaddrinfo(), and free_adbentry().
#define DNS_ADBFETCH_MAGIC ISC_MAGIC('a', 'd', 'F', '4') |
#define DNS_ADBFETCH_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBFETCH_MAGIC) |
#define DNS_ADBFETCH6_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBFETCH6_MAGIC) |
#define ADB_CACHE_MINIMUM 10 |
seconds
For type 3 negative cache entries, we will remember that the address is broken for this long. XXXMLG This is also used for actual addresses, too. The intent is to keep us from constantly asking about A/AAAA records if the zone has extremely low TTLs.
Definition at line 72 of file adb.c.
Referenced by import_rdataset(), and ttlclamp().
#define ADB_CACHE_MAXIMUM 86400 |
#define ADB_ENTRY_WINDOW 1800 |
seconds
Definition at line 74 of file adb.c.
Referenced by adjustsrtt(), dns_adb_changeflags(), dns_adb_freeaddrinfo(), and import_rdataset().
#define ADB_STALE_MARGIN 1800 |
The period in seconds after which an ADB name entry is regarded as stale and forced to be cleaned up. TODO: This should probably be configurable at run-time.
Definition at line 82 of file adb.c.
Referenced by check_stale_name().
#define DNS_ADB_INVALIDBUCKET (-1) |
invalid bucket address
Definition at line 88 of file adb.c.
Referenced by check_stale_name(), clean_finds_at_name(), clean_namehooks(), copy_namehook_lists(), dec_entry_refcnt(), dns_adb_cancelfind(), dns_adb_createfind2(), dns_adb_destroyfind(), dns_adb_findaddrinfo(), find_entry_and_lock(), find_name_and_lock(), free_adbentry(), free_adbfind(), free_adbname(), import_rdataset(), link_name(), new_adbentry(), new_adbfind(), new_adbname(), unlink_entry(), and unlink_name().
#define DNS_ADB_MINADBSIZE (1024U*1024U) |
#define FIND_EVENT_SENT 0x40000000 |
Definition at line 344 of file adb.c.
Referenced by clean_finds_at_name(), and dns_adb_createfind2().
#define FIND_EVENT_FREED 0x80000000 |
#define FIND_EVENTSENT | ( | h | ) | (((h)->flags & FIND_EVENT_SENT) != 0) |
Definition at line 346 of file adb.c.
Referenced by clean_finds_at_name(), and dns_adb_cancelfind().
#define FIND_EVENTFREED | ( | h | ) | (((h)->flags & FIND_EVENT_FREED) != 0) |
Definition at line 347 of file adb.c.
Referenced by dns_adb_cancelfind(), and dns_adb_destroyfind().
#define NAME_IS_DEAD 0x40000000 |
#define NAME_HINT_OK DNS_ADBFIND_HINTOK |
#define NAME_GLUE_OK DNS_ADBFIND_GLUEOK |
#define NAME_STARTATZONE DNS_ADBFIND_STARTATZONE |
#define NAME_DEAD | ( | n | ) | (((n)->flags & NAME_IS_DEAD) != 0) |
Definition at line 354 of file adb.c.
Referenced by check_stale_name(), dns_adb_flushname(), dns_adb_flushnames(), fetch_callback(), find_name_and_lock(), kill_name(), and unlink_name().
#define NAME_NEEDSPOKE | ( | n | ) | (((n)->flags & NAME_NEEDS_POKE) != 0) |
#define NAME_GLUEOK | ( | n | ) | (((n)->flags & NAME_GLUE_OK) != 0) |
#define NAME_HINTOK | ( | n | ) | (((n)->flags & NAME_HINT_OK) != 0) |
#define ENTRY_IS_DEAD 0x00400000 |
Definition at line 363 of file adb.c.
Referenced by dec_entry_refcnt(), dns_adb_changeflags(), link_entry(), and unlink_entry().
#define NAME_HAS_V4 | ( | n | ) | (!ISC_LIST_EMPTY((n)->v4)) |
Definition at line 369 of file adb.c.
Referenced by check_expire_name(), check_expire_namehooks(), dns_adb_createfind2(), and free_adbname().
#define NAME_HAS_V6 | ( | n | ) | (!ISC_LIST_EMPTY((n)->v6)) |
Definition at line 370 of file adb.c.
Referenced by check_expire_name(), check_expire_namehooks(), dns_adb_createfind2(), and free_adbname().
#define NAME_HAS_ADDRS | ( | n | ) | (NAME_HAS_V4(n) || NAME_HAS_V6(n)) |
#define NAME_FETCH_A | ( | n | ) | ((n)->fetch_a != NULL) |
Definition at line 380 of file adb.c.
Referenced by cancel_fetches_at_name(), fetch_callback(), and print_fetch_list().
#define NAME_FETCH_AAAA | ( | n | ) | ((n)->fetch_aaaa != NULL) |
Definition at line 381 of file adb.c.
Referenced by cancel_fetches_at_name(), fetch_callback(), and print_fetch_list().
#define NAME_FETCH_V4 | ( | n | ) | (NAME_FETCH_A(n)) |
Definition at line 382 of file adb.c.
Referenced by check_expire_namehooks(), dns_adb_createfind2(), and fetch_name().
#define NAME_FETCH_V6 | ( | n | ) | (NAME_FETCH_AAAA(n)) |
Definition at line 383 of file adb.c.
Referenced by check_expire_namehooks(), dns_adb_createfind2(), and fetch_name().
#define NAME_FETCH | ( | n | ) | (NAME_FETCH_V4(n) || NAME_FETCH_V6(n)) |
Definition at line 384 of file adb.c.
Referenced by check_expire_name(), check_stale_name(), free_adbname(), and kill_name().
#define FIND_WANTEVENT | ( | fn | ) | (((fn)->options & DNS_ADBFIND_WANTEVENT) != 0) |
Definition at line 389 of file adb.c.
Referenced by dns_adb_cancelfind(), and dns_adb_createfind2().
#define FIND_WANTEMPTYEVENT | ( | fn | ) | (((fn)->options & DNS_ADBFIND_EMPTYEVENT) != 0) |
#define FIND_AVOIDFETCHES | ( | fn | ) |
Value:
(((fn)->options & DNS_ADBFIND_AVOIDFETCHES) \ != 0)
Definition at line 391 of file adb.c.
Referenced by dns_adb_createfind2().
#define FIND_STARTATZONE | ( | fn | ) |
Value:
(((fn)->options & DNS_ADBFIND_STARTATZONE) \ != 0)
Definition at line 393 of file adb.c.
Referenced by dns_adb_createfind2().
#define FIND_HINTOK | ( | fn | ) | (((fn)->options & DNS_ADBFIND_HINTOK) != 0) |
#define FIND_GLUEOK | ( | fn | ) | (((fn)->options & DNS_ADBFIND_GLUEOK) != 0) |
#define FIND_HAS_ADDRS | ( | fn | ) | (!ISC_LIST_EMPTY((fn)->list)) |
#define FIND_RETURNLAME | ( | fn | ) | (((fn)->options & DNS_ADBFIND_RETURNLAME) != 0) |
#define WANT_INET | ( | x | ) | (((x) & DNS_ADBFIND_INET) != 0) |
#define WANT_INET6 | ( | x | ) | (((x) & DNS_ADBFIND_INET6) != 0) |
Definition at line 407 of file adb.c.
Referenced by check_expire_name(), check_expire_namehooks(), and dns_adb_createfind2().
#define GLUE_OK | ( | nf, | |||
o | ) | (!NAME_GLUEOK(nf) || (((o) & DNS_ADBFIND_GLUEOK) != 0)) |
#define HINT_OK | ( | nf, | |||
o | ) | (!NAME_HINTOK(nf) || (((o) & DNS_ADBFIND_HINTOK) != 0)) |
#define GLUEHINT_OK | ( | nf, | |||
o | ) | (GLUE_OK(nf, o) || HINT_OK(nf, o)) |
#define STARTATZONE_MATCHES | ( | nf, | |||
o | ) |
Value:
(((nf)->flags & NAME_STARTATZONE) == \ ((o) & DNS_ADBFIND_STARTATZONE))
Definition at line 417 of file adb.c.
Referenced by find_name_and_lock().
#define ENTER_LEVEL ISC_LOG_DEBUG(50) |
Definition at line 420 of file adb.c.
Referenced by clean_finds_at_name(), dns_adb_findaddrinfo(), and fetch_name().
#define CLEAN_LEVEL ISC_LOG_DEBUG(100) |
#define DEF_LEVEL ISC_LOG_DEBUG(5) |
Definition at line 423 of file adb.c.
Referenced by check_expire_entry(), check_expire_namehooks(), clean_finds_at_name(), dns_adb_cancelfind(), dns_adb_create(), dns_adb_createfind2(), dns_adb_destroyfind(), fetch_callback(), and kill_name().
#define NCACHE_LEVEL ISC_LOG_DEBUG(20) |
Definition at line 424 of file adb.c.
Referenced by dbfind_name(), fetch_callback(), and import_rdataset().
#define NCACHE_RESULT | ( | r | ) |
Value:
((r) == DNS_R_NCACHENXDOMAIN || \ (r) == DNS_R_NCACHENXRRSET)
Definition at line 426 of file adb.c.
Referenced by dns_adb_createfind2(), and fetch_callback().
#define AUTH_NX | ( | r | ) |
Value:
((r) == DNS_R_NXDOMAIN || \ (r) == DNS_R_NXRRSET)
Definition at line 428 of file adb.c.
Referenced by dns_adb_createfind2().
#define NXDOMAIN_RESULT | ( | r | ) |
Value:
((r) == DNS_R_NXDOMAIN || \ (r) == DNS_R_NCACHENXDOMAIN)
Definition at line 430 of file adb.c.
Referenced by dns_adb_createfind2().
#define NXRRSET_RESULT | ( | r | ) |
Value:
((r) == DNS_R_NCACHENXRRSET || \ (r) == DNS_R_NXRRSET || \ (r) == DNS_R_HINTNXRRSET)
Definition at line 432 of file adb.c.
Referenced by dns_adb_createfind2().
#define FIND_ERR_SUCCESS 0 |
#define FIND_ERR_FAILURE 2 |
#define FIND_ERR_NXDOMAIN 3 |
#define FIND_ERR_NXRRSET 4 |
#define FIND_ERR_UNEXPECTED 5 |
Definition at line 445 of file adb.c.
Referenced by check_expire_namehooks(), dbfind_name(), and new_adbname().
#define FIND_ERR_NOTFOUND 6 |
#define ALLOCENTRY | ( | adb, | |||
el | ) |
Value:
do { \ (adb)->el = isc_mem_get((adb)->mctx, \ sizeof(*(adb)->el) * (adb)->nentries); \ if ((adb)->el == NULL) { \ result = ISC_R_NOMEMORY; \ goto fail1; \ }\ } while (0)
Referenced by dns_adb_create().
#define ALLOCNAME | ( | adb, | |||
el | ) |
Value:
do { \ (adb)->el = isc_mem_get((adb)->mctx, \ sizeof(*(adb)->el) * (adb)->nnames); \ if ((adb)->el == NULL) { \ result = ISC_R_NOMEMORY; \ goto fail1; \ }\ } while (0)
Referenced by dns_adb_create().
#define MPINIT | ( | t, | |||
p, | |||||
n | ) |
Value:
do { \ result = isc_mempool_create(mem, sizeof(t), &(p)); \ if (result != ISC_R_SUCCESS) \ goto fail3; \ isc_mempool_setfreemax((p), FREE_ITEMS); \ isc_mempool_setfillcount((p), FILL_COUNT); \ isc_mempool_setname((p), n); \ isc_mempool_associatelock((p), &adb->mplock); \ } while (0)
Referenced by dns_adb_create().
#define EDNSTOS 3U |
Definition at line 4143 of file adb.c.
Referenced by dns_adb_ednsto(), dns_adb_noedns(), and dns_adb_probesize2().
typedef ISC_LIST | ( | dns_adbname_t | ) |
dns adb structure
< Covers irefcnt, erefcnt
< Covers overmem
< dns_adbname_t
< dns_adbnamehook_t
< dns_adblameinfo_t
< dns_adbentry_t
< dns_adbfind_t
< dns_adbaddrinfo_t
< dns_adbfetch_t
Bucketized locks and lists for names.
XXXRTH Have a per-bucket structure that contains all of these?
Bucketized locks and lists for entries.
XXXRTH Have a per-bucket structure that contains all of these?
< shutting down
static dns_adbname_t * new_adbname | ( | dns_adb_t * | adb, | |
dns_name_t * | dnsname | |||
) | [inline, static] |
Definition at line 1652 of file adb.c.
References dns_adbname::adb, dns_adbname::chains, DNS_ADB_INVALIDBUCKET, DNS_ADBNAME_MAGIC, dns_adbstats_namescnt, dns_name_dup(), dns_name_init(), dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_a, dns_adbname::fetch_aaaa, dns_adbname::fetch_err, FIND_ERR_UNEXPECTED, dns_adbname::finds, dns_adbname::flags, inc_adb_irefcnt(), inc_adbstats(), ISC_LINK_INIT, ISC_LIST_INIT, isc_mempool_get, isc_mempool_put, ISC_R_SUCCESS, isc_task_send(), ISC_TRUE, LOCK, dns_adbname::lock_bucket, dns_adbname::magic, dns_adbname::name, dns_adbname::partial_result, dns_adbname::target, UNLOCK, dns_adbname::v4, and dns_adbname::v6.
Referenced by dns_adb_createfind2().
static void free_adbname | ( | dns_adb_t * | adb, | |
dns_adbname_t ** | name | |||
) | [inline, static] |
Definition at line 1700 of file adb.c.
References dns_adbname::adb, dec_adbstats(), DNS_ADB_INVALIDBUCKET, DNS_ADBNAME_VALID, dns_adbstats_namescnt, dns_name_free(), dns_adbname::finds, INSIST, ISC_LINK_LINKED, ISC_LIST_EMPTY, isc_mempool_put, LOCK, dns_adbname::lock_bucket, dns_adbname::magic, dns_adbname::name, NAME_FETCH, NAME_HAS_V4, NAME_HAS_V6, and UNLOCK.
Referenced by kill_name().
static dns_adbnamehook_t * new_adbnamehook | ( | dns_adb_t * | adb, | |
dns_adbentry_t * | entry | |||
) | [inline, static] |
Definition at line 1726 of file adb.c.
References DNS_ADBNAMEHOOK_MAGIC, ISC_LINK_INIT, and isc_mempool_get.
Referenced by import_rdataset().
static void free_adbnamehook | ( | dns_adb_t * | adb, | |
dns_adbnamehook_t ** | namehook | |||
) | [inline, static] |
Definition at line 1741 of file adb.c.
References DNS_ADBNAMEHOOK_VALID, INSIST, ISC_LINK_LINKED, and isc_mempool_put.
Referenced by clean_namehooks(), and import_rdataset().
static dns_adblameinfo_t * new_adblameinfo | ( | dns_adb_t * | adb, | |
dns_name_t * | qname, | |||
dns_rdatatype_t | qtype | |||
) | [inline, static] |
Definition at line 1756 of file adb.c.
References DNS_ADBLAMEINFO_MAGIC, dns_name_dup(), dns_name_init(), ISC_LINK_INIT, isc_mempool_get, isc_mempool_put, and ISC_R_SUCCESS.
Referenced by dns_adb_marklame().
static void free_adblameinfo | ( | dns_adb_t * | adb, | |
dns_adblameinfo_t ** | lameinfo | |||
) | [inline, static] |
Definition at line 1777 of file adb.c.
References DNS_ADBLAMEINFO_VALID, dns_name_free(), INSIST, ISC_LINK_LINKED, and isc_mempool_put.
Referenced by entry_is_lame(), and free_adbentry().
static dns_adbentry_t * new_adbentry | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1794 of file adb.c.
References DNS_ADB_INVALIDBUCKET, DNS_ADBENTRY_MAGIC, dns_adbstats_entriescnt, dns_adbentry::edns, dns_adbentry::expires, dns_adbentry::flags, inc_adb_irefcnt(), inc_adbstats(), ISC_LINK_INIT, ISC_LIST_INIT, isc_mempool_get, isc_random_get(), isc_task_send(), ISC_TRUE, dns_adbentry::lastage, LOCK, dns_adbentry::lock_bucket, dns_adbentry::magic, dns_adbentry::plain, dns_adbentry::plainto, r, dns_adbentry::refcnt, dns_adbentry::sit, dns_adbentry::sitlen, dns_adbentry::srtt, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, dns_adbentry::udpsize, and UNLOCK.
Referenced by dns_adb_findaddrinfo(), and import_rdataset().
static void free_adbentry | ( | dns_adb_t * | adb, | |
dns_adbentry_t ** | entry | |||
) | [inline, static] |
Definition at line 1839 of file adb.c.
References dec_adbstats(), DNS_ADB_INVALIDBUCKET, DNS_ADBENTRY_VALID, dns_adbstats_entriescnt, free_adblameinfo(), INSIST, ISC_LINK_LINKED, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, isc_mempool_put, LOCK, dns_adbentry::lock_bucket, dns_adbentry::magic, dns_adbentry::refcnt, dns_adbentry::sit, dns_adbentry::sitlen, and UNLOCK.
Referenced by check_expire_entry(), dec_entry_refcnt(), link_entry(), and shutdown_entries().
static dns_adbfind_t * new_adbfind | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1871 of file adb.c.
References dns_adbfind::adb, dns_adbfind::adbname, DNS_ADB_INVALIDBUCKET, DNS_ADBFIND_MAGIC, dns_adbfind::event, dns_adbfind::flags, inc_adb_irefcnt(), ISC_EVENT_INIT, ISC_LINK_INIT, ISC_LIST_INIT, isc_mempool_get, isc_mempool_put, isc_mutex_init, ISC_R_SUCCESS, ISC_R_UNEXPECTED, dns_adbfind::list, dns_adbfind::lock, dns_adbfind::magic, dns_adbfind::name_bucket, dns_adbfind::options, dns_adbfind::partial_result, dns_adbfind::result_v4, and dns_adbfind::result_v6.
Referenced by dns_adb_createfind2().
static isc_boolean_t free_adbfind | ( | dns_adb_t * | adb, | |
dns_adbfind_t ** | findp | |||
) | [inline, static] |
Definition at line 1947 of file adb.c.
References dns_adbfind::adbname, dec_adb_irefcnt(), DESTROYLOCK, DNS_ADB_INVALIDBUCKET, DNS_ADBFIND_VALID, find(), FIND_HAS_ADDRS, INSIST, ISC_LINK_LINKED, isc_mempool_put, dns_adbfind::lock, dns_adbfind::magic, and dns_adbfind::name_bucket.
Referenced by dns_adb_createfind2(), and dns_adb_destroyfind().
static dns_adbaddrinfo_t * new_adbaddrinfo | ( | dns_adb_t * | adb, | |
dns_adbentry_t * | entry, | |||
in_port_t | port | |||
) | [inline, static] |
Definition at line 1973 of file adb.c.
References DNS_ADBADDRINFO_MAGIC, dns_adbaddrinfo::dscp, dns_adbaddrinfo::entry, dns_adbentry::flags, dns_adbaddrinfo::flags, ISC_LINK_INIT, isc_mempool_get, isc_sockaddr_setport(), dns_adbaddrinfo::magic, dns_adbentry::sockaddr, dns_adbaddrinfo::sockaddr, dns_adbentry::srtt, and dns_adbaddrinfo::srtt.
Referenced by copy_namehook_lists(), and dns_adb_findaddrinfo().
static dns_adbfetch_t * new_adbfetch | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1913 of file adb.c.
References DNS_ADBFETCH_MAGIC, dns_rdataset_init(), and isc_mempool_get.
Referenced by fetch_name().
static void free_adbfetch | ( | dns_adb_t * | adb, | |
dns_adbfetch_t ** | fetch | |||
) | [inline, static] |
Definition at line 1931 of file adb.c.
References DNS_ADBFETCH_VALID, dns_rdataset_disassociate(), dns_rdataset_isassociated(), INSIST, and isc_mempool_put.
Referenced by fetch_callback(), and fetch_name().
static dns_adbname_t * find_name_and_lock | ( | dns_adb_t * | adb, | |
dns_name_t * | name, | |||
unsigned int | options, | |||
int * | bucketp | |||
) | [inline, static] |
Definition at line 2016 of file adb.c.
References DNS_ADB_INVALIDBUCKET, dns_name_equal(), dns_name_fullhash(), GLUEHINT_OK, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, LOCK, dns_adbname::name, NAME_DEAD, STARTATZONE_MATCHES, and UNLOCK.
Referenced by dns_adb_createfind2().
static dns_adbentry_t * find_entry_and_lock | ( | dns_adb_t * | adb, | |
isc_sockaddr_t * | addr, | |||
int * | bucketp, | |||
isc_stdtime_t | now | |||
) | [inline, static] |
Definition at line 2058 of file adb.c.
References check_expire_entry(), DNS_ADB_INVALIDBUCKET, dns_adbentry::expires, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_PREPEND, ISC_LIST_UNLINK, isc_sockaddr_equal(), isc_sockaddr_hash(), ISC_TRUE, LOCK, dns_adbentry::sockaddr, and UNLOCK.
Referenced by dns_adb_findaddrinfo(), and import_rdataset().
static void dump_adb | ( | dns_adb_t * | adb, | |
FILE * | f, | |||
isc_boolean_t | debug, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 3375 of file adb.c.
References dns_name_countlabels(), dump_entry(), dump_ttl(), dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_err, dns_adbname::flags, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_mempool_getallocated(), LOCK, dns_adbname::name, print_dns_name(), print_fetch_list(), print_find_list(), print_namehook_list(), dns_adbentry::refcnt, dns_adbname::target, UNLOCK, dns_adbname::v4, and dns_adbname::v6.
Referenced by dns_adb_dump(), and dns_adb_flush().
static void print_dns_name | ( | FILE * | f, | |
dns_name_t * | name | |||
) | [static] |
Definition at line 3557 of file adb.c.
References dns_name_format(), DNS_NAME_FORMATSIZE, and INSIST.
Referenced by dump_adb(), and dump_entry().
static void print_namehook_list | ( | FILE * | f, | |
const char * | legend, | |||
dns_adbnamehooklist_t * | list, | |||
isc_boolean_t | debug, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 3567 of file adb.c.
References dump_entry(), ISC_LIST_HEAD, and ISC_LIST_NEXT.
Referenced by dump_adb().
static void print_find_list | ( | FILE * | f, | |
dns_adbname_t * | name | |||
) | [static] |
Definition at line 3597 of file adb.c.
References dns_adb_dumpfind(), find(), dns_adbname::finds, ISC_LIST_HEAD, and ISC_LIST_NEXT.
Referenced by dump_adb().
static void print_fetch_list | ( | FILE * | f, | |
dns_adbname_t * | n | |||
) | [static] |
Definition at line 3589 of file adb.c.
References dns_adbname::fetch_a, dns_adbname::fetch_aaaa, NAME_FETCH_A, NAME_FETCH_AAAA, and print_fetch().
Referenced by dump_adb().
static isc_boolean_t dec_adb_irefcnt | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1556 of file adb.c.
References INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_task_sendanddetach(), ISC_TRUE, LOCK, and UNLOCK.
Referenced by check_expire_entry(), dec_entry_refcnt(), free_adbfind(), grow_entries(), grow_names(), kill_name(), shutdown_entries(), shutdown_names(), and shutdown_stage2().
static void inc_adb_irefcnt | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1584 of file adb.c.
Referenced by dns_adb_shutdown(), new_adbentry(), new_adbfind(), and new_adbname().
static void inc_adb_erefcnt | ( | dns_adb_t * | adb | ) | [inline, static] |
static void inc_entry_refcnt | ( | dns_adb_t * | adb, | |
dns_adbentry_t * | entry, | |||
isc_boolean_t | lock | |||
) | [inline, static] |
Definition at line 1598 of file adb.c.
References LOCK, dns_adbentry::lock_bucket, dns_adbentry::refcnt, and UNLOCK.
Referenced by copy_namehook_lists(), and dns_adb_findaddrinfo().
static isc_boolean_t dec_entry_refcnt | ( | dns_adb_t * | adb, | |
isc_boolean_t | overmem, | |||
dns_adbentry_t * | entry, | |||
isc_boolean_t | lock | |||
) | [inline, static] |
Definition at line 1613 of file adb.c.
References dec_adb_irefcnt(), destroy_entry(), DNS_ADB_INVALIDBUCKET, ENTRY_IS_DEAD, dns_adbentry::expires, dns_adbentry::flags, free_adbentry(), INSIST, ISC_FALSE, ISC_TRUE, LOCK, dns_adbentry::lock_bucket, dns_adbentry::refcnt, unlink_entry(), and UNLOCK.
Referenced by clean_namehooks(), dns_adb_destroyfind(), and dns_adb_freeaddrinfo().
static void violate_locking_hierarchy | ( | isc_mutex_t * | have, | |
isc_mutex_t * | want | |||
) | [inline, static] |
Definition at line 1194 of file adb.c.
References isc_mutex_trylock, ISC_R_SUCCESS, LOCK, and UNLOCK.
Referenced by dns_adb_cancelfind().
static isc_boolean_t clean_namehooks | ( | dns_adb_t * | adb, | |
dns_adbnamehooklist_t * | namehooks | |||
) | [static] |
Definition at line 1309 of file adb.c.
References dec_entry_refcnt(), DNS_ADB_INVALIDBUCKET, DNS_ADBENTRY_VALID, DNS_ADBNAMEHOOK_VALID, free_adbnamehook(), INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_isovermem(), LOCK, dns_adbentry::lock_bucket, overmem(), and UNLOCK.
Referenced by check_expire_namehooks(), and kill_name().
static void clean_target | ( | dns_adb_t * | adb, | |
dns_name_t * | target | |||
) | [static] |
Definition at line 1356 of file adb.c.
References dns_name_countlabels(), dns_name_free(), and dns_name_init().
Referenced by check_expire_namehooks(), dbfind_name(), fetch_callback(), and kill_name().
static void clean_finds_at_name | ( | dns_adbname_t * | name, | |
isc_eventtype_t | evtype, | |||
unsigned int | addrs | |||
) | [static] |
Definition at line 1452 of file adb.c.
References dns_adbfind::adbname, DEF_LEVEL, DNS_ADB_INVALIDBUCKET, DNS_ADBFIND_ADDRESSMASK, DNS_EVENT_ADBMOREADDRESSES, DNS_EVENT_ADBNOMOREADDRESSES, DP(), ENTER_LEVEL, dns_adbfind::event, event_free(), dns_adbname::fetch6_err, dns_adbname::fetch_err, find(), FIND_EVENT_SENT, FIND_EVENTSENT, dns_adbname::finds, dns_adbfind::flags, INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, ISC_LOG_DEBUG, isc_task_sendanddetach(), ISC_TRUE, dns_adbfind::lock, LOCK, dns_adbfind::name_bucket, notify(), dns_adbfind::result_v4, dns_adbfind::result_v6, and UNLOCK.
Referenced by fetch_callback(), and kill_name().
static isc_boolean_t check_expire_namehooks | ( | dns_adbname_t * | name, | |
isc_stdtime_t | now | |||
) | [static] |
Definition at line 1060 of file adb.c.
References dns_adbname::adb, clean_namehooks(), clean_target(), DEF_LEVEL, DNS_ADB_VALID, DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBNAME_VALID, DP(), EXPIRE_OK, dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_err, FIND_ERR_UNEXPECTED, INSIST, ISC_FALSE, ISC_TF, NAME_FETCH_V4, NAME_FETCH_V6, NAME_HAS_V4, NAME_HAS_V6, dns_adbname::partial_result, dns_adbname::target, dns_adbname::v4, and dns_adbname::v6.
Referenced by cleanup_names(), and dns_adb_createfind2().
static isc_boolean_t check_expire_entry | ( | dns_adb_t * | adb, | |
dns_adbentry_t ** | entryp, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2326 of file adb.c.
References dec_adb_irefcnt(), DEF_LEVEL, DNS_ADBENTRY_VALID, DP(), dns_adbentry::expires, free_adbentry(), INSIST, ISC_FALSE, ISC_LINK_LINKED, dns_adbentry::refcnt, and unlink_entry().
Referenced by cleanup_entries(), and find_entry_and_lock().
static void cancel_fetches_at_name | ( | dns_adbname_t * | name | ) | [static] |
Definition at line 1297 of file adb.c.
References dns_resolver_cancelfetch(), dns_adbname::fetch_a, dns_adbname::fetch_aaaa, NAME_FETCH_A, and NAME_FETCH_AAAA.
Referenced by kill_name().
static isc_result_t dbfind_name | ( | dns_adbname_t * | adbname, | |
isc_stdtime_t | now, | |||
dns_rdatatype_t | rdtype | |||
) | [static] |
Definition at line 3608 of file adb.c.
References dns_adbname::adb, clean_target(), DNS_ADB_VALID, DNS_ADBFIND_GLUEOK, DNS_ADBFIND_HINTOK, DNS_ADBNAME_VALID, DNS_DBFIND_GLUEOK, dns_fixedname_init, dns_fixedname_name, DNS_R_ALIAS, DNS_R_CNAME, DNS_R_DNAME, DNS_R_GLUE, DNS_R_HINT, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_NXDOMAIN, DNS_R_NXRRSET, dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_view_find2(), DP(), dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_err, FIND_ERR_NXDOMAIN, FIND_ERR_NXRRSET, FIND_ERR_SUCCESS, FIND_ERR_UNEXPECTED, dns_adbname::flags, import_rdataset(), INSIST, ISC_FALSE, ISC_R_SUCCESS, ISC_TF, ISC_TRUE, dns_adbname::name, NAME_GLUEOK, NAME_HINTOK, NAME_STARTATZONE, NCACHE_LEVEL, set_target(), dns_adbname::target, dns_rdataset::ttl, and ttlclamp().
Referenced by dns_adb_createfind2().
static isc_result_t fetch_name | ( | dns_adbname_t * | adbname, | |
isc_boolean_t | start_at_zone, | |||
unsigned int | depth, | |||
isc_counter_t * | qc, | |||
dns_rdatatype_t | type | |||
) | [static] |
Definition at line 3933 of file adb.c.
References dns_adbname::adb, cleanup(), DNS_ADB_VALID, DNS_ADBNAME_VALID, DNS_FETCHOPT_NOVALIDATE, DNS_FETCHOPT_UNSHARED, dns_fixedname_init, dns_fixedname_name, DNS_R_HINT, dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_resolver_createfetch3(), dns_resstatscounter_gluefetchv4, dns_resstatscounter_gluefetchv6, dns_view_findzonecut2(), DP(), ENTER_LEVEL, dns_adbname::fetch_a, dns_adbname::fetch_aaaa, fetch_callback(), dns_adbname::fetch_err, FIND_ERR_NOTFOUND, fixed, free_adbfetch(), inc_stats(), INSIST, ISC_FALSE, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_TRUE, dns_adbname::name, NAME_FETCH_V4, NAME_FETCH_V6, and new_adbfetch().
Referenced by dns_adb_createfind2().
static void check_exit | ( | dns_adb_t * | adb | ) | [inline, static] |
Definition at line 1535 of file adb.c.
References DNS_EVENT_ADBCONTROL, INSIST, ISC_EVENT_INIT, isc_task_send(), ISC_TRUE, and shutdown_task().
Referenced by dns_adb_destroyfind(), dns_adb_detach(), dns_adb_freeaddrinfo(), fetch_callback(), grow_entries(), grow_names(), and shutdown_stage2().
static void destroy | ( | dns_adb_t * | adb | ) | [static] |
Definition at line 2406 of file adb.c.
References DESTROYLOCK, DESTROYMUTEXBLOCK, isc_mem_put, isc_mem_putanddetach, isc_mempool_destroy(), and isc_task_detach().
static isc_boolean_t shutdown_names | ( | dns_adb_t * | adb | ) | [static] |
Definition at line 1207 of file adb.c.
References dec_adb_irefcnt(), DNS_EVENT_ADBSHUTDOWN, INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_TRUE, kill_name(), LOCK, dns_adbname::name, and UNLOCK.
Referenced by shutdown_stage2().
static isc_boolean_t shutdown_entries | ( | dns_adb_t * | adb | ) | [static] |
Definition at line 1252 of file adb.c.
References dec_adb_irefcnt(), dns_adbentry::expires, free_adbentry(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_TRUE, LOCK, dns_adbentry::refcnt, unlink_entry(), and UNLOCK.
static void link_name | ( | dns_adb_t * | adb, | |
int | bucket, | |||
dns_adbname_t * | name | |||
) | [inline, static] |
Definition at line 1109 of file adb.c.
References DNS_ADB_INVALIDBUCKET, INSIST, ISC_LIST_PREPEND, and dns_adbname::lock_bucket.
Referenced by dns_adb_createfind2().
static isc_boolean_t unlink_name | ( | dns_adb_t * | adb, | |
dns_adbname_t * | name | |||
) | [inline, static] |
Definition at line 1121 of file adb.c.
References DNS_ADB_INVALIDBUCKET, INSIST, ISC_FALSE, ISC_LIST_UNLINK, ISC_TRUE, dns_adbname::lock_bucket, and NAME_DEAD.
Referenced by kill_name().
static void link_entry | ( | dns_adb_t * | adb, | |
int | bucket, | |||
dns_adbentry_t * | entry | |||
) | [inline, static] |
Definition at line 1144 of file adb.c.
References ENTRY_IS_DEAD, dns_adbentry::flags, free_adbentry(), INSIST, ISC_LIST_PREPEND, ISC_LIST_TAIL, ISC_LIST_UNLINK, isc_mem_isovermem(), dns_adbentry::lock_bucket, dns_adbentry::refcnt, and unlink_entry().
Referenced by dns_adb_findaddrinfo(), and import_rdataset().
static isc_boolean_t unlink_entry | ( | dns_adb_t * | adb, | |
dns_adbentry_t * | entry | |||
) | [inline, static] |
Definition at line 1174 of file adb.c.
References DNS_ADB_INVALIDBUCKET, ENTRY_IS_DEAD, dns_adbentry::flags, INSIST, ISC_FALSE, ISC_LIST_UNLINK, ISC_TRUE, and dns_adbentry::lock_bucket.
Referenced by check_expire_entry(), dec_entry_refcnt(), link_entry(), and shutdown_entries().
static isc_boolean_t kill_name | ( | dns_adbname_t ** | n, | |
isc_eventtype_t | ev | |||
) | [static] |
Definition at line 996 of file adb.c.
References dns_adbname::adb, cancel_fetches_at_name(), clean_finds_at_name(), clean_namehooks(), clean_target(), dec_adb_irefcnt(), DEF_LEVEL, DNS_ADB_VALID, DNS_ADBFIND_ADDRESSMASK, DNS_ADBNAME_VALID, DP(), dns_adbname::flags, free_adbname(), INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_UNLINK, ISC_TF, dns_adbname::lock_bucket, dns_adbname::name, NAME_DEAD, NAME_FETCH, NAME_IS_DEAD, dns_adbname::target, unlink_name(), dns_adbname::v4, and dns_adbname::v6.
Referenced by check_expire_name(), check_stale_name(), dns_adb_flushname(), dns_adb_flushnames(), fetch_callback(), and shutdown_names().
static void water | ( | void * | arg, | |
int | mark | |||
) | [static] |
Definition at line 4583 of file adb.c.
References dns_adbname::adb, DNS_ADB_VALID, DP(), ISC_LOG_DEBUG, ISC_MEM_HIWATER, ISC_TF, overmem(), and REQUIRE.
static void dump_entry | ( | FILE * | f, | |
dns_adbentry_t * | entry, | |||
isc_boolean_t | debug, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 3460 of file adb.c.
References dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, dns_adbentry::edns, dns_adbentry::expires, dns_adbentry::flags, ISC_LIST_HEAD, ISC_LIST_NEXT, isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, isc_netaddr_fromsockaddr(), dns_adbentry::plain, dns_adbentry::plainto, print_dns_name(), dns_adbentry::refcnt, dns_adbentry::sit, dns_adbentry::sitlen, dns_adbentry::sockaddr, dns_adbentry::srtt, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, and dns_adbentry::udpsize.
Referenced by dump_adb(), and print_namehook_list().
static void adjustsrtt | ( | dns_adbaddrinfo_t * | addr, | |
unsigned int | rtt, | |||
unsigned int | factor, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 4087 of file adb.c.
References ADB_ENTRY_WINDOW, DNS_ADB_RTTADJAGE, dns_adbaddrinfo::entry, dns_adbentry::expires, dns_adbentry::lastage, dns_adbaddrinfo::srtt, and dns_adbentry::srtt.
Referenced by dns_adb_adjustsrtt(), and dns_adb_agesrtt().
static void shutdown_task | ( | isc_task_t * | task, | |
isc_event_t * | ev | |||
) | [static] |
Definition at line 2215 of file adb.c.
References dns_adbname::adb, destroy(), DNS_ADB_VALID, INSIST, isc_event_free(), LOCK, UNLOCK, and UNUSED.
static void static void DP | ( | int | level, | |
const char * | format, | |||
... | ||||
) | [static] |
Definition at line 475 of file adb.c.
References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_ADB, and isc_log_vwrite().
Referenced by check_expire_entry(), check_expire_namehooks(), clean_finds_at_name(), cleanup_entries(), cleanup_names(), dbfind_name(), dns_adb_cancelfind(), dns_adb_create(), dns_adb_createfind2(), dns_adb_destroyfind(), dns_adb_findaddrinfo(), fetch_callback(), fetch_name(), grow_entries(), grow_names(), import_rdataset(), kill_name(), and water().
static void inc_stats | ( | dns_adb_t * | adb, | |
isc_statscounter_t | counter | |||
) | [inline, static] |
Increment resolver-related statistics counters.
Definition at line 489 of file adb.c.
References isc_stats_increment().
static void set_adbstat | ( | dns_adb_t * | adb, | |
isc_uint64_t | val, | |||
isc_statscounter_t | counter | |||
) | [inline, static] |
Set adb-related statistics counters.
Definition at line 498 of file adb.c.
References isc_stats_set().
Referenced by dns_adb_create(), grow_entries(), and grow_names().
static void dec_adbstats | ( | dns_adb_t * | adb, | |
isc_statscounter_t | counter | |||
) | [inline, static] |
Definition at line 504 of file adb.c.
References isc_stats_decrement().
Referenced by free_adbentry(), and free_adbname().
static void inc_adbstats | ( | dns_adb_t * | adb, | |
isc_statscounter_t | counter | |||
) | [inline, static] |
Definition at line 510 of file adb.c.
References isc_stats_increment().
Referenced by new_adbentry(), and new_adbname().
Definition at line 516 of file adb.c.
References ADB_CACHE_MAXIMUM, and ADB_CACHE_MINIMUM.
Referenced by dbfind_name(), fetch_callback(), and import_rdataset().
static void grow_entries | ( | isc_task_t * | task, | |
isc_event_t * | ev | |||
) | [static] |
Definition at line 542 of file adb.c.
References dns_adbname::adb, check_exit(), cleanup(), dec_adb_irefcnt(), DESTROYMUTEXBLOCK, DNS_ADB_VALID, dns_adbstats_nentries, DP(), INSIST, isc_event_free(), ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_UNLINK, ISC_LOG_INFO, isc_mem_get, isc_mem_put, isc_mutexblock_init(), ISC_R_SUCCESS, isc_sockaddr_hash(), isc_task_beginexclusive(), isc_task_endexclusive(), ISC_TRUE, LOCK, dns_adbentry::lock_bucket, set_adbstat(), dns_adbentry::sockaddr, and UNLOCK.
Referenced by dns_adb_create().
static void grow_names | ( | isc_task_t * | task, | |
isc_event_t * | ev | |||
) | [static] |
Definition at line 699 of file adb.c.
References dns_adbname::adb, check_exit(), cleanup(), dec_adb_irefcnt(), DESTROYMUTEXBLOCK, DNS_ADB_VALID, dns_adbstats_nnames, dns_name_fullhash(), DP(), INSIST, isc_event_free(), ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_UNLINK, ISC_LOG_INFO, isc_mem_get, isc_mem_put, isc_mutexblock_init(), ISC_R_SUCCESS, isc_task_beginexclusive(), isc_task_endexclusive(), ISC_TRUE, LOCK, dns_adbname::lock_bucket, dns_adbname::name, set_adbstat(), and UNLOCK.
Referenced by dns_adb_create().
static isc_result_t import_rdataset | ( | dns_adbname_t * | adbname, | |
dns_rdataset_t * | rdataset, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 857 of file adb.c.
References dns_adbname::adb, ADB_CACHE_MINIMUM, ADB_ENTRY_WINDOW, dns_rdata::data, DNS_ADB_INVALIDBUCKET, DNS_ADB_VALID, DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBNAME_VALID, DNS_RDATA_INIT, dns_rdata_reset(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), dns_trust_additional, dns_trust_glue, dns_trust_ultimate, DP(), dns_adbname::expire_v4, dns_adbname::expire_v6, find_entry_and_lock(), free_adbnamehook(), INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_MIN, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_sockaddr_fromin(), isc_sockaddr_fromin6(), ISC_TRUE, dns_rdata::length, link_entry(), NCACHE_LEVEL, new_adbentry(), new_adbnamehook(), dns_adbname::partial_result, dns_adbentry::refcnt, dns_adbentry::sockaddr, dns_rdataset::trust, dns_rdataset::ttl, ttlclamp(), dns_rdataset::type, UNLOCK, dns_adbname::v4, and dns_adbname::v6.
Referenced by dbfind_name(), and fetch_callback().
static isc_result_t set_target | ( | dns_adb_t * | adb, | |
dns_name_t * | name, | |||
dns_name_t * | fname, | |||
dns_rdataset_t * | rdataset, | |||
dns_name_t * | target | |||
) | [static] |
Definition at line 1364 of file adb.c.
References dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_countlabels(), dns_name_dup(), dns_name_fullcompare(), dns_name_split(), dns_namereln_subdomain, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), INSIST, ISC_R_SUCCESS, REQUIRE, and dns_rdataset::type.
Referenced by dbfind_name(), and fetch_callback().
static void event_free | ( | isc_event_t * | event | ) | [static] |
Definition at line 1435 of file adb.c.
References DNS_ADBFIND_VALID, find(), FIND_EVENT_FREED, dns_adbfind::flags, INSIST, dns_adbfind::lock, LOCK, and UNLOCK.
Referenced by clean_finds_at_name(), and dns_adb_cancelfind().
static void free_adbaddrinfo | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t ** | ainfo | |||
) | [inline, static] |
Definition at line 1993 of file adb.c.
References DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, INSIST, ISC_LINK_LINKED, isc_mempool_put, and dns_adbaddrinfo::magic.
Referenced by dns_adb_destroyfind(), and dns_adb_freeaddrinfo().
static isc_boolean_t entry_is_lame | ( | dns_adb_t * | adb, | |
dns_adbentry_t * | entry, | |||
dns_name_t * | qname, | |||
dns_rdatatype_t | qtype, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2097 of file adb.c.
References dns_name_equal(), free_adblameinfo(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, and ISC_TRUE.
Referenced by copy_namehook_lists().
static void copy_namehook_lists | ( | dns_adb_t * | adb, | |
dns_adbfind_t * | find, | |||
dns_name_t * | qname, | |||
dns_rdatatype_t | qtype, | |||
dns_adbname_t * | name, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2136 of file adb.c.
References DNS_ADB_INVALIDBUCKET, DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBFIND_LAMEPRUNED, entry_is_lame(), FIND_RETURNLAME, inc_entry_refcnt(), INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, dns_adbfind::list, LOCK, dns_adbentry::lock_bucket, new_adbaddrinfo(), dns_adbfind::options, dns_adbfind::partial_result, dns_adbfind::port, UNLOCK, dns_adbname::v4, and dns_adbname::v6.
Referenced by dns_adb_createfind2().
static isc_boolean_t check_expire_name | ( | dns_adbname_t ** | namep, | |
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2236 of file adb.c.
References DNS_ADBNAME_VALID, DNS_EVENT_ADBEXPIRED, EXPIRE_OK, dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, INSIST, ISC_FALSE, kill_name(), dns_adbname::name, NAME_FETCH, NAME_HAS_V4, and NAME_HAS_V6.
Referenced by check_stale_name(), and cleanup_names().
static void check_stale_name | ( | dns_adb_t * | adb, | |
int | bucket, | |||
isc_stdtime_t | now | |||
) | [static] |
Examine the tail entry of the LRU list to see if it expires or is stale (unused for some period); if so, the name entry will be freed. If the ADB is in the overmem condition, the tail and the next to tail entries will be unconditionally removed (unless they have an outstanding fetch). We don't care about a race on 'overmem' at the risk of causing some collateral damage or a small delay in starting cleanup, so we don't bother to lock ADB (if it's not locked).
Name bucket must be locked; adb may be locked; no other locks held.
Definition at line 2279 of file adb.c.
References ADB_STALE_MARGIN, check_expire_name(), DNS_ADB_INVALIDBUCKET, DNS_EVENT_ADBCANCELED, INSIST, ISC_FALSE, ISC_LIST_PREV, ISC_LIST_TAIL, isc_mem_isovermem(), kill_name(), dns_adbname::last_used, NAME_DEAD, NAME_FETCH, overmem(), and RUNTIME_CHECK.
Referenced by dns_adb_createfind2().
static isc_boolean_t cleanup_names | ( | dns_adb_t * | adb, | |
int | bucket, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2357 of file adb.c.
References check_expire_name(), check_expire_namehooks(), CLEAN_LEVEL, DP(), INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, LOCK, dns_adbname::name, and UNLOCK.
Referenced by dns_adb_dump(), and dns_adb_flush().
static isc_boolean_t cleanup_entries | ( | dns_adb_t * | adb, | |
int | bucket, | |||
isc_stdtime_t | now | |||
) | [static] |
Definition at line 2387 of file adb.c.
References check_expire_entry(), CLEAN_LEVEL, DP(), INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, LOCK, and UNLOCK.
Referenced by dns_adb_dump(), and dns_adb_flush().
isc_result_t dns_adb_create | ( | isc_mem_t * | mem, | |
dns_view_t * | view, | |||
isc_timermgr_t * | tmgr, | |||
isc_taskmgr_t * | taskmgr, | |||
dns_adb_t ** | newadb | |||
) |
Create a new ADB.
Notes:
Definition at line 2461 of file adb.c.
References dns_adbname::adb, dns_view::adbstats, ALLOCENTRY, ALLOCNAME, DEF_LEVEL, DESTROYLOCK, DESTROYMUTEXBLOCK, DNS_ADB_MAGIC, dns_adbstats_max, dns_adbstats_nentries, dns_adbstats_nnames, DNS_EVENT_ADBGROWENTRIES, DNS_EVENT_ADBGROWNAMES, DP(), grow_entries(), grow_names(), ISC_EVENT_INIT, ISC_FALSE, ISC_LIST_INIT, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mem_putanddetach, isc_mempool_destroy(), isc_mutex_init, isc_mutexblock_init(), ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_stats_create(), isc_task_create(), isc_task_detach(), isc_task_setname(), isc_taskmgr_excltask(), MPINIT, REQUIRE, set_adbstat(), and UNUSED.
Referenced by dns_view_createresolver().
Definition at line 2744 of file adb.c.
References DNS_ADB_VALID, inc_adb_erefcnt(), and REQUIRE.
Referenced by fctx_create().
void dns_adb_detach | ( | dns_adb_t ** | adb | ) |
Attach to an 'adb' to 'adbp'.
Requires:
Definition at line 2754 of file adb.c.
References dns_adbname::adb, check_exit(), DNS_ADB_VALID, INSIST, ISC_TF, LOCK, REQUIRE, and UNLOCK.
Referenced by destroy(), and fctx_destroy().
void dns_adb_whenshutdown | ( | dns_adb_t * | adb, | |
isc_task_t * | task, | |||
isc_event_t ** | eventp | |||
) |
Delete the ADB. Sets *ADB to NULL. Cancels any outstanding requests.
Requires:
Definition at line 2779 of file adb.c.
References DNS_ADB_VALID, ISC_FALSE, ISC_LIST_APPEND, isc_mempool_getallocated(), isc_task_attach(), isc_task_send(), ISC_TF, LOCK, REQUIRE, and UNLOCK.
Referenced by dns_view_createresolver().
static void shutdown_stage2 | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 2818 of file adb.c.
References dns_adbname::adb, check_exit(), dec_adb_irefcnt(), DNS_ADB_VALID, INSIST, ISC_FALSE, LOCK, shutdown_entries(), shutdown_names(), UNLOCK, and UNUSED.
Referenced by dns_adb_shutdown().
void dns_adb_shutdown | ( | dns_adb_t * | adb | ) |
Send '*eventp' to 'task' when 'adb' has shutdown.
Requires:
Definition at line 2837 of file adb.c.
References DNS_EVENT_ADBCONTROL, inc_adb_irefcnt(), ISC_EVENT_INIT, isc_mem_setwater(), isc_task_send(), ISC_TRUE, LOCK, shutdown_stage2(), UNLOCK, and water().
Referenced by dns_view_createresolver(), and view_flushanddetach().
isc_result_t dns_adb_createfind | ( | dns_adb_t * | adb, | |
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_name_t * | name, | |||
dns_name_t * | qname, | |||
dns_rdatatype_t | qtype, | |||
unsigned int | options, | |||
isc_stdtime_t | now, | |||
dns_name_t * | target, | |||
in_port_t | port, | |||
dns_adbfind_t ** | findp | |||
) |
Definition at line 2865 of file adb.c.
References dns_adb_createfind2().
Referenced by notify_find_address(), and restart_find().
isc_result_t dns_adb_createfind2 | ( | dns_adb_t * | adb, | |
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_name_t * | name, | |||
dns_name_t * | qname, | |||
dns_rdatatype_t | qtype, | |||
unsigned int | options, | |||
isc_stdtime_t | now, | |||
dns_name_t * | target, | |||
in_port_t | port, | |||
unsigned int | depth, | |||
isc_counter_t * | qc, | |||
dns_adbfind_t ** | find | |||
) |
Main interface for clients. The adb will look up the name given in "name" and will build up a list of found addresses, and perhaps start internal fetches to resolve names that are unknown currently.
If other addresses resolve after this call completes, an event will be sent to the <task, taskaction, arg> with the sender of that event set to a pointer to the dns_adbfind_t returned by this function.
If no events will be generated, the *find->result_v4 and/or result_v6 members may be examined for address lookup status. The usual ISC_R_SUCCESS, ISC_R_FAILURE, DNS_R_NXDOMAIN, and DNS_R_NXRRSET are returned, along with ISC_R_NOTFOUND meaning the ADB has not _yet_ found the values. In this latter case, retrying may produce more addresses.
If events will be returned, the result_v[46] members are only valid when that event is actually returned.
The list of addresses returned is unordered. The caller must impose any ordering required. The list will not contain "known bad" addresses, however. For instance, it will not return hosts that are known to be lame for the zone in question.
The caller cannot (directly) modify the contents of the address list's fields other than the "link" field. All values can be read at any time, however.
The "now" parameter is used only for determining which entries that have a specific time to live or expire time should be removed from the running database. If specified as zero, the current time will be retrieved and used.
If 'target' is not NULL and 'name' is an alias (i.e. the name is CNAME'd or DNAME'd to another name), then 'target' will be updated with the domain name that 'name' is aliased to.
All addresses returned will have the sockaddr's port set to 'port.' The caller may change them directly in the dns_adbaddrinfo_t since they are copies of the internal address only.
XXXMLG Document options, especially the flags which control how events are sent.
Requires:
Notes:
Definition at line 2877 of file adb.c.
References dns_adbfind::adbname, AUTH_NX, check_expire_namehooks(), check_stale_name(), copy_namehook_lists(), dbfind_name(), DEF_LEVEL, DNS_ADB_INVALIDBUCKET, DNS_ADB_VALID, DNS_ADBFIND_ADDRESSMASK, DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBFIND_WANTEVENT, dns_lctx, dns_name_copy(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_name_hasbuffer(), DNS_R_ALIAS, DP(), dns_adbfind::event, EXPIRE_OK, dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_err, fetch_name(), find(), FIND_AVOIDFETCHES, FIND_EVENT_FREED, FIND_EVENT_SENT, FIND_GLUEOK, FIND_HAS_ADDRS, FIND_HINTOK, find_name_and_lock(), FIND_STARTATZONE, FIND_WANTEMPTYEVENT, FIND_WANTEVENT, dns_adbname::finds, dns_adbname::flags, dns_adbfind::flags, free_adbfind(), INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_PREPEND, ISC_LIST_UNLINK, isc_log_wouldlog(), ISC_R_NOMEMORY, ISC_R_SHUTTINGDOWN, ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_stdtime_get(), isc_task_attach(), ISC_TRUE, dns_adbname::last_used, link_name(), dns_adbfind::name_bucket, NAME_FETCH_V4, NAME_FETCH_V6, NAME_GLUE_OK, NAME_HAS_V4, NAME_HAS_V6, NAME_HINT_OK, NAME_STARTATZONE, namebuf, NCACHE_RESULT, new_adbfind(), new_adbname(), NXDOMAIN_RESULT, NXRRSET_RESULT, dns_adbfind::options, dns_adbname::partial_result, dns_adbfind::partial_result, dns_adbfind::port, POST, dns_adbfind::query_pending, REQUIRE, dns_adbfind::result_v4, dns_adbfind::result_v6, RUNTIME_CHECK, dns_adbname::target, UNLOCK, dns_adbname::v6, WANT_INET, and WANT_INET6.
Referenced by dns_adb_createfind(), and findname().
void dns_adb_destroyfind | ( | dns_adbfind_t ** | find | ) |
Destroys the find reference.
Note:
Definition at line 3225 of file adb.c.
References dns_adbfind::adb, dns_adbname::adb, check_exit(), dec_entry_refcnt(), DEF_LEVEL, DNS_ADB_INVALIDBUCKET, DNS_ADB_VALID, DNS_ADBENTRY_VALID, DNS_ADBFIND_VALID, DP(), dns_adbaddrinfo::entry, find(), FIND_EVENTFREED, free_adbaddrinfo(), free_adbfind(), INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_isovermem(), ISC_TRUE, dns_adbfind::list, dns_adbfind::lock, LOCK, dns_adbfind::name_bucket, overmem(), REQUIRE, RUNTIME_CHECK, and UNLOCK.
Referenced by cleanup_gabn(), fctx_cleanupaltfinds(), fctx_cleanupfinds(), fctx_finddone(), findname(), generate_reply(), notify_destroy(), process_adb_event(), process_gabn_finddone(), and restart_find().
void dns_adb_cancelfind | ( | dns_adbfind_t * | find | ) |
Cancels the find, and sends the event off to the caller.
It is an error to call dns_adb_cancelfind() on a find where no event is wanted, or will ever be sent.
Note:
Definition at line 3283 of file adb.c.
References dns_adbfind::adb, dns_adbname::adb, dns_adbfind::adbname, cleanup(), DEF_LEVEL, DNS_ADB_INVALIDBUCKET, DNS_ADB_VALID, DNS_EVENT_ADBCANCELED, DP(), dns_adbfind::event, event_free(), FIND_EVENTFREED, FIND_EVENTSENT, FIND_WANTEVENT, dns_adbname::finds, ISC_LIST_UNLINK, ISC_R_CANCELED, isc_task_sendanddetach(), dns_adbfind::lock, LOCK, dns_adbfind::name_bucket, POST, REQUIRE, dns_adbfind::result_v4, dns_adbfind::result_v6, UNLOCK, and violate_locking_hierarchy().
Referenced by lwdclientmgr_shutdown_callback(), and notify_cancel().
void dns_adb_dump | ( | dns_adb_t * | adb, | |
FILE * | f | |||
) |
This function is only used for debugging. It will dump as much of the state of the running system as possible.
Requires:
Definition at line 3341 of file adb.c.
References cleanup_entries(), cleanup_names(), DNS_ADB_VALID, dump_adb(), ISC_FALSE, isc_stdtime_get(), LOCK, REQUIRE, RUNTIME_CHECK, and UNLOCK.
Referenced by dns_view_dumpdbtostream(), and dumpdone().
static void dump_ttl | ( | FILE * | f, | |
const char * | legend, | |||
isc_stdtime_t | value, | |||
isc_stdtime_t | now | |||
) | [static] |
void dns_adb_dumpfind | ( | dns_adbfind_t * | find, | |
FILE * | f | |||
) |
This function is only used for debugging. Dump the data associated with a find.
Requires:
Definition at line 3505 of file adb.c.
References dns_adbfind::adbname, AF_INET6, dns_adbaddrinfo::entry, dns_adbfind::event, dns_adbaddrinfo::flags, dns_adbfind::flags, ISC_LIST_HEAD, ISC_LIST_NEXT, dns_adbfind::list, dns_adbfind::lock, LOCK, dns_adbfind::name_bucket, dns_adbfind::options, dns_adbfind::partial_result, dns_adbfind::query_pending, isc_sockaddr::sa, isc_sockaddr::sin, isc_sockaddr::sin6, sockaddr_in6::sin6_addr, dns_adbaddrinfo::sockaddr, dns_adbaddrinfo::srtt, isc_sockaddr::type, and UNLOCK.
Referenced by print_find_list().
static void print_fetch | ( | FILE * | f, | |
dns_adbfetch_t * | ft, | |||
const char * | type | |||
) | [inline, static] |
static void fetch_callback | ( | isc_task_t * | task, | |
isc_event_t * | ev | |||
) | [static] |
Definition at line 3752 of file adb.c.
References dns_adbname::adb, check_exit(), check_result(), clean_finds_at_name(), clean_target(), DEF_LEVEL, DNS_ADB_VALID, DNS_ADBFIND_INET, DNS_ADBFIND_INET6, DNS_ADBNAME_VALID, dns_db_detach(), dns_db_detachnode(), DNS_EVENT_ADBCANCELED, DNS_EVENT_ADBMOREADDRESSES, DNS_EVENT_ADBNOMOREADDRESSES, DNS_EVENT_FETCHDONE, dns_fixedname_name, dns_name_format(), DNS_NAME_FORMATSIZE, DNS_R_CNAME, DNS_R_DNAME, DNS_R_NCACHENXDOMAIN, dns_resolver_destroyfetch(), dns_resstatscounter_gluefetchv4fail, dns_resstatscounter_gluefetchv6fail, dns_result_totext(), DP(), dns_adbname::expire_target, dns_adbname::expire_v4, dns_adbname::expire_v6, dns_adbname::fetch6_err, dns_adbname::fetch_a, dns_adbname::fetch_aaaa, dns_adbname::fetch_err, FIND_ERR_FAILURE, FIND_ERR_NXDOMAIN, FIND_ERR_NXRRSET, FIND_ERR_SUCCESS, free_adbfetch(), import_rdataset(), inc_stats(), INSIST, isc_event_free(), ISC_FALSE, ISC_MIN, ISC_R_SUCCESS, isc_stdtime_get(), kill_name(), LOCK, dns_adbname::lock_bucket, dns_adbname::name, NAME_DEAD, NAME_FETCH_A, NAME_FETCH_AAAA, NCACHE_LEVEL, NCACHE_RESULT, set_target(), dns_adbname::target, ttlclamp(), UNLOCK, and UNUSED.
Referenced by fetch_name().
isc_result_t dns_adb_marklame | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
dns_name_t * | qname, | |||
dns_rdatatype_t | type, | |||
isc_stdtime_t | expire_time | |||
) |
Mark the given address as lame for the <qname,qtype>. expire_time should be set to the time when the entry should expire. That is, if it is to expire 10 minutes in the future, it should set it to (now + 10 * 60).
Requires:
Definition at line 4013 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_name_equal(), dns_adbaddrinfo::entry, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_PREPEND, ISC_R_NOMEMORY, ISC_R_SUCCESS, LOCK, dns_adbentry::lock_bucket, new_adblameinfo(), REQUIRE, and UNLOCK.
Referenced by resquery_response().
void dns_adb_adjustsrtt | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
unsigned int | rtt, | |||
unsigned int | factor | |||
) |
Mix the round trip time into the existing smoothed rtt.
Requires:
Definition at line 4051 of file adb.c.
References adjustsrtt(), DNS_ADB_RTTADJAGE, DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, dns_adbentry::expires, isc_stdtime_get(), LOCK, dns_adbentry::lock_bucket, REQUIRE, and UNLOCK.
Referenced by fctx_cancelquery().
void dns_adb_agesrtt | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
isc_stdtime_t | now | |||
) |
Definition at line 4072 of file adb.c.
References adjustsrtt(), DNS_ADB_RTTADJAGE, DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, REQUIRE, and UNLOCK.
Referenced by fctx_cancelquery().
void dns_adb_changeflags | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
unsigned int | bits, | |||
unsigned int | mask | |||
) |
Definition at line 4113 of file adb.c.
References ADB_ENTRY_WINDOW, DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, ENTRY_IS_DEAD, dns_adbentry::expires, dns_adbaddrinfo::flags, dns_adbentry::flags, isc_stdtime_get(), LOCK, dns_adbentry::lock_bucket, REQUIRE, and UNLOCK.
Referenced by fctx_cancelquery(), resquery_response(), and resquery_send().
isc_boolean_t dns_adb_noedns | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr | |||
) |
Record a failed EDNS UDP response and the advertised EDNS UDP buffer size used.
Requires:
Definition at line 4145 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbentry::edns, EDNSTOS, dns_adbaddrinfo::entry, ISC_FALSE, ISC_TRUE, LOCK, dns_adbentry::lock_bucket, dns_adbentry::plain, dns_adbentry::plainto, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, and UNLOCK.
Referenced by resquery_send().
void dns_adb_plainresponse | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr | |||
) |
Return suggested EDNS UDP size based on observed responses / failures. 'lookups' is the number of times the current lookup has been attempted.
Requires:
Definition at line 4179 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbentry::edns, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, dns_adbentry::plain, dns_adbentry::plainto, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, and UNLOCK.
Referenced by resquery_response().
void dns_adb_timeout | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr | |||
) |
Record a successful plain DNS response.
Requires:
Definition at line 4202 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbentry::edns, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, dns_adbentry::plain, dns_adbentry::plainto, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, and UNLOCK.
Referenced by fctx_cancelquery().
void dns_adb_ednsto | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
unsigned int | size | |||
) |
Record a plain DNS UDP query failed.
Requires:
Definition at line 4235 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbentry::edns, EDNSTOS, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, dns_adbentry::plain, dns_adbentry::plainto, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, and UNLOCK.
Referenced by fctx_cancelquery().
void dns_adb_setudpsize | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
unsigned int | size | |||
) |
Change Flags.
Set the flags as given by:
Definition at line 4280 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbentry::edns, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, dns_adbentry::plain, dns_adbentry::plainto, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::to512, dns_adbentry::udpsize, and UNLOCK.
Referenced by resquery_response().
unsigned int dns_adb_getudpsize | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr | |||
) |
Update seen UDP response size. The largest seen will be returned by dns_adb_getudpsize().
Requires:
Definition at line 4306 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, REQUIRE, dns_adbentry::udpsize, and UNLOCK.
Referenced by resquery_send().
unsigned int dns_adb_probesize | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr | |||
) |
Return the largest seen UDP response size.
Requires:
Definition at line 4322 of file adb.c.
References dns_adb_probesize2().
unsigned int dns_adb_probesize2 | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
int | lookups | |||
) |
Definition at line 4327 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, EDNSTOS, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, REQUIRE, dns_adbentry::to1232, dns_adbentry::to1432, dns_adbentry::to4096, dns_adbentry::udpsize, and UNLOCK.
Referenced by dns_adb_probesize(), and resquery_send().
void dns_adb_setsit | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
const unsigned char * | sit, | |||
size_t | len | |||
) |
Record the Source Identity Token (SIT) associated with this addresss. If sit is NULL or len is zero. The recorded SIT is cleared.
Requires:
Definition at line 4357 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, isc_mem_get, isc_mem_put, LOCK, dns_adbentry::lock_bucket, REQUIRE, dns_adbentry::sit, dns_adbentry::sitlen, and UNLOCK.
Referenced by process_opt().
size_t dns_adb_getsit | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t * | addr, | |||
unsigned char * | sit, | |||
size_t | len | |||
) |
Definition at line 4387 of file adb.c.
References DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, dns_adbaddrinfo::entry, LOCK, dns_adbentry::lock_bucket, REQUIRE, dns_adbentry::sit, dns_adbentry::sitlen, and UNLOCK.
Referenced by resquery_response(), and resquery_send().
isc_result_t dns_adb_findaddrinfo | ( | dns_adb_t * | adb, | |
isc_sockaddr_t * | sa, | |||
dns_adbaddrinfo_t ** | addrp, | |||
isc_stdtime_t | now | |||
) |
Return whether EDNS should be disabled for this server.
Requires:
Definition at line 4410 of file adb.c.
References DNS_ADB_INVALIDBUCKET, DNS_ADB_VALID, DP(), ENTER_LEVEL, find_entry_and_lock(), inc_entry_refcnt(), INSIST, ISC_FALSE, ISC_R_NOMEMORY, ISC_R_SHUTTINGDOWN, ISC_R_SUCCESS, isc_sockaddr_getport(), link_entry(), new_adbaddrinfo(), new_adbentry(), port, REQUIRE, dns_adbentry::sockaddr, UNLOCK, and UNUSED.
Referenced by fctx_getaddresses().
void dns_adb_freeaddrinfo | ( | dns_adb_t * | adb, | |
dns_adbaddrinfo_t ** | addrp | |||
) |
Free a dns_adbaddrinfo_t allocated by dns_adb_findaddrinfo().
Requires:
Definition at line 4463 of file adb.c.
References ADB_ENTRY_WINDOW, check_exit(), dec_entry_refcnt(), DNS_ADB_VALID, DNS_ADBADDRINFO_VALID, DNS_ADBENTRY_VALID, dns_adbaddrinfo::entry, dns_adbentry::expires, free_adbaddrinfo(), ISC_FALSE, isc_mem_isovermem(), isc_stdtime_get(), LOCK, dns_adbentry::lock_bucket, overmem(), REQUIRE, and UNLOCK.
Referenced by fctx_cleanupaltaddrs(), and fctx_cleanupforwaddrs().
void dns_adb_flush | ( | dns_adb_t * | adb | ) |
Flushes all cached data from the adb.
Requires:
Definition at line 4504 of file adb.c.
References cleanup_entries(), cleanup_names(), DNS_ADB_VALID, dump_adb(), INSIST, ISC_FALSE, ISC_TRUE, LOCK, RUNTIME_CHECK, and UNLOCK.
Referenced by dns_view_flushcache2().
void dns_adb_flushname | ( | dns_adb_t * | adb, | |
dns_name_t * | name | |||
) |
Flush 'name' from the adb cache.
Requires:
Definition at line 4527 of file adb.c.
References DNS_ADB_VALID, DNS_EVENT_ADBCANCELED, dns_name_equal(), dns_name_hash(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, kill_name(), LOCK, dns_adbname::name, NAME_DEAD, REQUIRE, RUNTIME_CHECK, and UNLOCK.
Referenced by dns_view_flushnode().
void dns_adb_flushnames | ( | dns_adb_t * | adb, | |
dns_name_t * | name | |||
) |
Flush 'name' and all subdomains from the adb cache.
Requires:
Definition at line 4554 of file adb.c.
References DNS_ADB_VALID, DNS_EVENT_ADBCANCELED, dns_name_issubdomain(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, kill_name(), LOCK, dns_adbname::name, NAME_DEAD, REQUIRE, RUNTIME_CHECK, and UNLOCK.
Referenced by dns_view_flushnode().
void dns_adb_setadbsize | ( | dns_adb_t * | adb, | |
size_t | size | |||
) |
Set a target memory size. If memory usage exceeds the target size entries will be removed before they would have expired on a random basis.
If 'size' is 0 then memory usage is unlimited.
Requires:
Definition at line 4602 of file adb.c.
References DNS_ADB_MINADBSIZE, DNS_ADB_VALID, INSIST, isc_mem_setwater(), and water().
Referenced by configure_view().
const char* errnames[] [static] |
isc_result_t find_err_map[FIND_ERR_MAX] [static] |
Initial value:
const unsigned nbuckets[] [static] |
Initial value:
{ 1021, 1531, 2039, 3067, 4093, 6143, 8191, 12281, 16381, 24571, 32749, 49193, 65521, 98299, 131071, 199603, 262139, 393209, 524287, 768431, 1048573, 1572853, 2097143, 3145721, 4194301, 6291449, 8388593, 12582893, 16777213, 25165813, 33554393, 50331599, 67108859, 100663291, 134217689, 201326557, 268535431, 0 }