void
node_set_country(node_t *node)
{
+ tor_addr_t addr = TOR_ADDR_NULL;
+
+ /* XXXXipv6 */
if (node->rs)
- node->country = geoip_get_country_by_ip(node->rs->addr);
+ tor_addr_from_ipv4h(&addr, node->rs->addr);
else if (node->ri)
- node->country = geoip_get_country_by_ip(node->ri->addr);
- else
- node->country = -1;
+ tor_addr_from_ipv4h(&addr, node->ri->addr);
+
+ node->country = geoip_get_country_by_addr(&addr);
}
/** Set the country code of all routers in the routerlist. */
return 3;
if (set->countries) {
if (country < 0 && addr)
- country = geoip_get_country_by_ip(tor_addr_to_ipv4h(addr));
+ country = geoip_get_country_by_addr(addr);
if (country >= 0 && country < set->n_countries &&
bitarray_is_set(set->countries, country))