Skip to content

Commit

Permalink
Add filterize on wlan info
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Sep 17, 2024
1 parent 6e92102 commit 4455dab
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions httpdocs/tables_config/flow_historical.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@
"data_field": "wlan_ssid",
"min-width": "100px",
"sortable": true,
"render_generic": "wlan_ssid",
"class": [
"no-wrap"
]
Expand All @@ -457,6 +458,7 @@
"data_field": "apn_mac",
"min-width": "100px",
"sortable": true,
"render_generic": "apn_mac",
"class": [
"no-wrap"
]
Expand Down
31 changes: 28 additions & 3 deletions scripts/lua/modules/historical_flow_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,37 @@ end
local function dt_format_mac(mac)
if mac == nil then return "" end
mac = tonumber(mac)
if mac == 0 then return "" end
if not mac or mac == 0 then return "" end
return ntop.decodeMac64(mac)
end

-- #####################################

local function dt_format_mac_obj(mac)
local mac_str = dt_format_mac(mac)
local formatted_mac = {
title = mac_str,
label = mac_str,
value = mac_str,
}

return formatted_mac
end

-- #####################################

local function dt_format_ssid_obj(ssid)
local formatted_ssid = {
title = ssid,
label = ssid,
value = ssid,
}

return formatted_ssid
end

-- #####################################

local function dt_format_dscp(dscp_id)
dscp_id = tonumber(dscp_id)
local title = dscp_consts.dscp_class_descr(dscp_id)
Expand Down Expand Up @@ -1119,8 +1144,8 @@ local flow_columns = {
['POST_NAT_SRC_PORT'] = { tag = "post_nat_src_port", dt_func = dt_format_port, db_type = "Number", db_raw_type = "Uint16" },
['POST_NAT_IPV4_DST_ADDR'] = { tag = "post_nat_ipv4_dst_addr", dt_func = dt_format_nat_ip, select_func = "IPv4NumToString", db_type = "Number", db_raw_type = "Uint32" },
['POST_NAT_DST_PORT'] = { tag = "post_nat_dst_port", dt_func = dt_format_port, db_type = "Number", db_raw_type = "Uint16" },
['WLAN_SSID'] = { tag = "wlan_ssid", db_type = "String", db_raw_type = "String" },
['WTP_MAC_ADDRESS'] = { tag = "apn_mac", dt_func = dt_format_mac, db_type = "Number", db_raw_type = "Uint64" },
['WLAN_SSID'] = { tag = "wlan_ssid", dt_func = dt_format_ssid_obj, db_type = "String", db_raw_type = "String" },
['WTP_MAC_ADDRESS'] = { tag = "apn_mac", dt_func = dt_format_mac_obj, db_type = "Number", db_raw_type = "Uint64" },

--[[ TODO: this column is for the aggregated_flow_columns but the parsing Function
only parses these columns, so a new logic to parse only the aggregated_flow_columns
Expand Down

0 comments on commit 4455dab

Please sign in to comment.