Removed double field in flow details (#6950)

This commit is contained in:
MatteoBiscosi 2023-02-08 12:03:43 +01:00
parent f810eceaa1
commit 9428000b8a
2 changed files with 49 additions and 1 deletions

View file

@ -20,6 +20,15 @@ if ntop.isPro() then
shaper_utils = require("shaper_utils")
end
-- The same base id of the ntop_flow.h file
local ntop_base_id = 57472
-- Keep in sync with the defines in ntop_flow.h,
-- otherwise it could happen that some fields are not mapped
local flow_label_id = {
[tostring(ntop_base_id + 524)] = 'COMMUNITY_ID',
}
-- #######################
local flow_verdict_mapping = {
@ -36,6 +45,31 @@ local flow_verdict_icon = {
-- #######################
function getFlowLabelFromId(id)
local label = flow_label_id[tostring(id)]
if label == nil then
label = id
end
return label
end
-- #######################
-- Given a field and a flow, checks if the flow already has a non empty field
function fieldAlreadyPresent(field, flow)
field = string.lower(field)
if (flow[field]) and (not isEmptyString(flow[field])) then
return true
end
return false
end
-- #######################
function parseFlowVerdict(flow_verdict, minimal)
if flow_verdict_mapping[flow_verdict + 1] then
if minimal then
@ -761,6 +795,10 @@ end
-- #######################
function getFlowKey(name)
if tonumber(name) then
name = getFlowLabelFromId(name)
end
local s = flow_consts.flow_fields_description[name]
if(s == nil) then