diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-08-25 12:25:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-25 12:25:05 -0400 |
commit | 96aed28f143298b33363a7a0ca997e2a4d2eae29 (patch) | |
tree | 8f3fae9f815e4021ff6156d23459f524da1c4471 /src/or/geoip.c | |
parent | b91dce9454c3db669a07968b25a4fa03d8526917 (diff) | |
download | tor-96aed28f143298b33363a7a0ca997e2a4d2eae29.tar.gz tor-96aed28f143298b33363a7a0ca997e2a4d2eae29.zip |
New GETINFO target to check if geoip is loaded
Closes ticket 23237.
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r-- | src/or/geoip.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c index 65d00b8659..3944b2cf69 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -1665,6 +1665,15 @@ getinfo_helper_geoip(control_connection_t *control_conn, sa_family_t family; tor_addr_t addr; question += strlen("ip-to-country/"); + + if (!strcmp(question, "ipv4-available") || + !strcmp(question, "ipv6-available")) { + family = !strcmp(question, "ipv4-available") ? AF_INET : AF_INET6; + const int available = geoip_is_loaded(family); + tor_asprintf(answer, "%d", !! available); + return 0; + } + family = tor_addr_parse(&addr, question); if (family != AF_INET && family != AF_INET6) { *errmsg = "Invalid address family"; |