Two changes lost in rebase resurrected.

This commit is contained in:
Linus Nordberg 2012-10-17 12:13:49 +02:00
parent 19ab7b1639
commit 74c6dafed6
2 changed files with 8 additions and 5 deletions

View File

@ -921,12 +921,15 @@ node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out)
void void
node_set_country(node_t *node) node_set_country(node_t *node)
{ {
tor_addr_t addr = TOR_ADDR_NULL;
/* XXXXipv6 */
if (node->rs) 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) else if (node->ri)
node->country = geoip_get_country_by_ip(node->ri->addr); tor_addr_from_ipv4h(&addr, node->ri->addr);
else
node->country = -1; node->country = geoip_get_country_by_addr(&addr);
} }
/** Set the country code of all routers in the routerlist. */ /** Set the country code of all routers in the routerlist. */

View File

@ -216,7 +216,7 @@ routerset_contains(const routerset_t *set, const tor_addr_t *addr,
return 3; return 3;
if (set->countries) { if (set->countries) {
if (country < 0 && addr) 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 && if (country >= 0 && country < set->n_countries &&
bitarray_is_set(set->countries, country)) bitarray_is_set(set->countries, country))