Mercurial > prosody-modules
comparison mod_audit/mod_audit.lua @ 5711:c782f220b3ee
mod_audit: Fix storing IP prefixes
Was essentially calling new_ip(new_ip())
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 13 Nov 2023 16:55:12 +0100 |
parents | 15c1801e8901 |
children | c77010f25b14 |
comparison
equal
deleted
inserted
replaced
5710:15c1801e8901 | 5711:c782f220b3ee |
---|---|
59 module:context(host):log("debug", "Pruned expired audit log entries"); | 59 module:context(host):log("debug", "Pruned expired audit log entries"); |
60 return true; | 60 return true; |
61 end | 61 end |
62 | 62 |
63 local function get_ip_network(ip_addr) | 63 local function get_ip_network(ip_addr) |
64 local _ip = ip.new_ip(ip_addr); | 64 local proto = ip_addr.proto; |
65 local proto = _ip.proto; | |
66 local network; | 65 local network; |
67 if proto == "IPv4" and attach_ipv4_prefix then | 66 if proto == "IPv4" and attach_ipv4_prefix then |
68 network = ip.truncate(_ip, attach_ipv4_prefix).normal.."/"..attach_ipv4_prefix; | 67 network = ip.truncate(ip_addr, attach_ipv4_prefix).normal.."/"..attach_ipv4_prefix; |
69 elseif proto == "IPv6" and attach_ipv6_prefix then | 68 elseif proto == "IPv6" and attach_ipv6_prefix then |
70 network = ip.truncate(_ip, attach_ipv6_prefix).normal.."/"..attach_ipv6_prefix; | 69 network = ip.truncate(ip_addr, attach_ipv6_prefix).normal.."/"..attach_ipv6_prefix; |
71 end | 70 end |
72 return network; | 71 return network; |
73 end | 72 end |
74 | 73 |
75 local function session_extra(session) | 74 local function session_extra(session) |