Detect ip with vlan when falling back to historical data when searching (#7249)

This commit is contained in:
Alfredo Cardigliano 2023-03-09 15:30:35 +01:00
parent e922d8b3a2
commit f3eedc7bbc
2 changed files with 21 additions and 1 deletions

View file

@ -1105,6 +1105,26 @@ end
-- ##############################################
function isHostKey(key)
local info = split(key,"@")
-- Check format
if not info or #info < 1 or #info > 2 then
return false
end
-- Check IP format
if isEmptyString(info[1]) or (not isIPv4(info[1]) and not isIPv6(info[1])) then
return false
end
-- Check VLAN format (if any)
if not isEmptyString(info[2]) and tonumber(info[2]) == nil then
return false
end
-- Ok
return true
end
-- ##############################################
--
-- Analyze the host_info table and return the host key.
-- Example: