diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-26 22:51:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-26 22:51:25 +0000 |
commit | b3b14bf25db02e98ecd10ba42761a62b42bfae9b (patch) | |
tree | e1899443aef87e99b72ec85e0c93611ed6445883 /src/or/dns.c | |
parent | 374c1e979f0206f50dc2afd026289d502ce49e30 (diff) | |
download | tor-b3b14bf25db02e98ecd10ba42761a62b42bfae9b.tar.gz tor-b3b14bf25db02e98ecd10ba42761a62b42bfae9b.zip |
Add some early checks to keep ipv6 addresses from failing by accident. Now, they fail on purpose, at least till 0.2.2.something.
svn:r17791
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index fe77a76d7b..7f60c651f3 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -617,10 +617,16 @@ dns_resolve_impl(edge_connection_t *exitconn, int is_resolve, /* first check if exitconn->_base.address is an IP. If so, we already * know the answer. */ if (tor_addr_from_str(&addr, exitconn->_base.address) >= 0) { - tor_addr_assign(&exitconn->_base.addr, &addr); - exitconn->address_ttl = DEFAULT_DNS_TTL; - return 1; + if (tor_addr_family(&addr) == AF_INET) { + tor_addr_assign(&exitconn->_base.addr, &addr); + exitconn->address_ttl = DEFAULT_DNS_TTL; + return 1; + } else { + /* XXXX IPv6 */ + return -1; + } } + /* If we're a non-exit, don't even do DNS lookups. */ if (!(me = router_get_my_routerinfo()) || policy_is_reject_star(me->exit_policy)) { |