diff options
author | David Goulet <dgoulet@torproject.org> | 2018-01-19 13:15:07 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-01-30 09:18:15 -0500 |
commit | 51fda85c23e5ff2cabbc66ea19b006c4cb04b1e2 (patch) | |
tree | 59e626b18c4276aeefec1ae219469d1720bcc662 /src/or | |
parent | 64149353dda6336488e7d011534a7132b3f01acc (diff) | |
download | tor-51fda85c23e5ff2cabbc66ea19b006c4cb04b1e2.tar.gz tor-51fda85c23e5ff2cabbc66ea19b006c4cb04b1e2.zip |
geoip: Remember client stats if DoS mitigation is enabled
Make the geoip cache track client address if the DoS subsystem is enabled.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/geoip.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c index e2a1b1cee4..5f0b04b568 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -33,6 +33,7 @@ #include "config.h" #include "control.h" #include "dnsserv.h" +#include "dos.h" #include "geoip.h" #include "routerlist.h" @@ -549,10 +550,14 @@ geoip_note_client_seen(geoip_client_action_t action, clientmap_entry_t *ent; if (action == GEOIP_CLIENT_CONNECT) { - /* Only remember statistics as entry guard or as bridge. */ - if (!options->EntryStatistics && - (!(options->BridgeRelay && options->BridgeRecordUsageByCountry))) - return; + /* 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))) { + return; + } + } } else { /* Only gather directory-request statistics if configured, and * forcibly disable them on bridge authorities. */ |