|
@@ -8,32 +8,18 @@ const char dns_c_id[] =
|
|
|
|
|
|
* \file dns.c
|
|
|
* \brief Implements a local cache for DNS results for Tor servers.
|
|
|
- * We provide two asynchronous backend implementations:
|
|
|
- * 1) A farm of 'DNS worker' threads or processes to perform DNS lookups for
|
|
|
- * onion routers and cache the results.
|
|
|
- * 2) A wrapper around Adam Langley's eventdns.c code, to send requests
|
|
|
- * to the nameservers asynchronously.
|
|
|
+ * This is implemetned as a wrapper around Adam Langley's eventdns.c code.
|
|
|
* (We can't just use gethostbyname() and friends because we really need to
|
|
|
* be nonblocking.)
|
|
|
**/
|
|
|
|
|
|
#include "or.h"
|
|
|
#include "../common/ht.h"
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
#include "eventdns.h"
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
#define MAX_ADDRESSLEN 256
|
|
|
|
|
|
-
|
|
|
-#define MAX_DNSWORKERS 100
|
|
|
-
|
|
|
-#define MIN_DNSWORKERS 3
|
|
|
-
|
|
|
-
|
|
|
-#define MAX_IDLE_DNSWORKERS 10
|
|
|
-
|
|
|
|
|
|
* that the resolver is wedged? */
|
|
|
#define RESOLVE_MAX_TIMEOUT 300
|
|
@@ -44,14 +30,6 @@ const char dns_c_id[] =
|
|
|
#define DNS_RESOLVE_FAILED_PERMANENT 2
|
|
|
#define DNS_RESOLVE_SUCCEEDED 3
|
|
|
|
|
|
-#ifndef USE_EVENTDNS
|
|
|
-
|
|
|
-static int num_dnsworkers=0;
|
|
|
-
|
|
|
-static int num_dnsworkers_busy=0;
|
|
|
-
|
|
|
-static time_t last_rotation_time=0;
|
|
|
-#else
|
|
|
|
|
|
static int nameservers_configured = 0;
|
|
|
|
|
@@ -60,7 +38,6 @@ static char *resolv_conf_fname = NULL;
|
|
|
|
|
|
* the nameservers? Used to check whether we need to reconfigure. */
|
|
|
static time_t resolv_conf_mtime = 0;
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
typedef struct pending_connection_t {
|
|
@@ -118,16 +95,9 @@ static void dns_found_answer(const char *address, int is_reverse,
|
|
|
static void send_resolved_cell(edge_connection_t *conn, or_circuit_t *circ,
|
|
|
uint8_t answer_type);
|
|
|
static int launch_resolve(edge_connection_t *exitconn, or_circuit_t *circ);
|
|
|
-#ifndef USE_EVENTDNS
|
|
|
-static void dnsworkers_rotate(void);
|
|
|
-static void dnsworker_main(void *data);
|
|
|
-static int spawn_dnsworker(void);
|
|
|
-static int spawn_enough_dnsworkers(void);
|
|
|
-#else
|
|
|
static void add_wildcarded_test_address(const char *address);
|
|
|
static int configure_nameservers(int force);
|
|
|
static int answer_is_wildcarded(const char *ip);
|
|
|
-#endif
|
|
|
#ifdef DEBUG_DNS_CACHE
|
|
|
static void _assert_cache_ok(void);
|
|
|
#define assert_cache_ok() _assert_cache_ok()
|
|
@@ -168,7 +138,6 @@ init_cache_map(void)
|
|
|
HT_INIT(cache_map, &cache_root);
|
|
|
}
|
|
|
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
|
|
|
static void
|
|
|
evdns_log_cb(int warn, const char *msg)
|
|
@@ -208,19 +177,14 @@ evdns_log_cb(int warn, const char *msg)
|
|
|
}
|
|
|
log(severity, LD_EXIT, "eventdns: %s", msg);
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
int
|
|
|
dns_init(void)
|
|
|
{
|
|
|
init_cache_map();
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
if (server_mode(get_options()))
|
|
|
return configure_nameservers(1);
|
|
|
-#else
|
|
|
- dnsworkers_rotate();
|
|
|
-#endif
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -229,7 +193,6 @@ dns_init(void)
|
|
|
int
|
|
|
dns_reset(void)
|
|
|
{
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
or_options_t *options = get_options();
|
|
|
if (! server_mode(options)) {
|
|
|
evdns_clear_nameservers_and_suspend();
|
|
@@ -241,9 +204,6 @@ dns_reset(void)
|
|
|
if (configure_nameservers(0) < 0)
|
|
|
return -1;
|
|
|
}
|
|
|
-#else
|
|
|
- dnsworkers_rotate();
|
|
|
-#endif
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -338,9 +298,7 @@ dns_free_all(void)
|
|
|
if (cached_resolve_pqueue)
|
|
|
smartlist_free(cached_resolve_pqueue);
|
|
|
cached_resolve_pqueue = NULL;
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
tor_free(resolv_conf_fname);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
|
|
@@ -635,7 +593,6 @@ dns_resolve(edge_connection_t *exitconn, or_circuit_t *oncirc)
|
|
|
if (r == 1)
|
|
|
is_reverse = 1;
|
|
|
|
|
|
-#ifdef USE_EVENTDNS
|
|
|
if (!is_reverse || !is_resolve) {
|
|
|
if (!is_reverse)
|
|
|
log_info(LD_EXIT, "Bad .in-addr.arpa address \"%s\"; sending error.",
|
|
@@ -645,12 +602,6 @@ dns_resolve(edge_connection_t *exitconn, or_circuit_t *oncirc)
|
|
|
"Attempt to connect to a .in-addr.arpa address \"%s\"; "
|
|
|
"sending error.",
|
|
|
escaped_safe_str(exitconn->_base.address));
|
|
|
-#else
|
|
|
- if (1) {
|
|
|
- log_info(LD_PROTOCOL, "Dnsworker code does not support in-addr.arpa "
|
|
|
- "domain, but received a request for \"%s\"; sending error.",
|
|
|
- escaped_safe_str(exitconn->_base.address));
|
|
|
-#endif
|
|
|
|
|
|
if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE)
|
|
|
send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_ERROR);
|
|
@@ -1062,412 +1013,6 @@ dns_found_answer(const char *address, int is_reverse, uint32_t addr,
|
|
|
assert_cache_ok();
|
|
|
}
|
|
|
|
|
|
-#ifndef USE_EVENTDNS
|
|
|
-
|
|
|
- * <b>exitconn</b>-\>address; tell that dns worker to begin resolving.
|
|
|
- */
|
|
|
-static int
|
|
|
-launch_resolve(edge_connection_t *exitconn, or_circuit_t *circ)
|
|
|
-{
|
|
|
- connection_t *dnsconn;
|
|
|
- unsigned char len;
|
|
|
-
|
|
|
- tor_assert(exitconn->_base.state == EXIT_CONN_STATE_RESOLVING);
|
|
|
- assert_connection_ok(TO_CONN(exitconn), 0);
|
|
|
- tor_assert(exitconn->_base.s == -1);
|
|
|
-
|
|
|
-
|
|
|
- if (spawn_enough_dnsworkers() < 0) {
|
|
|
- goto err;
|
|
|
- }
|
|
|
-
|
|
|
- dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER,
|
|
|
- DNSWORKER_STATE_IDLE);
|
|
|
-
|
|
|
- if (!dnsconn) {
|
|
|
- log_warn(LD_EXIT,"no idle dns workers. Failing.");
|
|
|
- if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE)
|
|
|
- send_resolved_cell(exitconn, circ, RESOLVED_TYPE_ERROR_TRANSIENT);
|
|
|
- goto err;
|
|
|
- }
|
|
|
-
|
|
|
- log_debug(LD_EXIT,
|
|
|
- "Connection (fd %d) needs to resolve %s; assigning "
|
|
|
- "to DNSWorker (fd %d)", exitconn->_base.s,
|
|
|
- escaped_safe_str(exitconn->_base.address), dnsconn->s);
|
|
|
-
|
|
|
- tor_free(dnsconn->address);
|
|
|
- dnsconn->address = tor_strdup(exitconn->_base.address);
|
|
|
- dnsconn->state = DNSWORKER_STATE_BUSY;
|
|
|
-
|
|
|
- * see how long it's been since we asked the question, and sometimes
|
|
|
- * we check before the first call to connection_handle_write(). */
|
|
|
- dnsconn->timestamp_lastwritten = time(NULL);
|
|
|
- num_dnsworkers_busy++;
|
|
|
-
|
|
|
- len = strlen(dnsconn->address);
|
|
|
- connection_write_to_buf((char*)&len, 1, dnsconn);
|
|
|
- connection_write_to_buf(dnsconn->address, len, dnsconn);
|
|
|
-
|
|
|
- return 0;
|
|
|
-err:
|
|
|
-
|
|
|
- dns_cancel_pending_resolve(exitconn->_base.address);
|
|
|
- return -1;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * Connection between OR and dnsworker
|
|
|
- */
|
|
|
-
|
|
|
-
|
|
|
-int
|
|
|
-connection_dns_finished_flushing(connection_t *conn)
|
|
|
-{
|
|
|
- tor_assert(conn);
|
|
|
- tor_assert(conn->type == CONN_TYPE_DNSWORKER);
|
|
|
- connection_stop_writing(conn);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * when a dnsworker dies unexpectedly. */
|
|
|
-int
|
|
|
-connection_dns_reached_eof(connection_t *conn)
|
|
|
-{
|
|
|
- log_warn(LD_EXIT,"Read eof. DNS worker died unexpectedly.");
|
|
|
- if (conn->state == DNSWORKER_STATE_BUSY) {
|
|
|
-
|
|
|
- * connection_about_to_close_connection(), since conn is still
|
|
|
- * in state BUSY
|
|
|
- */
|
|
|
- num_dnsworkers_busy--;
|
|
|
- }
|
|
|
- num_dnsworkers--;
|
|
|
- connection_mark_for_close(conn);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * if we have a complete answer. If so, call dns_found_answer on the
|
|
|
- * result. If not, wait. Returns 0. */
|
|
|
-int
|
|
|
-connection_dns_process_inbuf(connection_t *conn)
|
|
|
-{
|
|
|
- char success;
|
|
|
- uint32_t addr;
|
|
|
- int ttl;
|
|
|
-
|
|
|
- tor_assert(conn);
|
|
|
- tor_assert(conn->type == CONN_TYPE_DNSWORKER);
|
|
|
-
|
|
|
- if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
|
|
|
- log_warn(LD_BUG,
|
|
|
- "read data (%d bytes) from an idle dns worker (fd %d, "
|
|
|
- "address %s). Please report.", (int)buf_datalen(conn->inbuf),
|
|
|
- conn->s, escaped_safe_str(conn->address));
|
|
|
- tor_fragile_assert();
|
|
|
-
|
|
|
-
|
|
|
- * Keep pulling things off because sometimes we get several
|
|
|
- * answers at once (!). */
|
|
|
- while (buf_datalen(conn->inbuf)) {
|
|
|
- connection_fetch_from_buf(&success,1,conn);
|
|
|
- connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
|
|
|
- log_warn(LD_EXIT,"Discarding idle dns answer (success %d, addr %d.)",
|
|
|
- success, addr);
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
- if (buf_datalen(conn->inbuf) < 5)
|
|
|
- return 0;
|
|
|
- tor_assert(conn->state == DNSWORKER_STATE_BUSY);
|
|
|
- tor_assert(buf_datalen(conn->inbuf) == 5);
|
|
|
-
|
|
|
- connection_fetch_from_buf(&success,1,conn);
|
|
|
- connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
|
|
|
-
|
|
|
- log_debug(LD_EXIT, "DNSWorker (fd %d) returned answer for %s",
|
|
|
- conn->s, escaped_safe_str(conn->address));
|
|
|
-
|
|
|
- tor_assert(success >= DNS_RESOLVE_FAILED_TRANSIENT);
|
|
|
- tor_assert(success <= DNS_RESOLVE_SUCCEEDED);
|
|
|
-
|
|
|
- ttl = (success == DNS_RESOLVE_FAILED_TRANSIENT) ? 0 : MAX_DNS_ENTRY_AGE;
|
|
|
- dns_found_answer(conn->address, 0, ntohl(addr), NULL, success, ttl);
|
|
|
-
|
|
|
- tor_free(conn->address);
|
|
|
- conn->address = tor_strdup("<idle>");
|
|
|
- conn->state = DNSWORKER_STATE_IDLE;
|
|
|
- num_dnsworkers_busy--;
|
|
|
- if (conn->timestamp_created < last_rotation_time) {
|
|
|
- connection_mark_for_close(conn);
|
|
|
- num_dnsworkers--;
|
|
|
- spawn_enough_dnsworkers();
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * and re-opened once they're no longer busy.
|
|
|
- **/
|
|
|
-static void
|
|
|
-dnsworkers_rotate(void)
|
|
|
-{
|
|
|
- connection_t *dnsconn;
|
|
|
- while ((dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER,
|
|
|
- DNSWORKER_STATE_IDLE))) {
|
|
|
- connection_mark_for_close(dnsconn);
|
|
|
- num_dnsworkers--;
|
|
|
- }
|
|
|
- last_rotation_time = time(NULL);
|
|
|
- if (server_mode(get_options()))
|
|
|
- spawn_enough_dnsworkers();
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * execution context. It takes as its argument an fdarray as returned
|
|
|
- * by socketpair(), and communicates via fdarray[1]. The protocol is
|
|
|
- * as follows:
|
|
|
- * - The OR says:
|
|
|
- * - ADDRESSLEN [1 byte]
|
|
|
- * - ADDRESS [ADDRESSLEN bytes]
|
|
|
- * - The DNS worker does the lookup, and replies:
|
|
|
- * - OUTCOME [1 byte]
|
|
|
- * - IP [4 bytes]
|
|
|
- *
|
|
|
- * OUTCOME is one of DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
|
|
|
- * IP is in host order.
|
|
|
- *
|
|
|
- * The dnsworker runs indefinitely, until its connection is closed or an error
|
|
|
- * occurs.
|
|
|
- */
|
|
|
-static void
|
|
|
-dnsworker_main(void *data)
|
|
|
-{
|
|
|
- char address[MAX_ADDRESSLEN+1];
|
|
|
- unsigned char address_len;
|
|
|
- char *log_address;
|
|
|
- char answer[5];
|
|
|
- uint32_t ip;
|
|
|
- int *fdarray = data;
|
|
|
- int fd;
|
|
|
- int result;
|
|
|
- int search = get_options()->ServerDNSSearchDomains;
|
|
|
-
|
|
|
-
|
|
|
- * fdarray[0],fdarray[1]); */
|
|
|
-
|
|
|
- fd = fdarray[1];
|
|
|
-#ifndef TOR_IS_MULTITHREADED
|
|
|
- tor_close_socket(fdarray[0]);
|
|
|
- * parent uses */
|
|
|
- tor_free_all(1);
|
|
|
- handle_signals(0);
|
|
|
-#endif
|
|
|
- tor_free(data);
|
|
|
-
|
|
|
- for (;;) {
|
|
|
- int r;
|
|
|
-
|
|
|
- if ((r = recv(fd, &address_len, 1, 0)) != 1) {
|
|
|
- if (r == 0) {
|
|
|
- log_info(LD_EXIT,"DNS worker exiting because Tor process closed "
|
|
|
- "connection (either pruned idle dnsworker or died).");
|
|
|
- } else {
|
|
|
- log_info(LD_EXIT,"DNS worker exiting because of error on connection "
|
|
|
- "to Tor process.");
|
|
|
- log_info(LD_EXIT,"(Error on %d was %s)", fd,
|
|
|
- tor_socket_strerror(tor_socket_errno(fd)));
|
|
|
- }
|
|
|
- tor_close_socket(fd);
|
|
|
- crypto_thread_cleanup();
|
|
|
- spawn_exit();
|
|
|
- }
|
|
|
-
|
|
|
- if (address_len && read_all(fd, address, address_len, 1) != address_len) {
|
|
|
- log_err(LD_BUG,"read hostname failed. Child exiting.");
|
|
|
- tor_close_socket(fd);
|
|
|
- crypto_thread_cleanup();
|
|
|
- spawn_exit();
|
|
|
- }
|
|
|
-
|
|
|
- if (address[address_len-1] != '.' && !search) {
|
|
|
- address[address_len] = '.';
|
|
|
- address[address_len+1] = '\0';
|
|
|
- } else {
|
|
|
- address[address_len] = '\0';
|
|
|
- }
|
|
|
-
|
|
|
- log_address = esc_for_log(safe_str(address));
|
|
|
- result = tor_lookup_hostname(address, &ip);
|
|
|
-
|
|
|
- if (!ip)
|
|
|
- result = -1;
|
|
|
- switch (result) {
|
|
|
- case 1:
|
|
|
-
|
|
|
- log_info(LD_NET,"Could not resolve dest addr %s (transient)",
|
|
|
- log_address);
|
|
|
- answer[0] = DNS_RESOLVE_FAILED_TRANSIENT;
|
|
|
- break;
|
|
|
- case -1:
|
|
|
- log_info(LD_NET,"Could not resolve dest addr %s (permanent)",
|
|
|
- log_address);
|
|
|
- answer[0] = DNS_RESOLVE_FAILED_PERMANENT;
|
|
|
- break;
|
|
|
- case 0:
|
|
|
- log_info(LD_NET,"Resolved address %s", log_address);
|
|
|
- answer[0] = DNS_RESOLVE_SUCCEEDED;
|
|
|
- break;
|
|
|
- }
|
|
|
- tor_free(log_address);
|
|
|
- set_uint32(answer+1, ip);
|
|
|
- if (write_all(fd, answer, 5, 1) != 5) {
|
|
|
- log_err(LD_NET,"writing answer failed. Child exiting.");
|
|
|
- tor_close_socket(fd);
|
|
|
- crypto_thread_cleanup();
|
|
|
- spawn_exit();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- */
|
|
|
-static int
|
|
|
-spawn_dnsworker(void)
|
|
|
-{
|
|
|
- int *fdarray;
|
|
|
- int fd;
|
|
|
- connection_t *conn;
|
|
|
- int err;
|
|
|
-
|
|
|
- fdarray = tor_malloc(sizeof(int)*2);
|
|
|
- if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
|
|
|
- log_warn(LD_NET, "Couldn't construct socketpair for dns worker: %s",
|
|
|
- tor_socket_strerror(-err));
|
|
|
- tor_free(fdarray);
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- tor_assert(fdarray[0] >= 0);
|
|
|
- tor_assert(fdarray[1] >= 0);
|
|
|
-
|
|
|
-
|
|
|
- (int)fdarray, fdarray[0],fdarray[1]); */
|
|
|
-
|
|
|
- fd = fdarray[0];
|
|
|
- * fdarray */
|
|
|
- spawn_func((void*) dnsworker_main, (void*)fdarray);
|
|
|
- log_debug(LD_EXIT,"just spawned a dns worker.");
|
|
|
-#ifndef TOR_IS_MULTITHREADED
|
|
|
- tor_close_socket(fdarray[1]);
|
|
|
- tor_free(fdarray);
|
|
|
-#endif
|
|
|
-
|
|
|
- conn = connection_new(CONN_TYPE_DNSWORKER);
|
|
|
-
|
|
|
- set_socket_nonblocking(fd);
|
|
|
-
|
|
|
-
|
|
|
- conn->s = fd;
|
|
|
- conn->address = tor_strdup("<unused>");
|
|
|
-
|
|
|
- if (connection_add(conn) < 0) {
|
|
|
- log_warn(LD_NET,"connection_add for dnsworker failed. Giving up.");
|
|
|
- connection_free(conn);
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- conn->state = DNSWORKER_STATE_IDLE;
|
|
|
- connection_start_reading(conn);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * Return 0 if we are happy, return -1 if we tried to spawn more but
|
|
|
- * we couldn't.
|
|
|
- */
|
|
|
-static int
|
|
|
-spawn_enough_dnsworkers(void)
|
|
|
-{
|
|
|
- int num_dnsworkers_needed;
|
|
|
- * but no less than min and no more than max */
|
|
|
- connection_t *dnsconn;
|
|
|
-
|
|
|
-
|
|
|
- * requests until the old ones finish or time out: otherwise, if the
|
|
|
- * connection requests come fast enough, we never get any DNS done. -NM
|
|
|
- *
|
|
|
- * XXX But if we queue them, then the adversary can pile even more
|
|
|
- * queries onto us, blocking legitimate requests for even longer. Maybe
|
|
|
- * we should compromise and only kill if it's been at it for more than,
|
|
|
- * e.g., 2 seconds. -RD
|
|
|
- */
|
|
|
- if (num_dnsworkers_busy == MAX_DNSWORKERS) {
|
|
|
-
|
|
|
- * So find the oldest busy worker and kill it.
|
|
|
- */
|
|
|
- dnsconn = connection_get_by_type_state_lastwritten(CONN_TYPE_DNSWORKER,
|
|
|
- DNSWORKER_STATE_BUSY);
|
|
|
- tor_assert(dnsconn);
|
|
|
-
|
|
|
- log_warn(LD_EXIT, "%d DNS workers are spawned; all are busy. Killing one.",
|
|
|
- MAX_DNSWORKERS);
|
|
|
-
|
|
|
- connection_mark_for_close(dnsconn);
|
|
|
- num_dnsworkers_busy--;
|
|
|
- num_dnsworkers--;
|
|
|
- }
|
|
|
-
|
|
|
- if (num_dnsworkers_busy >= MIN_DNSWORKERS)
|
|
|
- num_dnsworkers_needed = num_dnsworkers_busy+1;
|
|
|
- else
|
|
|
- num_dnsworkers_needed = MIN_DNSWORKERS;
|
|
|
-
|
|
|
- while (num_dnsworkers < num_dnsworkers_needed) {
|
|
|
- if (spawn_dnsworker() < 0) {
|
|
|
- log_warn(LD_EXIT,"DNS worker spawn failed. Will try again later.");
|
|
|
- return -1;
|
|
|
- }
|
|
|
- num_dnsworkers++;
|
|
|
- }
|
|
|
-
|
|
|
- while (num_dnsworkers > num_dnsworkers_busy+MAX_IDLE_DNSWORKERS) {
|
|
|
-
|
|
|
-
|
|
|
- log_info(LD_EXIT,"%d of %d dnsworkers are idle. Killing one.",
|
|
|
- num_dnsworkers-num_dnsworkers_busy, num_dnsworkers);
|
|
|
- dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER,
|
|
|
- DNSWORKER_STATE_IDLE);
|
|
|
- tor_assert(dnsconn);
|
|
|
- connection_mark_for_close(dnsconn);
|
|
|
- num_dnsworkers--;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-void
|
|
|
-dns_launch_correctness_checks(void)
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-int
|
|
|
-dns_seems_to_be_broken(void)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-void
|
|
|
-dns_reset_correctness_checks(void)
|
|
|
-{
|
|
|
-}
|
|
|
-#else
|
|
|
-
|
|
|
|
|
|
* a transient failure. */
|
|
|
static int
|
|
@@ -1483,30 +1028,6 @@ evdns_err_is_transient(int err)
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-int
|
|
|
-connection_dns_finished_flushing(connection_t *conn)
|
|
|
-{
|
|
|
- (void)conn;
|
|
|
- tor_assert(0);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-int
|
|
|
-connection_dns_process_inbuf(connection_t *conn)
|
|
|
-{
|
|
|
- (void)conn;
|
|
|
- tor_assert(0);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-int
|
|
|
-connection_dns_reached_eof(connection_t *conn)
|
|
|
-{
|
|
|
- (void)conn;
|
|
|
- tor_assert(0);
|
|
|
- return 0;
|
|
|
-}
|
|
|
|
|
|
|
|
|
* has changed since the last time we called this function. On Unix, this
|
|
@@ -1978,7 +1499,6 @@ answer_is_wildcarded(const char *ip)
|
|
|
{
|
|
|
return dns_wildcard_list && smartlist_string_isin(dns_wildcard_list, ip);
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
static void
|