summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/directory.c2
-rw-r--r--src/or/geoip.c20
-rw-r--r--src/or/router.c9
3 files changed, 25 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index e7a0e0b823..6e2ccb605f 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2461,7 +2461,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
}
if (!strcmpstart(url,"/tor/server/") ||
- !strcmpstart(url,"/tor/extra/")) {
+ (!options->BridgeAuthoritativeDir && !strcmpstart(url,"/tor/extra/"))) {
int res;
const char *msg;
const char *request_type = NULL;
diff --git a/src/or/geoip.c b/src/or/geoip.c
index f81c18c85f..ce807a59df 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -76,6 +76,10 @@ geoip_parse_entry(const char *line)
geoip_entries = smartlist_create();
country_idxplus1_by_lc_code = strmap_new();
}
+ while (TOR_ISSPACE(*line))
+ ++line;
+ if (*line == '#')
+ return 0;
if (sscanf(line,"%u,%u,%2s", &low, &high, b) == 3) {
geoip_add_entry(low, high, b);
return 0;
@@ -277,12 +281,12 @@ geoip_remove_old_clients(time_t cutoff)
}
/** Do not mention any country from which fewer than this number of IPs have
- * connected. This avoids reporting information that could deanonymize
- * users. */
-#define MIN_IPS_TO_NOTE_COUNTRY 8
+ * connected. This conceivably avoids reporting information that could
+ * deanonymize users, though analysis is lacking. */
+#define MIN_IPS_TO_NOTE_COUNTRY 0
/** Do not report any geoip data at all if we have fewer than this number of
* IPs to report about. */
-#define MIN_IPS_TO_NOTE_ANYTHING 16
+#define MIN_IPS_TO_NOTE_ANYTHING 0
/** When reporting geoip data about countries, round down to the nearest
* multiple of this value. */
#define IP_GRANULARITY 8
@@ -344,8 +348,10 @@ geoip_get_client_history(time_t now)
++total;
}
/* Don't record anything if we haven't seen enough IPs. */
+#if MIN_IPS_TO_NOTE_ANYTHING > 0
if (total < MIN_IPS_TO_NOTE_ANYTHING)
goto done;
+#endif
/* Make a list of c_hist_t */
entries = smartlist_create();
for (i = 0; i < n_countries; ++i) {
@@ -353,7 +359,11 @@ geoip_get_client_history(time_t now)
const char *countrycode;
c_hist_t *ent;
/* Only report a country if it has a minimum number of IPs. */
+#if MIN_IPS_TO_NOTE_COUNTRY > 0
if (c >= MIN_IPS_TO_NOTE_COUNTRY) {
+#else
+ if (1) {
+#endif
/* Round up to the next multiple of IP_GRANULARITY */
c += IP_GRANULARITY-1;
c -= c % IP_GRANULARITY;
@@ -375,7 +385,9 @@ geoip_get_client_history(time_t now)
smartlist_add(chunks, tor_strdup(buf));
});
result = smartlist_join_strings(chunks, ",", 0, NULL);
+#if MIN_IPS_TO_NOTE_ANYTHING > 0
done:
+#endif
tor_free(counts);
if (chunks) {
SMARTLIST_FOREACH(chunks, char *, c, tor_free(c));
diff --git a/src/or/router.c b/src/or/router.c
index 909fa3d4d5..5917727343 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1822,7 +1822,14 @@ extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
return -1;
if (options->BridgeRelay && options->BridgeRecordUsageByCountry) {
- char *geoip_summary = geoip_get_client_history(time(NULL));
+ static time_t last_purged_at = 0;
+ char *geoip_summary;
+ time_t now = time(NULL);
+ if (now > last_purged_at+48*60*60) {
+ geoip_remove_old_clients(now-48*60*60);
+ last_purged_at = now;
+ }
+ geoip_summary = geoip_get_client_history(time(NULL));
if (geoip_summary) {
char geoip_start[ISO_TIME_LEN+1];
format_iso_time(geoip_start, geoip_get_history_start());