Fix IPv6 implementation for bridge statistics
Yesterday I found that the current IPv6 implementation in Tor doesn't count IPv6 connections at all. See connection_or.c lines 1717--1719:
/*XXXX IP6 support ipv6 geoip.*/
uint32_t a = tor_addr_to_ipv4h(&TO_CONN(conn)->addr);
geoip_note_client_seen(GEOIP_CLIENT_CONNECT, a, now);
That's actually pretty bad. If we don't count IPv6 connections at all, our bridge statistics will be even more broken than they already are. What if IPv6 becomes popular for bridges and people start using them instead of IPv4 bridges? We'll conclude that all our bridge users have disappeared. (Entry statistics are also affected, but they're not as important as bridge statistics.)
The long-term goal will be to include a IPv6 GeoIP database in Tor and resolve IPv6 addresses to countries, too. That's something for 0.2.4.x.
But the short-term goal must be to count IPv6 connections as unresolvable addresses using country code "??"
, so that we get the absolute numbers right. Or if we wanted, we could use country code "?6"
for unresolved IPv6 addresses.
I think we have to fix this in 0.2.3.x, despite the feature freeze. If required, I can start writing a patch today.