summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-08 08:10:15 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-08 08:10:15 -0400
commit1b1eeb0fb916c424ac8836ca2ec357d25967e041 (patch)
tree6acc7878249d16a6d6e13012b9ab3776822de5fa /src
parent22e6880296185f2ed12755290f73dc30b3dc5510 (diff)
parent96aed28f143298b33363a7a0ca997e2a4d2eae29 (diff)
downloadtor-1b1eeb0fb916c424ac8836ca2ec357d25967e041.tar.gz
tor-1b1eeb0fb916c424ac8836ca2ec357d25967e041.zip
Merge branch 'feature23237'
Diffstat (limited to 'src')
-rw-r--r--src/or/geoip.c9
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";