[or-cvs] r11842: Tweak the implementation of proposal 109 slightly: allow at (in tor/trunk: . src/or)

arma at seul.org arma at seul.org
Wed Oct 10 19:53:08 UTC 2007


Author: arma
Date: 2007-10-10 15:53:08 -0400 (Wed, 10 Oct 2007)
New Revision: 11842

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/dirserv.c
Log:
Tweak the implementation of proposal 109 slightly: allow at most
two Tor servers on the same IP address, except if it's the location
of a directory authority, in which case allow five.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-10 19:33:19 UTC (rev 11841)
+++ tor/trunk/ChangeLog	2007-10-10 19:53:08 UTC (rev 11842)
@@ -30,6 +30,11 @@
       consensus.
     - Caches now download v3 network status documents as needed.
 
+  o Minor features (network statuses):
+    - Tweak the implementation of proposal 109 slightly: allow at most
+      two Tor servers on the same IP address, except if it's the location
+      of a directory authority, in which case allow five.
+
   o Major bugfixes (performance):
     - Fix really bad O(n^2) performance when parsing a long list of routers:
       Instead of searching the entire list for an "extra-info " string which

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-10-10 19:33:19 UTC (rev 11841)
+++ tor/trunk/src/or/dirserv.c	2007-10-10 19:53:08 UTC (rev 11842)
@@ -1840,7 +1840,10 @@
   smartlist_sort(routers_by_ip, _compare_routerinfo_by_ip_and_bw);
   omit_as_sybil = digestmap_new();
 
-#define MAX_WITH_SAME_ADDR 3
+/* Allow at most this number of Tor servers on a single IP address, ... */
+#define MAX_WITH_SAME_ADDR 2
+/* ... unless it's a directory authority, in which case allow more. */
+#define MAX_WITH_SAME_ADDR_ON_AUTHORITY 5
   last_addr = 0;
   addr_count = 0;
   SMARTLIST_FOREACH(routers_by_ip, routerinfo_t *, ri,
@@ -1849,7 +1852,9 @@
         last_addr = ri->addr;
         addr_count = 1;
       } else if (++addr_count > MAX_WITH_SAME_ADDR) {
-        digestmap_set(omit_as_sybil, ri->cache_info.identity_digest, ri);
+        if (!router_digest_is_trusted_dir(ri->cache_info.identity_digest) ||
+            addr_count > MAX_WITH_SAME_ADDR_ON_AUTHORITY)
+          digestmap_set(omit_as_sybil, ri->cache_info.identity_digest, ri);
       }
     });
 



More information about the tor-commits mailing list