[or-cvs] r17791: {tor} Add some early checks to keep ipv6 addresses from failing by (tor/trunk/src/or)
nickm at seul.org
nickm at seul.org
Fri Dec 26 22:51:25 UTC 2008
Author: nickm
Date: 2008-12-26 17:51:25 -0500 (Fri, 26 Dec 2008)
New Revision: 17791
Modified:
tor/trunk/src/or/dns.c
tor/trunk/src/or/router.c
Log:
Add some early checks to keep ipv6 addresses from failing by accident. Now, they fail on purpose, at least till 0.2.2.something.
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2008-12-26 21:26:05 UTC (rev 17790)
+++ tor/trunk/src/or/dns.c 2008-12-26 22:51:25 UTC (rev 17791)
@@ -617,10 +617,16 @@
/* 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)) {
Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c 2008-12-26 21:26:05 UTC (rev 17790)
+++ tor/trunk/src/or/router.c 2008-12-26 22:51:25 UTC (rev 17791)
@@ -1140,6 +1140,10 @@
if (tor_addr_is_null(&conn->_base.addr))
return -1;
+ /* XXXX IPv6 */
+ if (tor_addr_family(&conn->_base.addr) != AF_INET)
+ return -1;
+
return compare_tor_addr_to_addr_policy(&conn->_base.addr, conn->_base.port,
desc_routerinfo->exit_policy) != ADDR_POLICY_ACCEPTED;
}
More information about the tor-commits
mailing list