mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
MUD configuration save fixes
This commit is contained in:
parent
cf90bb2bcf
commit
f000dcb30a
4 changed files with 32 additions and 17 deletions
|
|
@ -267,19 +267,32 @@ end
|
|||
|
||||
-- ###########################################
|
||||
|
||||
local mud_user_script = nil
|
||||
|
||||
-- Cache mud_user_script to avoid repeated loads
|
||||
local function loadMudUserScriptConf()
|
||||
if(mud_user_script == nil) then
|
||||
local user_scripts = require("user_scripts")
|
||||
local configsets = user_scripts.getConfigsets()
|
||||
local configset, confset_id = user_scripts.getTargetConfig(configsets, "flow", ifid)
|
||||
mud_user_script = user_scripts.getTargetHookConfig(configset, "mud")
|
||||
end
|
||||
|
||||
return(mud_user_script)
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
function mud_utils.getCurrentHostMUDRecording(ifid, host_key, device_type)
|
||||
local pref = mud_utils.getHostMUDRecordingPref(ifid, host_key)
|
||||
|
||||
if(pref == "default") then
|
||||
local user_scripts = require("user_scripts")
|
||||
local configsets = user_scripts.getConfigsets()
|
||||
local configset, confset_id = user_scripts.getTargetConfig(configsets, "flow", ifid)
|
||||
local mud_user_script = user_scripts.getTargetHookConfig(configset, "mud")
|
||||
local mud_user_script = loadMudUserScriptConf()
|
||||
|
||||
if(mud_user_script.enabled) then
|
||||
local enabled_device_types = {}
|
||||
|
||||
for _, devtype in pairs(mud_user_script.script_conf or {}) do
|
||||
for _, devtype in pairs(mud_user_script.script_conf.device_types or {}) do
|
||||
local id = discover.devtype2id(devtype)
|
||||
|
||||
enabled_device_types[id] = true
|
||||
|
|
@ -310,6 +323,14 @@ end
|
|||
|
||||
-- ###########################################
|
||||
|
||||
function mud_utils.isMudScriptEnabled(ifid)
|
||||
local mud_user_script = loadMudUserScriptConf()
|
||||
|
||||
return(mud_user_script.enabled)
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
local function getAclMatches(conn, dir)
|
||||
local peer_key = conn.peer_key or ""
|
||||
local mud_l4proto = string.lower(conn.l4proto)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue