]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Treat null address as "unknown", not "rejected" in md policy
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Jul 2011 16:44:51 +0000 (12:44 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Jul 2011 17:04:06 +0000 (13:04 -0400)
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.

changes/shortpolicy_compare [new file with mode: 0644]
src/or/policies.c

diff --git a/changes/shortpolicy_compare b/changes/shortpolicy_compare
new file mode 100644 (file)
index 0000000..3de0948
--- /dev/null
@@ -0,0 +1,4 @@
+  o Major bugfixes:
+    - Fix a bug where comparing an unknown address to a microdescriptor's
+      shortened exit policy would always seem to give a "rejected" result.
+      Bugfix on 0.2.3.1-alpha. Fixes bug 3599.
index 5bd13b5014cd07e6f960ad233a39b296d158113c..93cae768e93f82daaa7b95965ded04b188a64f22 100644 (file)
@@ -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;