Fixed but in host matrix where a nil could happen during host name conversion

If defines, mapped symbolic interface name in interfaces menu
This commit is contained in:
Luca Deri 2015-09-16 19:15:22 +02:00
parent 4dd80d4778
commit 9e0907179e
3 changed files with 12 additions and 8 deletions

View file

@ -1465,19 +1465,19 @@ function getInterfaceNameAlias(interface_name)
end
end
function getHumanReadableInterfaceName(interface_id)
key = 'ntopng.prefs.'..interface_id..'.name'
function getHumanReadableInterfaceName(interface_name)
key = 'ntopng.prefs.'..interface_name..'.name'
custom_name = ntop.getCache(key)
if((custom_name ~= nil) and (custom_name ~= "")) then
return(custom_name)
else
interface.select(interface_id)
interface.select(interface_name)
_ifstats = aggregateInterfaceStats(interface.getStats())
-- print(interface_id.."=".._ifstats.name)
-- print(interface_name.."=".._ifstats.name)
if((interface_id ~= _ifstats.description) and (_ifstats.description ~= "PF_RING")) then
if((interface_name ~= _ifstats.description) and (_ifstats.description ~= "PF_RING")) then
return(_ifstats.description)
else
return(_ifstats.name)