Skip to content
Snippets Groups Projects
Commit 22c0cd8a authored by Roger Dingledine's avatar Roger Dingledine
Browse files

clean dns.c better

svn:r1737
parent fd0d48e4
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment