# HG changeset patch # User Kim Alvefur # Date 1699874071 -3600 # Node ID 37ba9478b387d1a9ffed01dcae5a59a09274b9ea # Parent 9a5fca9f90a60bb162cdfabfde5fbd705e6300c0 mod_audit: Fix recording location info The method :query_by_addr only works for IPv4, even if you open the IPv6 database, which is an odd API. It also returns a table, not a string. diff -r 9a5fca9f90a6 -r 37ba9478b387 mod_audit/mod_audit.lua --- a/mod_audit/mod_audit.lua Mon Nov 13 12:05:17 2023 +0100 +++ b/mod_audit/mod_audit.lua Mon Nov 13 12:14:31 2023 +0100 @@ -92,9 +92,9 @@ stanza:text_tag("remote-ip", network or remote_ip.normal); end if attach_location and remote_ip then - local geoip_country = ip.proto == "IPv6" and geoip6_country or geoip4_country; + local geoip_info = remote_ip.proto == "IPv6" and geoip6_country:query_by_addr6(remote_ip.normal) or geoip4_country:query_by_addr(remote_ip.normal); stanza:tag("location", { - country = geoip_country:query_by_addr(remote_ip.normal); + country = geoip_info.code; }):up(); end if session.client_id then