Skip to content

Commit

Permalink
Added support to wlan ssid filter (#8702)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoBiscosi committed Sep 20, 2024
1 parent 267c5ae commit 15c35ce
Show file tree
Hide file tree
Showing 12 changed files with 685 additions and 537 deletions.
2 changes: 2 additions & 0 deletions include/FlowStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class FlowStats {
u_int32_t dscps[64]; // 64 values available for dscp
u_int32_t host_pools[UNLIMITED_NUM_HOST_POOLS];
std::map<std::string, u_int16_t> talking_hosts;
std::map<std::string, u_int16_t> wlan_ssid;

public:
FlowStats();
Expand All @@ -46,6 +47,7 @@ class FlowStats {
u_int8_t dscp_srv2cli, Flow *flow);

void updateTalkingHosts(Flow *f);
void updateWLANSSID(Flow *f);

void lua(lua_State *vm);

Expand Down
10 changes: 9 additions & 1 deletion include/Paginator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Paginator {
bool a2z_sort_order;
bool detailed_results /* deprecated, use DetailsLevel instead */;
char *sort_column, *country_filter, *host_filter, *client_filter,
*server_filter;
*server_filter, *wlan_ssid_filter;
char *container_filter, *pod_filter;
char *traffic_profile_filter;
char *username_filter, *pidname_filter;
Expand Down Expand Up @@ -85,6 +85,14 @@ class Paginator {
return false;
}

inline bool wlanSSIDFilter(char **f) const {
if (wlan_ssid_filter) {
(*f) = wlan_ssid_filter;
return true;
}
return false;
}

inline bool hostFilter(char **f) const {
if (host_filter) {
(*f) = host_filter;
Expand Down
3 changes: 3 additions & 0 deletions scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ local lang = {
["traffic_type"] = "Traffic Type",
["type"] = "ICMP Type",
["udp"] = "UDP",
["wlan_ssid"] = "WLAN SSID",
["udp_processes"] = "UDP Processes",
["unable_to_copy_to_clickboard"] = "Unable to copy to clipboard",
["undo"] = "Undo",
Expand Down Expand Up @@ -2147,6 +2148,7 @@ local lang = {
["top_servers"] = "Top Servers",
["traffic_direction"] = "Traffic Direction",
["vlan_id"] = "VLAN",
["wlan_ssid"] = "WLAN SSID",
["where_note"] = "Use &lt;field&gt; &lt;operator&gt; &lt;value&gt; conditions, where &lt;operator&gt; could be &lt;, &gt;, =, !=. AND/OR operators are also allowed to combine conditions. Please use quotes for string fields (e.g. INFO='www.ntop.org')",
["all"] = {
["host_pool"] = "All Host Pools",
Expand All @@ -2158,6 +2160,7 @@ local lang = {
["output_snmp"] = "All Interfaces",
["probe_ip"] = "All Exporters",
["vlan_id"] = "All VLANs",
["wlan_ssid"] = "All WLAN SSID",
},
["tags"] = {
["acknowledged"] = "Acknowledged",
Expand Down
26 changes: 13 additions & 13 deletions scripts/lua/flow_details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,19 @@ else
"</td></tr>\n")
end

if flow.wlan then
if flow.wlan.ssid then
print("<tr><th width=10%>" .. getFlowKey('WLAN_SSID') .. "</th>")
print("<td colspan=2>" .. flow.wlan["ssid"] .. "</td>")
print("</tr>\n")
end
if flow.wlan.wtp_mac_address then
print("<tr><th width=10%>" .. getFlowKey('WTP_MAC_ADDRESS') .. "</th>")
print("<td colspan=2>" .. flow.wlan["wtp_mac_address"] .. "</td>")
print("</tr>\n")
end
end

if (flow["moreinfo.json"] ~= nil) then
local flow_field_value_maps = require "flow_field_value_maps"
local info, pos, err = json.decode(flow["moreinfo.json"], 1, nil)
Expand Down Expand Up @@ -2010,19 +2023,6 @@ else
end
end

if flow.wlan then
if flow.wlan.ssid then
print("<tr><th width=10%>" .. getFlowKey('WLAN_SSID') .. "</th>")
print("<td colspan=2>" .. flow.wlan["ssid"] .. "</td>")
print("</tr>\n")
end
if flow.wlan.wtp_mac_address then
print("<tr><th width=10%>" .. getFlowKey('WTP_MAC_ADDRESS') .. "</th>")
print("<td colspan=2>" .. flow.wlan["wtp_mac_address"] .. "</td>")
print("</tr>\n")
end
end

if (flow.flow_payload ~= nil) then
local idx

Expand Down
5 changes: 5 additions & 0 deletions scripts/lua/modules/flow_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function getFlowsFilter()
local icmp_type = _GET["icmp_type"]
local icmp_code = _GET["icmp_cod"]
local dscp_filter = _GET["dscp"]
local wlan_ssid_filter = _GET["wlan_ssid"]
local host_pool = _GET["host_pool_id"]
local flow_status = _GET["flow_status"]
local flow_status_severity = _GET["flow_status_severity"]
Expand Down Expand Up @@ -370,6 +371,10 @@ function getFlowsFilter()
pageinfo["dscpFilter"] = tonumber(dscp_filter)
end

if not isEmptyString(wlan_ssid_filter) then
pageinfo["wlanSSIDFilter"] = wlan_ssid_filter
end

if not isEmptyString(talking_with) then
pageinfo["talkingWith"] = talking_with
end
Expand Down
Loading

0 comments on commit 15c35ce

Please sign in to comment.