tor
master
|
Header file for dns.c. More...
Go to the source code of this file.
Macros | |
#define | MIN_DNS_TTL_AT_EXIT (5*60) |
#define | MAX_DNS_TTL_AT_EXIT (60*60) |
#define | MAX_DNS_ENTRY_AGE (3*60*60) |
#define | DEFAULT_DNS_TTL (30*60) |
Functions | |
int | dns_init (void) |
int | has_dns_init_failed (void) |
void | dns_free_all (void) |
uint32_t | dns_clip_ttl (uint32_t ttl) |
int | dns_reset (void) |
void | connection_dns_remove (edge_connection_t *conn) |
void | assert_connection_edge_not_dns_pending (edge_connection_t *conn) |
void | assert_all_pending_dns_resolves_ok (void) |
MOCK_DECL (void, dns_cancel_pending_resolve,(const char *question)) | |
int | dns_resolve (edge_connection_t *exitconn) |
void | dns_launch_correctness_checks (void) |
int | dns_seems_to_be_broken (void) |
int | dns_seems_to_be_broken_for_ipv6 (void) |
void | dns_reset_correctness_checks (void) |
void | dump_dns_mem_usage (int severity) |
Header file for dns.c.
#define DEFAULT_DNS_TTL (30*60) |
How long do we cache/tell clients to cache DNS records when no TTL is known?
#define MAX_DNS_ENTRY_AGE (3*60*60) |
How long do we keep DNS cache entries before purging them (regardless of their TTL)?
#define MAX_DNS_TTL_AT_EXIT (60*60) |
Highest value for DNS ttl that a server will give.
#define MIN_DNS_TTL_AT_EXIT (5*60) |
Lowest value for DNS ttl that a server will give.
void assert_all_pending_dns_resolves_ok | ( | void | ) |
Log an error and abort if any connection waiting for a DNS resolve is corrupted.
void assert_connection_edge_not_dns_pending | ( | edge_connection_t * | conn | ) |
Log an error and abort if conn is waiting for a DNS resolve.
void connection_dns_remove | ( | edge_connection_t * | conn | ) |
Remove conn from the list of connections waiting for conn->address.
uint32_t dns_clip_ttl | ( | uint32_t | ttl | ) |
Helper: Given a TTL from a DNS response, determine what TTL to give the OP that asked us to resolve it, and how long to cache that record ourselves.
void dns_free_all | ( | void | ) |
Free all storage held in the DNS cache and related structures.
int dns_init | ( | void | ) |
Initialize the DNS subsystem; called by the OR process.
void dns_launch_correctness_checks | ( | void | ) |
If appropriate, start testing whether our DNS servers tend to lie to us.
int dns_reset | ( | void | ) |
Called when DNS-related options change (or may have changed). Returns -1 on failure, 0 on success.
void dns_reset_correctness_checks | ( | void | ) |
Forget what we've previously learned about our DNS servers' correctness.
int dns_resolve | ( | edge_connection_t * | exitconn | ) |
See if we have a cache entry for exitconn->address. If so, if resolve valid, put it into exitconn->addr and return 1. If resolve failed, free exitconn and return -1.
(For EXIT_PURPOSE_RESOLVE connections, send back a RESOLVED error cell on returning -1. For EXIT_PURPOSE_CONNECT connections, there's no need to send back an END cell, since connection_exit_begin_conn will do that for us.)
If we have a cached answer, send the answer back along exitconn's circuit.
Else, if seen before and pending, add conn to the pending list, and return 0.
Else, if not seen before, add conn to pending list, hand to dns farm, and return 0.
Exitconn's on_circuit field must be set, but exitconn should not yet be linked onto the n_streams/resolving_streams list of that circuit. On success, link the connection to n_streams if it's an exit connection. On "pending", link the connection to resolving streams. Otherwise, clear its on_circuit field.
int dns_seems_to_be_broken | ( | void | ) |
Return true iff our DNS servers lie to us too much to be trusted.
int dns_seems_to_be_broken_for_ipv6 | ( | void | ) |
Return true iff we think that IPv6 hostname lookup is broken
void dump_dns_mem_usage | ( | int | severity | ) |
Log memory information about our internal DNS cache at level 'severity'.
int has_dns_init_failed | ( | void | ) |
Return true iff the most recent attempt to initialize the DNS subsystem failed.