]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make "Nowhere" explicitly listable in torrc.
authorNick Mathewson <nickm@torproject.org>
Tue, 15 Sep 2009 17:41:36 +0000 (13:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 31 Jul 2010 19:00:06 +0000 (15:00 -0400)
We already had the country code ?? indicating an unknown country, so all we
needed to do to make unknown countries excludable was to make the ?? code
discoverable.

changes/nowhereland [new file with mode: 0644]
src/or/geoip.c
src/or/routerlist.c

diff --git a/changes/nowhereland b/changes/nowhereland
new file mode 100644 (file)
index 0000000..5435e96
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor features:
+    - Add support for the country code "{??}" in torrc options like
+      ExcludeNodes, to indicate all routers of unknown country.  Fixes bug
+      1094.
+
+
index eae927522a50f9b4f3995722cc3b8f6d8e3091a9..6bb76ae4da2a83af18c50239660a746471507d0d 100644 (file)
@@ -200,6 +200,7 @@ geoip_load_file(const char *filename, or_options_t *options)
             sizeof(geoip_unresolved->countrycode));
     smartlist_add(geoip_countries, geoip_unresolved);
     country_idxplus1_by_lc_code = strmap_new();
+    strmap_set_lc(country_idxplus1_by_lc_code, "??", (void*)(1));
   }
   if (geoip_entries) {
     SMARTLIST_FOREACH(geoip_entries, geoip_entry_t *, e, tor_free(e));
index 5f98abe01b6d42f6e9466cd7671ffc67a9ccd4eb..7be98bd1a5cb08c79cb446297235731ae1dd640c 100644 (file)
@@ -5335,6 +5335,10 @@ routerset_contains(const routerset_t *set, const tor_addr_t *addr,
     if (country < 0 && addr)
       country = geoip_get_country_by_ip(tor_addr_to_ipv4h(addr));
 
+    /* XXXX can we safely move this into geoip_get_country_by_ip? */
+    if (country < 0)
+      country = 0;
+
     if (country >= 0 && country < set->n_countries &&
         bitarray_is_set(set->countries, country))
       return 2;