]> jfr.im git - irc/quakenet/newserv.git/commitdiff
fix geoip for iptrie
authorPaul <redacted>
Sun, 27 May 2007 10:19:12 +0000 (10:19 +0000)
committerPaul <redacted>
Sun, 27 May 2007 10:19:12 +0000 (10:19 +0000)
geoip/geoip.c

index 9112d95dce94bf5f6382efaf4882f5556e697e75..1a3cae61ba4ca6aa9d553f5d569c32ce16cad2ae 100644 (file)
@@ -69,7 +69,11 @@ void _fini(void) {
 }
 
 void geoip_setupuser(nick *np) {
-  int country = GeoIP_id_by_ipnum(gi, np->ipaddress);
+  if (!irc_in_addr_is_ipv4(&np->p_ipaddr)) 
+    return; /* geoip only supports ipv4 */
+
+  unsigned int ip = irc_in_addr_v4_to_int(&np->p_ipaddr);
+  int country = GeoIP_id_by_ipnum(gi, ip);
   if((country < COUNTRY_MIN) || (country > COUNTRY_MAX))
     return;