aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-07-15 12:44:51 -0400
committerNick Mathewson <nickm@torproject.org>2011-07-15 13:04:06 -0400
commitf40df02f3e26df792b7e364d1b6ea5dab167405c (patch)
tree66e8ea896af15ce33184ca40e786821ba02d585a /src/or
parent3380dc9cc0a8cdaae0dbd3e8b7c11e4ccdab504d (diff)
downloadtor-f40df02f3e26df792b7e364d1b6ea5dab167405c.tar
tor-f40df02f3e26df792b7e364d1b6ea5dab167405c.tar.gz
Treat null address as "unknown", not "rejected" in md policy
Previously, we had an issue where we'd treat an unknown address as 0, which turned into "0.0.0.0", which looked like a rejected address. This meant in practice that as soon as we started doing comparisons of unknown uint32 addresses to short policies, we'd get 'rejected' right away. Because of the circumstances under which this would be called, it would only happen when we had local DNS cached entries and we were looking to launch new circuits.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/policies.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index 5bd13b501..93cae768e 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -1415,8 +1415,10 @@ compare_tor_addr_to_short_policy(const tor_addr_t *addr, uint16_t port,
tor_assert(port != 0);
+ if (addr && tor_addr_is_null(addr))
+ addr = NULL; /* Unspec means 'no address at all,' in this context. */
+
if (addr && (tor_addr_is_internal(addr, 0) ||
- tor_addr_is_null(addr) ||
tor_addr_is_loopback(addr)))
return ADDR_POLICY_REJECTED;