[or-cvs] r11851: get r11842 closer to what i want (tor/trunk/src/or)

arma at seul.org arma at seul.org
Wed Oct 10 20:13:52 UTC 2007


Author: arma
Date: 2007-10-10 16:13:52 -0400 (Wed, 10 Oct 2007)
New Revision: 11851

Modified:
   tor/trunk/src/or/dirserv.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/routerlist.c
Log:
get r11842 closer to what i want


Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-10-10 20:06:38 UTC (rev 11850)
+++ tor/trunk/src/or/dirserv.c	2007-10-10 20:13:52 UTC (rev 11851)
@@ -1852,7 +1852,7 @@
         last_addr = ri->addr;
         addr_count = 1;
       } else if (++addr_count > MAX_WITH_SAME_ADDR) {
-        if (!router_digest_is_trusted_dir(ri->cache_info.identity_digest) ||
+        if (!router_addr_is_trusted_dir(ri->addr) ||
             addr_count > MAX_WITH_SAME_ADDR_ON_AUTHORITY)
           digestmap_set(omit_as_sybil, ri->cache_info.identity_digest, ri);
       }

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-10-10 20:06:38 UTC (rev 11850)
+++ tor/trunk/src/or/or.h	2007-10-10 20:13:52 UTC (rev 11851)
@@ -3555,6 +3555,7 @@
                                       authority_type_t type);
 #define router_digest_is_trusted_dir(d) \
   router_digest_is_trusted_dir_type((d), 0)
+int router_addr_is_trusted_dir(uint32_t addr);
 routerlist_t *router_get_routerlist(void);
 void routerlist_reset_warnings(void);
 void routerlist_free(routerlist_t *routerlist);

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-10-10 20:06:38 UTC (rev 11850)
+++ tor/trunk/src/or/routerlist.c	2007-10-10 20:13:52 UTC (rev 11851)
@@ -1783,6 +1783,20 @@
   return 0;
 }
 
+/** Return true iff <b>addr</b> is the address of one of our trusted
+ * directory authorities. */
+int
+router_addr_is_trusted_dir(uint32_t addr)
+{
+  if (!trusted_dir_servers)
+    return 0;
+  SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent,
+    if (ent->addr == addr)
+      return 1;
+    );
+  return 0;
+}
+
 /** If hexdigest is correctly formed, base16_decode it into
  * digest, which must have DIGEST_LEN space in it.
  * Return 0 on success, -1 on failure.



More information about the tor-commits mailing list