aboutsummaryrefslogtreecommitdiff
path: root/src/or/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-07-04 04:52:43 +0000
committerNick Mathewson <nickm@torproject.org>2004-07-04 04:52:43 +0000
commit0f3fcfd1db5f224dfaa8871d459149610146d89d (patch)
tree71ea554f5843f304465621ef7d9c1e6068e4cf1c /src/or/dns.c
parent198e5f4c1650400065d8ba0a800f985bf3cbb03b (diff)
downloadtor-0f3fcfd1db5f224dfaa8871d459149610146d89d.tar.gz
tor-0f3fcfd1db5f224dfaa8871d459149610146d89d.zip
When tor_lookup_hostname says 0.0.0.0, treat it as an error.
svn:r2003
Diffstat (limited to 'src/or/dns.c')
-rw-r--r--src/or/dns.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 66e9334b14..851041d779 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -634,6 +634,7 @@ static int dnsworker_main(void *data) {
uint32_t ip;
int *fdarray = data;
int fd;
+ int result;
tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
fd = fdarray[1]; /* this side is ours */
@@ -655,7 +656,11 @@ static int dnsworker_main(void *data) {
}
address[address_len] = 0; /* null terminate it */
- switch (tor_lookup_hostname(address, &ip)) {
+ result = tor_lookup_hostname(address, &ip);
+ /* Make 0.0.0.0 an error, so that we can use "0" to mean "no addr") */
+ if (!ip)
+ result = -1;
+ switch (result) {
case 1:
log_fn(LOG_INFO,"Could not resolve dest addr %s (transient).",address);
answer[0] = DNS_RESOLVE_FAILED_TRANSIENT;