mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fix swapped host name in DHCP flows
This commit is contained in:
parent
541fe593d1
commit
38f9f6ca67
7 changed files with 40 additions and 7 deletions
|
|
@ -1530,6 +1530,12 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function getDhcpNamesKey(ifid)
|
||||
return "ntopng.dhcp."..ifid..".cache"
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
-- Used to avoid resolving host names too many times
|
||||
resolved_host_labels_cache = {}
|
||||
|
||||
|
|
@ -1551,6 +1557,16 @@ function getHostAltName(host_ip, host_mac)
|
|||
alt_name = ntop.getHashCache(getHostAltNamesKey(), host_mac)
|
||||
end
|
||||
|
||||
if isEmptyString(alt_name) and ifname ~= nil then
|
||||
local key = getDhcpNamesKey(getInterfaceId(ifname))
|
||||
|
||||
if host_mac ~= nil then
|
||||
alt_name = ntop.getHashCache(key, host_mac)
|
||||
elseif isMacAddress(host_ip) then
|
||||
alt_name = ntop.getHashCache(key, host_ip)
|
||||
end
|
||||
end
|
||||
|
||||
if isEmptyString(alt_name) then
|
||||
alt_name = host_ip
|
||||
end
|
||||
|
|
@ -1579,7 +1595,7 @@ function getDeviceName(device_mac, skip_manufacturer)
|
|||
|
||||
if (info ~= nil) then
|
||||
for x, host in pairs(info.hosts) do
|
||||
if not isEmptyString(host.name) and host.name ~= host.ip then
|
||||
if not isEmptyString(host.name) and host.name ~= host.ip and host.name ~= "NoIP" then
|
||||
name = host.name
|
||||
elseif host.ip ~= "0.0.0.0" then
|
||||
name = getHostAltName(host.ip)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue