]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Possible fix for broken country settings in ExcludeExitNodes.
authorNick Mathewson <nickm@torproject.org>
Mon, 16 Feb 2009 15:15:06 +0000 (15:15 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 16 Feb 2009 15:15:06 +0000 (15:15 +0000)
It turns out that we weren't updating the _ExcludeExitNodesUnion set's
country numbers when we reloaded (or first loaded!) the IP-to-country
file.  Spotted by Lark.  Bugfix on 0.2.1.6-alpha.

svn:r18575

ChangeLog
src/or/config.c
src/or/geoip.c
src/or/or.h
src/or/routerlist.c

index 293c9a376a4ca68bee689b1c330a954883bc67c5..ffb4a1030e9a26edae197bb53853fd3a26420c15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 Changes in version 0.2.1.13-????? - 2009-02-??
+  o Major bugfixes:
+    - Correctly update the list of countries to exclude as exits when
+      the GeoIP file is loaded or reloaded.  Diagnosed by lark.  Bugfix
+      on 0.2.1.6-alpha.
+
   o Minor bugfixes:
     - Automatically detect MacOSX versions earlier than 10.4.0, and
       disable kqueue from inside Tor when running with these versions.
index cb624fbd63a71879ad3910646b6270b9751d8cd6..6b89eceb5a5d5178889532073d5a665de21e61c5 100644 (file)
@@ -1372,17 +1372,6 @@ options_act(or_options_t *old_options)
 #endif
     geoip_load_file(actual_fname, options);
     tor_free(actual_fname);
-
-    /* XXXX Would iterating through all option_var's routersets be better? */
-    if (options->EntryNodes)
-      routerset_refresh_countries(options->EntryNodes);
-    if (options->ExitNodes)
-      routerset_refresh_countries(options->ExitNodes);
-    if (options->ExcludeNodes)
-      routerset_refresh_countries(options->ExcludeNodes);
-    if (options->ExcludeExitNodes)
-      routerset_refresh_countries(options->ExcludeExitNodes);
-    routerlist_refresh_countries();
   }
   /* Check if we need to parse and add the EntryNodes config option. */
   if (options->EntryNodes &&
index 4c61dd27f76df59276200295f85e2aa394b76462..61f1207e59bb6426ef36ff372854b19789ef19ab 100644 (file)
@@ -206,6 +206,11 @@ geoip_load_file(const char *filename, or_options_t *options)
   fclose(f);
 
   smartlist_sort(geoip_entries, _geoip_compare_entries);
+
+  /* Okay, now we need to maybe change our mind about what is in which
+   * country. */
+  refresh_all_country_info();
+
   return 0;
 }
 
index 7c191eeaf3a482729dc1be75387b1b83527371b6..e55d3242847cf3f4104e6566b7d09c9b5c000666 100644 (file)
@@ -4514,6 +4514,7 @@ int routerset_equal(const routerset_t *old, const routerset_t *new);
 void routerset_free(routerset_t *routerset);
 void routerinfo_set_country(routerinfo_t *ri);
 void routerlist_refresh_countries(void);
+void refresh_all_country_info(void);
 
 int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
                                          const char *id);
index ecbc32393799acdd10f67d049dc52d7a8d4e260b..080603b7e9f400020151379fe7b127b57311352e 100644 (file)
@@ -5020,6 +5020,26 @@ routerset_parse(routerset_t *target, const char *s, const char *description)
   return r;
 }
 
+/** DOCDOC */
+void
+refresh_all_country_info(void)
+{
+  or_options_t *options = get_options();
+
+  if (options->EntryNodes)
+    routerset_refresh_countries(options->EntryNodes);
+  if (options->ExitNodes)
+    routerset_refresh_countries(options->ExitNodes);
+  if (options->ExcludeNodes)
+    routerset_refresh_countries(options->ExcludeNodes);
+  if (options->ExcludeExitNodes)
+    routerset_refresh_countries(options->ExcludeExitNodes);
+  if (options->_ExcludeExitNodesUnion)
+    routerset_refresh_countries(options->_ExcludeExitNodesUnion);
+
+  routerlist_refresh_countries();
+}
+
 /** Add all members of the set <b>source</b> to <b>target</b>. */
 void
 routerset_union(routerset_t *target, const routerset_t *source)