summaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-07-31 15:06:55 -0400
committerNick Mathewson <nickm@torproject.org>2010-07-31 15:21:00 -0400
commit4dd4d240b76c5c7ae47a1049e5deafc8b13d4f21 (patch)
tree2881f3a698b79551cd95cda348de9bf5adf4057d /src/or/geoip.c
parent8fca6fb2aa569cf4f09b6b4aaa887f3b434d759e (diff)
downloadtor-4dd4d240b76c5c7ae47a1049e5deafc8b13d4f21.tar.gz
tor-4dd4d240b76c5c7ae47a1049e5deafc8b13d4f21.zip
Move the "nowhereland" logic into geoip.c
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 6bb76ae4da..adbad8af73 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -228,9 +228,10 @@ geoip_load_file(const char *filename, or_options_t *options)
}
/** Given an IP address in host order, return a number representing the
- * country to which that address belongs, or -1 for unknown. The return value
- * will always be less than geoip_get_n_countries(). To decode it,
- * call geoip_get_country_name().
+ * country to which that address belongs, -1 for "No geoip information
+ * available", or 0 for the 'unknown country'. The return value will always
+ * be less than geoip_get_n_countries(). To decode it, call
+ * geoip_get_country_name().
*/
int
geoip_get_country_by_ip(uint32_t ipaddr)
@@ -239,7 +240,7 @@ geoip_get_country_by_ip(uint32_t ipaddr)
if (!geoip_entries)
return -1;
ent = smartlist_bsearch(geoip_entries, &ipaddr, _geoip_compare_key_to_entry);
- return ent ? (int)ent->country : -1;
+ return ent ? (int)ent->country : 0;
}
/** Return the number of countries recognized by the GeoIP database. */