diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-01-12 14:00:20 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-01-12 14:00:20 -0500 |
commit | 43e12a79885871cdf18bfe6cc835b2414d21e29d (patch) | |
tree | 8b47403d5a3df0860339649c015f9d42576137ed | |
parent | a2c41aa3e84ba697cc14b4b2345d8e3467cd22ac (diff) | |
parent | efc9a84108903edf1d68b9f0c511538f15fc7f52 (diff) | |
download | tor-43e12a79885871cdf18bfe6cc835b2414d21e29d.tar.gz tor-43e12a79885871cdf18bfe6cc835b2414d21e29d.zip |
Merge remote branch 'public/bug2363' into maint-0.2.2
-rw-r--r-- | changes/bug2363 | 6 | ||||
-rw-r--r-- | src/or/dns.c | 17 |
2 files changed, 18 insertions, 5 deletions
diff --git a/changes/bug2363 b/changes/bug2363 new file mode 100644 index 0000000000..179925f65c --- /dev/null +++ b/changes/bug2363 @@ -0,0 +1,6 @@ + o Minor bugfixes + - Correctly detect failures to create DNS requests when using Libevent + versions before v2. (Before Libevent 2, we used our own evdns + implementation. Its return values for Libevent's evdns_resolve_*() + functions are not consistent with those from Libevent.) Found by + Lodger; fixes bug 2363; bugfix on 0.2.2.6-alpha. diff --git a/src/or/dns.c b/src/or/dns.c index 5c763011ba..dcccd1390d 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -54,12 +54,19 @@ struct evdns_request; evdns_config_windows_nameservers() #define evdns_base_set_option_(base, opt, val) \ evdns_set_option((opt),(val),DNS_OPTIONS_ALL) +/* Note: our internal eventdns.c, plus Libevent 1.4, used a 1 return to + * signify failure to launch a resolve. Libevent 2.0 uses a -1 return to + * signify a failure on a resolve, though if we're on Libevent 2.0, we should + * have event2/dns.h and never hit these macros. Regardless, 0 is success. */ #define evdns_base_resolve_ipv4(base, addr, options, cb, ptr) \ - ((evdns_resolve_ipv4(addr, options, cb, ptr)<0) ? NULL : ((void*)1)) -#define evdns_base_resolve_reverse(base, addr, options, cb, ptr) \ - ((evdns_resolve_reverse(addr, options, cb, ptr)<0) ? NULL : ((void*)1)) -#define evdns_base_resolve_reverse_ipv6(base, addr, options, cb, ptr) \ - ((evdns_resolve_reverse_ipv6(addr, options, cb, ptr)<0) ? NULL : ((void*)1)) + ((evdns_resolve_ipv4((addr), (options), (cb), (ptr))!=0) \ + ? NULL : ((void*)1)) +#define evdns_base_resolve_reverse(base, addr, options, cb, ptr) \ + ((evdns_resolve_reverse((addr), (options), (cb), (ptr))!=0) \ + ? NULL : ((void*)1)) +#define evdns_base_resolve_reverse_ipv6(base, addr, options, cb, ptr) \ + ((evdns_resolve_reverse_ipv6((addr), (options), (cb), (ptr))!=0) \ + ? NULL : ((void*)1)) #elif defined(LIBEVENT_VERSION_NUMBER) && LIBEVENT_VERSION_NUMBER < 0x02000303 #define evdns_base_set_option_(base, opt, val) \ |