tor  master
Macros | Functions
dns.h File Reference

Header file for dns.c. More...

This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

Header file for dns.c.

Macro Definition Documentation

◆ DEFAULT_DNS_TTL

#define DEFAULT_DNS_TTL   (30*60)

How long do we cache/tell clients to cache DNS records when no TTL is known?

◆ MAX_DNS_ENTRY_AGE

#define MAX_DNS_ENTRY_AGE   (3*60*60)

How long do we keep DNS cache entries before purging them (regardless of their TTL)?

◆ MAX_DNS_TTL_AT_EXIT

#define MAX_DNS_TTL_AT_EXIT   (60*60)

Highest value for DNS ttl that a server will give.

◆ MIN_DNS_TTL_AT_EXIT

#define MIN_DNS_TTL_AT_EXIT   (5*60)

Lowest value for DNS ttl that a server will give.

Function Documentation

◆ assert_all_pending_dns_resolves_ok()

void assert_all_pending_dns_resolves_ok ( void  )

Log an error and abort if any connection waiting for a DNS resolve is corrupted.

Here is the call graph for this function:

◆ assert_connection_edge_not_dns_pending()

void assert_connection_edge_not_dns_pending ( edge_connection_t conn)

Log an error and abort if conn is waiting for a DNS resolve.

◆ connection_dns_remove()

void connection_dns_remove ( edge_connection_t conn)

Remove conn from the list of connections waiting for conn->address.

◆ dns_clip_ttl()

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.

Here is the caller graph for this function:

◆ dns_free_all()

void dns_free_all ( void  )

Free all storage held in the DNS cache and related structures.

◆ dns_init()

int dns_init ( void  )

Initialize the DNS subsystem; called by the OR process.

Here is the caller graph for this function:

◆ dns_launch_correctness_checks()

void dns_launch_correctness_checks ( void  )

If appropriate, start testing whether our DNS servers tend to lie to us.

◆ dns_reset()

int dns_reset ( void  )

Called when DNS-related options change (or may have changed). Returns -1 on failure, 0 on success.

◆ dns_reset_correctness_checks()

void dns_reset_correctness_checks ( void  )

Forget what we've previously learned about our DNS servers' correctness.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dns_resolve()

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.

◆ dns_seems_to_be_broken()

int dns_seems_to_be_broken ( void  )

Return true iff our DNS servers lie to us too much to be trusted.

◆ dns_seems_to_be_broken_for_ipv6()

int dns_seems_to_be_broken_for_ipv6 ( void  )

Return true iff we think that IPv6 hostname lookup is broken

◆ dump_dns_mem_usage()

void dump_dns_mem_usage ( int  severity)

Log memory information about our internal DNS cache at level 'severity'.

◆ has_dns_init_failed()

int has_dns_init_failed ( void  )

Return true iff the most recent attempt to initialize the DNS subsystem failed.