mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
clean dns.c better
svn:r1737
This commit is contained in:
+3
-1
@@ -451,6 +451,7 @@ int dnsworker_main(void *data) {
|
||||
char address[MAX_ADDRESSLEN];
|
||||
unsigned char address_len;
|
||||
char answer[5];
|
||||
uint32_t ip;
|
||||
int *fdarray = data;
|
||||
int fd;
|
||||
|
||||
@@ -475,7 +476,7 @@ int dnsworker_main(void *data) {
|
||||
address[address_len] = 0; /* null terminate it */
|
||||
|
||||
/* XXX isn't this non-aligned uint32 going to cause problems? */
|
||||
switch (tor_lookup_hostname(address, (uint32_t*)answer+1)) {
|
||||
switch (tor_lookup_hostname(address, &ip)) {
|
||||
case 1:
|
||||
log_fn(LOG_INFO,"Could not resolve dest addr %s (transient).",address);
|
||||
answer[0] = DNS_RESOLVE_FAILED_TRANSIENT;
|
||||
@@ -489,6 +490,7 @@ int dnsworker_main(void *data) {
|
||||
answer[0] = DNS_RESOLVE_SUCCEEDED;
|
||||
break;
|
||||
}
|
||||
set_uint32(answer+1, ip);
|
||||
if(write_all(fd, answer, 5, 1) != 5) {
|
||||
log_fn(LOG_ERR,"writing answer failed. Child exiting.");
|
||||
spawn_exit();
|
||||
|
||||
+1
-3
@@ -505,9 +505,7 @@ int router_set_routerlist_from_directory(const char *s, crypto_pk_env_t *pkey)
|
||||
static int
|
||||
router_resolve(routerinfo_t *router)
|
||||
{
|
||||
struct hostent *rent;
|
||||
|
||||
if (tor_lookup_hostname(router->address, &router->addr)) {
|
||||
if (tor_lookup_hostname(router->address, &router->addr) != 0) {
|
||||
log_fn(LOG_WARN,"Could not get address for router %s (%s).",
|
||||
router->address, router->nickname);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user