mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
i'm guessing nick meant to check the return value of dns_init.
and revise some log severities to match the convention. svn:r8234
This commit is contained in:
parent
8297608217
commit
24ad1e06cf
28
src/or/dns.c
28
src/or/dns.c
@ -1187,6 +1187,8 @@ connection_dns_reached_eof(connection_t *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int nameservers_configured = 0;
|
static int nameservers_configured = 0;
|
||||||
|
|
||||||
|
/* DOCDOC */
|
||||||
static int
|
static int
|
||||||
configure_nameservers(void)
|
configure_nameservers(void)
|
||||||
{
|
{
|
||||||
@ -1207,9 +1209,9 @@ configure_nameservers(void)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (eventdns_count_nameservers() == 0) {
|
if (eventdns_count_nameservers() == 0) {
|
||||||
log_err(LD_EXIT, "Unable to add any configured nameserver. "
|
log_warn(LD_EXIT, "Unable to add any configured nameserver. "
|
||||||
"Either remove the Nameservers line from your configuration, or "
|
"Either remove the Nameservers line from your configuration, "
|
||||||
"put in a nameserver that we can parse.");
|
"or put in a nameserver that we can parse.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1217,9 +1219,9 @@ configure_nameservers(void)
|
|||||||
if (eventdns_config_windows_nameservers())
|
if (eventdns_config_windows_nameservers())
|
||||||
return -1;
|
return -1;
|
||||||
if (eventdns_count_nameservers() == 0) {
|
if (eventdns_count_nameservers() == 0) {
|
||||||
log_err(LD_EXIT, "Unable to find any platform nameservers in "
|
log_warn(LD_EXIT, "Unable to find any platform nameservers in "
|
||||||
"your Windows configuration. Perhaps you should add a "
|
"your Windows configuration. Perhaps you should add a "
|
||||||
"Nameservers line to your torrc?");
|
"Nameservers line to your torrc?");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -1228,9 +1230,9 @@ configure_nameservers(void)
|
|||||||
"/etc/resolv.conf"))
|
"/etc/resolv.conf"))
|
||||||
return -1;
|
return -1;
|
||||||
if (eventdns_count_nameservers() == 0) {
|
if (eventdns_count_nameservers() == 0) {
|
||||||
log_err(LD_EXIT, "Unable to find any platform nameservers in "
|
log_warn(LD_EXIT, "Unable to find any platform nameservers in "
|
||||||
"/etc/resolv.conf. Perhaps you should add a Nameservers line "
|
"/etc/resolv.conf. Perhaps you should add a Nameservers line "
|
||||||
"to your torrc?");
|
"to your torrc?");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1238,6 +1240,8 @@ configure_nameservers(void)
|
|||||||
nameservers_configured = 1;
|
nameservers_configured = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX DOCDOC */
|
||||||
static void
|
static void
|
||||||
eventdns_callback(int result, char type, int count, int ttl, void *addresses,
|
eventdns_callback(int result, char type, int count, int ttl, void *addresses,
|
||||||
void *arg)
|
void *arg)
|
||||||
@ -1272,13 +1276,15 @@ eventdns_callback(int result, char type, int count, int ttl, void *addresses,
|
|||||||
tor_free(string_address);
|
tor_free(string_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX DOCDOC */
|
||||||
static int
|
static int
|
||||||
launch_resolve(edge_connection_t *exitconn)
|
launch_resolve(edge_connection_t *exitconn)
|
||||||
{
|
{
|
||||||
char *addr = tor_strdup(exitconn->_base.address);
|
char *addr = tor_strdup(exitconn->_base.address);
|
||||||
int r;
|
int r;
|
||||||
if (!nameservers_configured)
|
if (!nameservers_configured)
|
||||||
configure_nameservers();
|
if (configure_nameservers() < 0)
|
||||||
|
return -1;
|
||||||
log_info(LD_EXIT, "Launching eventdns request for %s",
|
log_info(LD_EXIT, "Launching eventdns request for %s",
|
||||||
escaped_safe_str(exitconn->_base.address));
|
escaped_safe_str(exitconn->_base.address));
|
||||||
r = eventdns_resolve_ipv4(exitconn->_base.address, DNS_QUERY_NO_SEARCH,
|
r = eventdns_resolve_ipv4(exitconn->_base.address, DNS_QUERY_NO_SEARCH,
|
||||||
@ -1294,7 +1300,7 @@ launch_resolve(edge_connection_t *exitconn)
|
|||||||
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
|
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dns_cancel_pending_resolve(addr);/* also sends end and frees */
|
dns_cancel_pending_resolve(addr); /* also sends end and frees */
|
||||||
tor_free(addr);
|
tor_free(addr);
|
||||||
}
|
}
|
||||||
return r ? -1 : 0;
|
return r ? -1 : 0;
|
||||||
|
@ -1105,7 +1105,11 @@ do_main_loop(void)
|
|||||||
{
|
{
|
||||||
int loop_result;
|
int loop_result;
|
||||||
|
|
||||||
dns_init(); /* initialize dns resolve map, spawn workers if needed */
|
/* initialize dns resolve map, spawn workers if needed */
|
||||||
|
if (dns_init() < 0) {
|
||||||
|
log_err(LD_GENERAL,"Error initializing dns subsystem; exiting");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
handle_signals(1);
|
handle_signals(1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user