tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 1b1eeb0fb916c424ac8836ca2ec357d25967e041
parent 22e6880296185f2ed12755290f73dc30b3dc5510
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri,  8 Sep 2017 08:10:15 -0400

Merge branch 'feature23237'

Diffstat:
Achanges/feature23237 | 4++++
Msrc/or/geoip.c | 9+++++++++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/changes/feature23237 b/changes/feature23237 @@ -0,0 +1,4 @@ + o Minor features (controller): + - Added new GETINFO targets ip-to-country/{ipv4,ipv6}-available, so + controllers can tell whether the geoip databases are loaded. + Closes ticket 23237. diff --git 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";