mod_audit: Fix storing IP prefixes
authorKim Alvefur <zash@zash.se>
Mon, 13 Nov 2023 16:55:12 +0100
changeset 5715 c782f220b3ee
parent 5714 15c1801e8901
child 5716 b357ff3d0c8a
mod_audit: Fix storing IP prefixes Was essentially calling new_ip(new_ip())
mod_audit/mod_audit.lua
--- a/mod_audit/mod_audit.lua	Mon Nov 13 12:37:21 2023 +0100
+++ b/mod_audit/mod_audit.lua	Mon Nov 13 16:55:12 2023 +0100
@@ -61,13 +61,12 @@
 end
 
 local function get_ip_network(ip_addr)
-	local _ip = ip.new_ip(ip_addr);
-	local proto = _ip.proto;
+	local proto = ip_addr.proto;
 	local network;
 	if proto == "IPv4" and attach_ipv4_prefix then
-		network = ip.truncate(_ip, attach_ipv4_prefix).normal.."/"..attach_ipv4_prefix;
+		network = ip.truncate(ip_addr, attach_ipv4_prefix).normal.."/"..attach_ipv4_prefix;
 	elseif proto == "IPv6" and attach_ipv6_prefix then
-		network = ip.truncate(_ip, attach_ipv6_prefix).normal.."/"..attach_ipv6_prefix;
+		network = ip.truncate(ip_addr, attach_ipv6_prefix).normal.."/"..attach_ipv6_prefix;
 	end
 	return network;
 end