Skip to content

Commit

Permalink
Fixed Invalid exporter address display (endianess)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Jun 27, 2016
1 parent 49e1b1f commit 3e07055
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions scripts/lua/modules/flow_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,29 @@ local mobile_country_code = {
-- #######################

function handleCustomFlowField(key, value)
if(key == 'TCP_FLAGS') then
if((key == 'TCP_FLAGS') or (key == '6')) then
return(formatTcpFlags(value))
elseif((key == 'INPUT_SNMP') or (key == 'OUTPUT_SNMP')) then
elseif((key == 'INPUT_SNMP') or (key == '10')
or (key == 'OUTPUT_SNMP') or (key == '14')) then
return(formatInterfaceId(value))
elseif((key == 'EXPORTER_IPV4_ADDRESS') or (key == '130')) then
local b1, b2, b3, b4 = value:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$")
b1 = tonumber(b1)
b2 = tonumber(b2)
b3 = tonumber(b3)
b4 = tonumber(b4)
local ipaddr = string.format('%d.%d.%d.%d', b4, b3, b2, b1)
local res = ntop.getResolvedAddress(ipaddr)

local ret = "<A HREF="..ntop.getHttpPrefix().."/lua/host_details.lua?host="..ipaddr..">"

if((res == "") or (res == nil)) then
ret = ret .. ipaddr
else
ret = ret .. res
end

return(ret .. "</A>")
elseif((key == 'FLOW_USER_NAME') or (key == '57593')) then
elems = string.split(value, ';')

Expand Down

0 comments on commit 3e07055

Please sign in to comment.