diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index f16fd3c964..dc717f27f8 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -3546,9 +3546,8 @@ local lang = { ["unresolved_hostname_description"] = "Trigger an alert when a TLS/QUIC/HTTP flow connects with a symbolic hostname not previously resolved via DNS", }, ["flow_details"] = { - ["bgp_peer_id"] = "Peer ID", + ["bgp_peer_id"] = "BGP Peer Id", ["bgp_prefix"] = "Prefix", - ["bgp_peer_id"] = "Peer ID", ["bgp_origin"] = "Origin", ["bgp_as_path"] = "AS Path", ["bgp_next_hop"] = "Next Hop", diff --git a/scripts/lua/flow_details.lua b/scripts/lua/flow_details.lua index 5b25fc5c83..b7f39c4a91 100644 --- a/scripts/lua/flow_details.lua +++ b/scripts/lua/flow_details.lua @@ -2064,29 +2064,10 @@ if isEmptyString(page) or page == "overview" then for k,v in pairs(flow.exporters) do local ret, exp_ip, exp_name, site = formatExporter(v.exporter_ip) local ret1, next_hop_ip, next_hop_name, next_hope_site = formatNextHop(v.next_hop) - local source_label = "" - - -- tprint(v) - - if(false) then - if(v.source > 0) then - source_label = " " - - if(v.source == 1) then - source_label = source_label .. "NetFlow / IPFIX" - elseif(v.source == 2) then - source_label = source_label .."sFlow" - end - - source_label = source_label .. "" - end - end - - --tprint(source_label) print("".. ret .. ' ' .. ret1) if(v.return_path == true) then print(" ".. i18n("dedup_flow_swapped").."") end - print(source_label.. "") + print("") printFlowSNMPInfo(v.exporter_ip, v.input_idx, v.output_idx, true) print("") diff --git a/scripts/lua/modules/flow_utils.lua b/scripts/lua/modules/flow_utils.lua index 3a8ddcf218..caa497557f 100644 --- a/scripts/lua/modules/flow_utils.lua +++ b/scripts/lua/modules/flow_utils.lua @@ -1873,7 +1873,7 @@ function printFlowSNMPInfo(snmpdevice, input_idx, output_idx, as_row) if(input_role ~= nil) then v = input_role.value or "" end if(v ~= "") then v = " (".. v .. ")" end - print("" .. "" + print("" .. "" .. (inputidx_name or "") .. v .. "") end @@ -1885,7 +1885,7 @@ function printFlowSNMPInfo(snmpdevice, input_idx, output_idx, as_row) print(' ') - print("" .. "" .. + print("" .. "" .. (outputidx_name or "") .. v .. "") end diff --git a/scripts/lua/modules/format_utils.lua b/scripts/lua/modules/format_utils.lua index f8d3899a41..e18b7cee6f 100644 --- a/scripts/lua/modules/format_utils.lua +++ b/scripts/lua/modules/format_utils.lua @@ -22,9 +22,9 @@ function format_utils.formatBgpBmpInfo(bgp_data) i18n("flow_details.bgp_prefix") .. "" .. prefix .. "\n") -- Peer ID - print("" .. i18n("flow_details.bgp_peer_id") .."") + print("" .. i18n("flow_details.bgp_peer_id") .."") for _, peer in ipairs(peer_list) do - print("" .. peer.id .. "") + print("" .. formatNextHop(peer.id) .. "") end print("\n") @@ -49,7 +49,9 @@ function format_utils.formatBgpBmpInfo(bgp_data) local parts = {} for _, asn in ipairs(peer.info["as_path"]) do - parts[#parts + 1] = "("..asn..") "..shortenString(ntop.getASNameFromASN(tonumber(asn)), max_len) + -- parts[#parts + 1] = "("..asn..") "..shortenString(ntop.getASNameFromASN(tonumber(asn)), max_len) + parts[#parts + 1] = ""..asn.." ("..shortenString(ntop.getASNameFromASN(tonumber(asn)), max_len)..")" end if(#parts == 0) then @@ -73,7 +75,7 @@ function format_utils.formatBgpBmpInfo(bgp_data) print("\n") -- MED - if not ((#bgp_data == 1) and (#peer_list == 0)) then + if not ((#bgp_data == 1) and (#peer_list > 0)) then print("" .. i18n("flow_details.bgp_med") .. "") for _, peer in ipairs(peer_list) do local med_string = (peer.info["med"] ~= nil) and tostring(peer.info["med"]) or "" diff --git a/scripts/lua/modules/lua_utils_gui.lua b/scripts/lua/modules/lua_utils_gui.lua index 950ae0cd71..65710b6b5d 100644 --- a/scripts/lua/modules/lua_utils_gui.lua +++ b/scripts/lua/modules/lua_utils_gui.lua @@ -28,11 +28,14 @@ local cache_utils = require "cache_utils" local exporter_site_utils if ntop.isPro() then + local dirs = ntop.getDirs() + package.path = dirs.installdir .. "/scripts/lua/pro/modules/?.lua;" .. package.path require "flow_exporter_utils" -- snmp_utils = require "snmp_utils" exporter_site_utils = require "exporter_site_utils" end + -- For backward compatibility override these functions sendHTTPContentTypeHeader = rest_utils.sendHTTPContentTypeHeader sendHTTPHeaderIfName = rest_utils.sendHTTPHeaderIfName @@ -1587,25 +1590,30 @@ function formatHTMLaTag(real_value, name, url) return link end +function formatInterfaceIP(ip, href) + local ret + local site = nil + local exporter_name + + if(exporter_site_utils ~= nil) then + ip, site, exporter_name = exporter_site_utils.map_exporter_ip(ip) + end + + ret = "" .. exporter_name + + if(site ~= nil) then + ret = ret .. " (".. site ..")" + end + + if(exporter_name ~= ip) then ret = ret .. ' [ '..ip.."]" end + ret = ret .. "" + + return(ret) +end + function formatExporter(ip) - if ntop.isPro() then - local ret - local site = nil - local exporter_name - - if(exporter_site_utils ~= nil) then - ip, site, exporter_name = exporter_site_utils.map_exporter_ip(ip) - end - - ret = "" .. exporter_name - - if(site ~= nil) then - ret = ret .. " (".. site ..")" - end - - ret = ret .. "" - - return ret, ip, exporter_name or ip, site + if ntop.isPro() then + return formatInterfaceIP(ip, "/lua/pro/enterprise/exporter_interfaces.lua?ip="), ip, exporter_name or ip, site else return ip, ip, ip, nil end @@ -1622,7 +1630,7 @@ function formatNextHop(ip) ip1, site, exporter_name = exporter_site_utils.map_host_to_exporter_ip(ip) end - if(ip1 ~= ip) then + if(exporter_name ~= ip) then ret = "" .. exporter_name if(site ~= nil) then