aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authornils <nils@shkoo.com>2012-02-29 17:04:45 -0800
committerLinus Nordberg <linus@torproject.org>2012-10-17 10:54:52 +0200
commitabb886014e1ee35909e8876fe3361cbfd26cc27c (patch)
tree8409f09ea0bf8a00c7f31aacd166c39dca6042b0 /src/or/config.c
parent167363403b54accb2442fe10a8c588532ab4c26f (diff)
downloadtor-abb886014e1ee35909e8876fe3361cbfd26cc27c.tar.gz
tor-abb886014e1ee35909e8876fe3361cbfd26cc27c.zip
Add GeoIP database for IPv6 addresses
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c
index cfb76dcdab..fd6224e2c5 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -243,9 +243,12 @@ static config_var_t _option_vars[] = {
V(FetchV2Networkstatus, BOOL, "0"),
#ifdef _WIN32
V(GeoIPFile, FILENAME, "<default>"),
+ V(GeoIPv6File, FILENAME, "<default>"),
#else
V(GeoIPFile, FILENAME,
SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
+ V(GeoIPv6File, FILENAME,
+ SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip6"),
#endif
OBSOLETE("GiveGuardFlagTo_CVE_2011_2768_VulnerableRelays"),
OBSOLETE("Group"),
@@ -1524,9 +1527,28 @@ options_act(const or_options_t *old_options)
tor_asprintf(&actual_fname, "%s\\geoip", conf_root);
}
#endif
- geoip_load_file(actual_fname, options);
+ geoip_load_file(AF_INET, actual_fname, options);
tor_free(actual_fname);
}
+ /* And maybe load geoip ipv6 file */
+ if (options->GeoIPv6File &&
+ ((!old_options || !opt_streq(old_options->GeoIPv6File, options->GeoIPv6File))
+ || !geoip_is_loaded())) {
+ /* XXXX Don't use this "<default>" junk; make our filename options
+ * understand prefixes somehow. -NM */
+ /* XXXX023 Reload GeoIPFile on SIGHUP. -NM */
+ char *actual_fname = tor_strdup(options->GeoIPv6File);
+#ifdef _WIN32
+ if (!strcmp(actual_fname, "<default>")) {
+ const char *conf_root = get_windows_conf_root();
+ tor_free(actual_fname);
+ tor_asprintf(&actual_fname, "%s\\geoip6", conf_root);
+ }
+#endif
+ geoip_load_file(AF_INET6, actual_fname, options);
+ tor_free(actual_fname);
+ }
+
if (options->CellStatistics || options->DirReqStatistics ||
options->EntryStatistics || options->ExitPortStatistics ||