[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14780: Several geoip changes/fixes as requested. (in tor/trunk: . doc doc/spec/proposals src/or)



Author: nickm
Date: 2008-05-28 14:31:57 -0400 (Wed, 28 May 2008)
New Revision: 14780

Modified:
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/doc/spec/proposals/117-ipv6-exits.txt
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/geoip.c
   tor/trunk/src/or/router.c
Log:
Several geoip changes/fixes as requested.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/ChangeLog	2008-05-28 18:31:57 UTC (rev 14780)
@@ -100,6 +100,8 @@
       before too long.
     - Add a "PURPOSE=" argument to "STREAM NEW" events, as suggested by
       Robert Hogan. Fixes the first part of bug 681.
+    - Make bridge authorities never serve extrainfo docs.
+    - Allow comments in geoip file.
 
   o Minor features (security):
     - Reject requests for reverse-dns lookup of names in a private

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/doc/TODO	2008-05-28 18:31:57 UTC (rev 14780)
@@ -44,7 +44,7 @@
       - Figure out (or give up on) how to run Tor Browser and ordinary
         Firefox side-by-side.
 N   - Write a script to correctly total bandwidth-history observations
-N+P - Make sure RPMs can build correctly with geoip file
+    o Make sure RPMs can build correctly with geoip file
 N+P - Make sure other packages build correctly with geoip file
 N   - Write a paragraph or two for Paul's research project describing what
       we plan to help him research. Roger will then secretly retitle
@@ -280,16 +280,19 @@
 =======================================================================
 
 Bugs/issues for Tor 0.2.0.x:
-N - Rip out the MIN_IPS_* stuff for geoip reporting.
-N - bridge authorities should not serve extrainfo docs.
-N - We still never call geoip_remove_old_clients(). Should we call it,
+  o Rip out the MIN_IPS_* stuff for geoip reporting.
+  o bridge authorities should not serve extrainfo docs.
+  o We still never call geoip_remove_old_clients(). Should we call it,
     with a cutoff of a day ago, each time we're about to build a
     descriptor/extrainfo pair?
-N - teach geoip_parse_entry() to skip over lines that start with #, so we
+    o Actually, let's do it every 48 hours, so we don't wind up saying
+      too much.
+  o teach geoip_parse_entry() to skip over lines that start with #, so we
     can put a little note at the top of the geoip file to say what it is.
 N d we should have an off-by-default way for relays to dump geoip data to
-    a file in their data directory, for measurement purposes.  it should be
-    listed along with their probability-of-selection
+    a file in their data directory, for measurement purposes.
+    - Basic implementation
+    - Include probability-of-selection
 R d let bridges set relaybandwidthrate as low as 5kb
 R - bug: if we launch using bridges, and then stop using bridges, we
     still have our bridges in our entryguards section, and may use them.

Modified: tor/trunk/doc/spec/proposals/117-ipv6-exits.txt
===================================================================
--- tor/trunk/doc/spec/proposals/117-ipv6-exits.txt	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/doc/spec/proposals/117-ipv6-exits.txt	2008-05-28 18:31:57 UTC (rev 14780)
@@ -86,6 +86,8 @@
    (RELAY_RESOLVE) should perform and respond with both A and AAAA
    resources.
 
+   [NOTE: In a future version, it may make sense to .]
+
 1.4. Client interaction with IPv6 exit capability
 
 1.4.1. Usability goals

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/src/or/directory.c	2008-05-28 18:31:57 UTC (rev 14780)
@@ -2598,7 +2598,7 @@
   }
 
   if (!strcmpstart(url,"/tor/server/") ||
-      !strcmpstart(url,"/tor/extra/")) {
+      (!options->BridgeAuthoritativeDir && !strcmpstart(url,"/tor/extra/"))) {
     int res;
     const char *msg;
     const char *request_type = NULL;

Modified: tor/trunk/src/or/geoip.c
===================================================================
--- tor/trunk/src/or/geoip.c	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/src/or/geoip.c	2008-05-28 18:31:57 UTC (rev 14780)
@@ -76,6 +76,10 @@
     geoip_entries = smartlist_create();
     country_idxplus1_by_lc_code = strmap_new();
   }
+  while (TOR_ISSPACE(*line))
+    ++line;
+  if (*line == '#')
+    return 0;
   if (sscanf(line,"%u,%u,%2s", &low, &high, b) == 3) {
     geoip_add_entry(low, high, b);
     return 0;
@@ -277,12 +281,12 @@
 }
 
 /** Do not mention any country from which fewer than this number of IPs have
- * connected.  This avoids reporting information that could deanonymize
- * users. */
-#define MIN_IPS_TO_NOTE_COUNTRY 8
+ * connected.  This conceivably avoids reporting information that could
+ * deanonymize users, though analysis is lacking. */
+#define MIN_IPS_TO_NOTE_COUNTRY 0
 /** Do not report any geoip data at all if we have fewer than this number of
  * IPs to report about. */
-#define MIN_IPS_TO_NOTE_ANYTHING 16
+#define MIN_IPS_TO_NOTE_ANYTHING 0
 /** When reporting geoip data about countries, round up to the nearest
  * multiple of this value. */
 #define IP_GRANULARITY 8

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2008-05-28 17:19:19 UTC (rev 14779)
+++ tor/trunk/src/or/router.c	2008-05-28 18:31:57 UTC (rev 14780)
@@ -1823,7 +1823,14 @@
     return -1;
 
   if (options->BridgeRelay && options->BridgeRecordUsageByCountry) {
-    char *geoip_summary = geoip_get_client_history(time(NULL));
+    static time_t last_purged_at = 0;
+    char *geoip_summary;
+    time_t now = time(NULL);
+    if (now > last_purged_at+48*60*60) {
+      geoip_remove_old_clients(now-48*60*60);
+      last_purged_at = now;
+    }
+    geoip_summary = geoip_get_client_history(time(NULL));
     if (geoip_summary) {
       char geoip_start[ISO_TIME_LEN+1];
       format_iso_time(geoip_start, geoip_get_history_start());