#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/sockaddr.h>
#include <dns/types.h>
#include <dns/view.h>
Go to the source code of this file.
Data Structures | |
struct | dns_adbfind |
Represents a lookup for a single name. More... | |
struct | dns_adbaddrinfo |
The answers to queries come back as a list of these. More... | |
Defines | |
#define | DNS_ADB_H 1 |
#define | DNS_ADBFIND_MAGIC ISC_MAGIC('a','d','b','H') |
#define | DNS_ADBFIND_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC) |
#define | DNS_ADBADDRINFO_MAGIC ISC_MAGIC('a','d','A','I') |
#define | DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC) |
#define | DNS_ADBFIND_INET 0x00000001 |
Return addresses of type INET. | |
#define | DNS_ADBFIND_INET6 0x00000002 |
Return addresses of type INET6. | |
#define | DNS_ADBFIND_ADDRESSMASK 0x00000003 |
#define | DNS_ADBFIND_EMPTYEVENT 0x00000004 |
Only schedule an event if no addresses are known. Must set _WANTEVENT for this to be meaningful. | |
#define | DNS_ADBFIND_WANTEVENT 0x00000008 |
An event is desired. Check this bit in the returned find to see if one will actually be generated. | |
#define | DNS_ADBFIND_AVOIDFETCHES 0x00000010 |
If set, fetches will not be generated unless no addresses are available in any of the address families requested. | |
#define | DNS_ADBFIND_STARTATZONE 0x00000020 |
Fetches will start using the closest zone data or use the root servers. This is useful for reestablishing glue that has expired. | |
#define | DNS_ADBFIND_GLUEOK 0x00000040 |
Glue or hints are ok. These are used when matching names already in the adb, and when dns databases are searched. | |
#define | DNS_ADBFIND_HINTOK 0x00000080 |
Glue or hints are ok. These are used when matching names already in the adb, and when dns databases are searched. | |
#define | DNS_ADBFIND_RETURNLAME 0x00000100 |
Return lame servers in a find, so that all addresses are returned. | |
#define | DNS_ADBFIND_LAMEPRUNED 0x00000200 |
Only schedule an event if no addresses are known. Must set _WANTEVENT for this to be meaningful. | |
#define | DNS_ADB_RTTADJDEFAULT 7 |
default scale | |
#define | DNS_ADB_RTTADJREPLACE 0 |
replace with our rtt | |
#define | DNS_ADB_RTTADJAGE 10 |
age this rtt | |
Typedefs | |
typedef struct dns_adbname | dns_adbname_t |
Functions | |
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. | |
void | dns_adb_attach (dns_adb_t *adb, dns_adb_t **adbp) |
void | dns_adb_detach (dns_adb_t **adb) |
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. | |
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 **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. | |
void | dns_adb_cancelfind (dns_adbfind_t *find) |
Cancels the find, and sends the event off to the caller. | |
void | dns_adb_destroyfind (dns_adbfind_t **find) |
Destroys the find reference. | |
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. | |
void | dns_adb_dumpfind (dns_adbfind_t *find, FILE *f) |
This function is only used for debugging. Dump the data associated with a find. | |
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). | |
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) |
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_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. | |
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. | |
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_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. | |
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_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) |
This module implements an address database (ADB) for mapping a name to an isc_sockaddr_t. It also provides statistical information on how good that address might be.
A client will pass in a dns_name_t, and the ADB will walk through the rdataset looking up addresses associated with the name. If it is found on the internal lists, a structure is filled in with the address information and stats for found addresses.
If the name cannot be found on the internal lists, a new entry will be created for a name if all the information needed can be found in the zone table or cache. This new address will then be returned.
If a request must be made to remote servers to satisfy a name lookup, this module will start fetches to try to complete these addresses. When at least one more completes, an event is sent to the caller. If none of them resolve before the fetch times out, an event indicating this is sent instead.
Records are stored internally until a timer expires. The timer is the smaller of the TTL or signature validity period.
Lameness is stored per <qname,qtype> tuple, and this data hangs off each address field. When an address is marked lame for a given tuple the address will not be returned to a caller.
MP:
Definition in file adb.h.
#define DNS_ADBFIND_MAGIC ISC_MAGIC('a','d','b','H') |
#define DNS_ADBFIND_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBFIND_MAGIC) |
Definition at line 91 of file adb.h.
Referenced by dns_adb_destroyfind(), event_free(), and free_adbfind().
#define DNS_ADBADDRINFO_MAGIC ISC_MAGIC('a','d','A','I') |
#define DNS_ADBADDRINFO_VALID | ( | x | ) | ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC) |
Definition at line 93 of file adb.h.
Referenced by dns_adb_adjustsrtt(), dns_adb_agesrtt(), dns_adb_changeflags(), dns_adb_ednsto(), dns_adb_freeaddrinfo(), dns_adb_getsit(), dns_adb_getudpsize(), dns_adb_marklame(), dns_adb_noedns(), dns_adb_plainresponse(), dns_adb_probesize2(), dns_adb_setsit(), dns_adb_setudpsize(), dns_adb_timeout(), and free_adbaddrinfo().
#define DNS_ADBFIND_INET 0x00000001 |
Return addresses of type INET.
Definition at line 166 of file adb.h.
Referenced by check_expire_namehooks(), copy_namehook_lists(), dns_adb_createfind2(), fctx_getaddresses(), fetch_callback(), generate_reply(), import_rdataset(), notify_find_address(), restart_find(), and setup_addresses().
#define DNS_ADBFIND_INET6 0x00000002 |
Return addresses of type INET6.
Definition at line 168 of file adb.h.
Referenced by check_expire_namehooks(), copy_namehook_lists(), dns_adb_createfind2(), fctx_getaddresses(), fetch_callback(), generate_reply(), import_rdataset(), notify_find_address(), and restart_find().
#define DNS_ADBFIND_ADDRESSMASK 0x00000003 |
Definition at line 169 of file adb.h.
Referenced by clean_finds_at_name(), dns_adb_createfind2(), fctx_getaddresses(), and kill_name().
#define DNS_ADBFIND_EMPTYEVENT 0x00000004 |
Only schedule an event if no addresses are known. Must set _WANTEVENT for this to be meaningful.
Definition at line 174 of file adb.h.
Referenced by fctx_getaddresses().
#define DNS_ADBFIND_WANTEVENT 0x00000008 |
An event is desired. Check this bit in the returned find to see if one will actually be generated.
Definition at line 179 of file adb.h.
Referenced by dns_adb_createfind2(), fctx_getaddresses(), findname(), notify_find_address(), and restart_find().
#define DNS_ADBFIND_AVOIDFETCHES 0x00000010 |
If set, fetches will not be generated unless no addresses are available in any of the address families requested.
Definition at line 184 of file adb.h.
Referenced by fctx_getaddresses().
#define DNS_ADBFIND_STARTATZONE 0x00000020 |
Fetches will start using the closest zone data or use the root servers. This is useful for reestablishing glue that has expired.
Definition at line 189 of file adb.h.
Referenced by findname().
#define DNS_ADBFIND_GLUEOK 0x00000040 |
Glue or hints are ok. These are used when matching names already in the adb, and when dns databases are searched.
Definition at line 194 of file adb.h.
Referenced by dbfind_name(), and findname().
#define DNS_ADBFIND_HINTOK 0x00000080 |
Glue or hints are ok. These are used when matching names already in the adb, and when dns databases are searched.
Definition at line 199 of file adb.h.
Referenced by dbfind_name(), and findname().
#define DNS_ADBFIND_RETURNLAME 0x00000100 |
Return lame servers in a find, so that all addresses are returned.
Definition at line 203 of file adb.h.
Referenced by notify_find_address(), and restart_find().
#define DNS_ADBFIND_LAMEPRUNED 0x00000200 |
Only schedule an event if no addresses are known. Must set _WANTEVENT for this to be meaningful.
Definition at line 208 of file adb.h.
Referenced by copy_namehook_lists(), and findname().
#define DNS_ADB_RTTADJDEFAULT 7 |
#define DNS_ADB_RTTADJREPLACE 0 |
#define DNS_ADB_RTTADJAGE 10 |
age this rtt
Definition at line 531 of file adb.h.
Referenced by adjustsrtt(), dns_adb_adjustsrtt(), and dns_adb_agesrtt().
typedef struct dns_adbname dns_adbname_t |
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().
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 ** | find | |||
) |
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_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_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_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().
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().
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().
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_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().
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().
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_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().
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_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().