Refresh blacklist rules when blacklist alert preference changes

This commit is contained in:
emanuele-f 2017-01-12 10:44:20 +01:00 committed by Simone Mainardi
parent 2141004cc6
commit c40075486f
2 changed files with 14 additions and 4 deletions

View file

@ -28,16 +28,22 @@ end
-- ##################################################################
function loadHostBlackList()
function loadHostBlackList(force_purge)
local bl = ntop.getCache("ntopng.prefs.host_blacklist")
local bl_enabled = ((bl == "1") or (bl == "enabled"))
local should_reload = ((bl_enabled) or (force_purge))
if((bl == "1") or (bl == "enabled")) then
if should_reload then
ntop.allocHostBlacklist()
end
if bl_enabled then
for _,url in pairs(blacklistURLs) do
loadBlackListFromURL(url)
end
end
if should_reload then
ntop.swapHostBlacklist()
end
end