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.
This commit is contained in:
Nick Mathewson 2014-07-16 11:14:59 +02:00
parent 7591ce64fb
commit 4da4c4c63f
2 changed files with 19 additions and 14 deletions

5
changes/bug9801 Normal file
View file

@ -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".

View file

@ -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 ||