[tor-commits] [tor/master] Apply GeoIPExcludeUnknown before checking transitions

nickm at torproject.org nickm at torproject.org
Wed Jul 16 09:23:38 UTC 2014


commit 4da4c4c63f02e9551eaeb8ad9ce5c6f2d1f34ef9
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jul 16 11:14:59 2014 +0200

    Apply GeoIPExcludeUnknown before checking transitions
    
    Otherwise, it always seems as though our Exclude* options have
    changed, since we're comparing modified to unmodified values.
    
    Patch from qwerty1. Fixes bug 9801. Bugfix on 0.2.4.10-alpha, where
    GeoIPExcludeUnknown was introduced.
---
 changes/bug9801 |    5 +++++
 src/or/config.c |   28 ++++++++++++++--------------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/changes/bug9801 b/changes/bug9801
new file mode 100644
index 0000000..6b23b71
--- /dev/null
+++ b/changes/bug9801
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - When GeoIPExcludeUnkonwn is enabled, do not incorrectly decide
+      that our options have changed every time we SIGHUP. Fixes bug
+      9801; bugfix on 0.2.4.10-alpha. Patch from "qwerty1".
+
diff --git a/src/or/config.c b/src/or/config.c
index 10df839..2c3dfc2 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1592,6 +1592,20 @@ options_act(const or_options_t *old_options)
     return -1;
   }
 
+  config_maybe_load_geoip_files_(options, old_options);
+
+  if (geoip_is_loaded(AF_INET) && options->GeoIPExcludeUnknown) {
+    /* ExcludeUnknown is true or "auto" */
+    const int is_auto = options->GeoIPExcludeUnknown == -1;
+    int changed;
+
+    changed  = routerset_add_unknown_ccs(&options->ExcludeNodes, is_auto);
+    changed += routerset_add_unknown_ccs(&options->ExcludeExitNodes, is_auto);
+
+    if (changed)
+      routerset_add_unknown_ccs(&options->ExcludeExitNodesUnion_, is_auto);
+  }
+
   /* Check for transitions that need action. */
   if (old_options) {
     int revise_trackexithosts = 0;
@@ -1687,20 +1701,6 @@ options_act(const or_options_t *old_options)
       connection_or_update_token_buckets(get_connection_array(), options);
   }
 
-  config_maybe_load_geoip_files_(options, old_options);
-
-  if (geoip_is_loaded(AF_INET) && options->GeoIPExcludeUnknown) {
-    /* ExcludeUnknown is true or "auto" */
-    const int is_auto = options->GeoIPExcludeUnknown == -1;
-    int changed;
-
-    changed  = routerset_add_unknown_ccs(&options->ExcludeNodes, is_auto);
-    changed += routerset_add_unknown_ccs(&options->ExcludeExitNodes, is_auto);
-
-    if (changed)
-      routerset_add_unknown_ccs(&options->ExcludeExitNodesUnion_, is_auto);
-  }
-
   if (options->CellStatistics || options->DirReqStatistics ||
       options->EntryStatistics || options->ExitPortStatistics ||
       options->ConnDirectionStatistics ||



More information about the tor-commits mailing list