mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Fixes ndpi application duplication ids
This commit is contained in:
parent
5f431e14a5
commit
219d57e362
3 changed files with 15 additions and 6 deletions
|
|
@ -219,17 +219,26 @@ end
|
|||
|
||||
function protos_utils.overwriteAppRules(app, rules)
|
||||
local current_rules, defined_protos = protos_utils.parseProtosTxt()
|
||||
local found = false
|
||||
|
||||
if (current_rules == nil) or (type("app") ~= "string") then
|
||||
return false
|
||||
end
|
||||
|
||||
if (not current_rules[app]) then
|
||||
-- This is a new app, append it to the end
|
||||
defined_protos[#defined_protos + 1] = app
|
||||
-- In case the name has different major or lower cases
|
||||
-- Replace with the new name
|
||||
for app_name, _ in pairs(current_rules) do
|
||||
if app:lower() == app_name:lower() then
|
||||
current_rules[app] = rules
|
||||
found = true
|
||||
end
|
||||
end
|
||||
|
||||
if not found then
|
||||
defined_protos[#defined_protos + 1] = app
|
||||
current_rules[app] = rules
|
||||
end
|
||||
|
||||
current_rules[app] = rules
|
||||
return protos_utils.generateProtosTxt(current_rules, defined_protos)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue