summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2018-04-05 08:35:21 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-04-05 08:37:39 -0400
commitf5f9c2554601e51157d8b563f124cea3fd3d98d4 (patch)
treee9661e2d8f24fde9e44e6edc368e4a6d7017b614
parent98157c72cd9ddcfd92cd5cd2749d19d1677efd14 (diff)
downloadtor-f5f9c2554601e51157d8b563f124cea3fd3d98d4.tar.gz
tor-f5f9c2554601e51157d8b563f124cea3fd3d98d4.zip
Switch to use should_record_bridge_info()
Both in geoip_note_client_seen() and options_need_geoip_info(), switch from accessing the options directly to using the should_record_bridge_info() helper function. Fixes #25290 Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--changes/ticket252905
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/geoip.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/changes/ticket25290 b/changes/ticket25290
new file mode 100644
index 0000000000..5e44f5e05c
--- /dev/null
+++ b/changes/ticket25290
@@ -0,0 +1,5 @@
+ o Code simplification and refactoring:
+ - We switch to should_record_bridge_info() in geoip_note_client_seen() and
+ options_need_geoip_info() instead of accessing the configuration values
+ directly. Fixes bug 25290; bugfix on 0.2.1.6-alpha. Patch by Neel
+ Chauhan.
diff --git a/src/or/config.c b/src/or/config.c
index 212c6c6b94..8658a13269 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1682,8 +1682,7 @@ options_act_reversible(const or_options_t *old_options, char **msg)
int
options_need_geoip_info(const or_options_t *options, const char **reason_out)
{
- int bridge_usage =
- options->BridgeRelay && options->BridgeRecordUsageByCountry;
+ int bridge_usage = should_record_bridge_info(options);
int routerset_usage =
routerset_needs_geoip(options->EntryNodes) ||
routerset_needs_geoip(options->ExitNodes) ||
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 572bba577f..2c917c564d 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -628,8 +628,7 @@ geoip_note_client_seen(geoip_client_action_t action,
/* Only remember statistics if the DoS mitigation subsystem is enabled. If
* not, only if as entry guard or as bridge. */
if (!dos_enabled()) {
- if (!options->EntryStatistics &&
- (!(options->BridgeRelay && options->BridgeRecordUsageByCountry))) {
+ if (!options->EntryStatistics && !should_record_bridge_info(options)) {
return;
}
}