From 4da4c4c63f02e9551eaeb8ad9ce5c6f2d1f34ef9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson <nickm@torproject.org> Date: Wed, 16 Jul 2014 11:14:59 +0200 Subject: [PATCH] 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(-) create mode 100644 changes/bug9801 diff --git a/changes/bug9801 b/changes/bug9801 new file mode 100644 index 0000000000..6b23b71806 --- /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 10df83975f..2c3dfc21f4 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 || -- GitLab