|
@@ -240,7 +240,8 @@ local function get_dhcp_leases()
|
|
|
f:close()
|
|
f:close()
|
|
|
if result:match('"leases"') then
|
|
if result:match('"leases"') then
|
|
|
for ip, mac in result:gmatch('"ip":"([%d%.]+)"[^}]*"mac":"([a-fA-F0-9:]+)"') do
|
|
for ip, mac in result:gmatch('"ip":"([%d%.]+)"[^}]*"mac":"([a-fA-F0-9:]+)"') do
|
|
|
- leases[mac] = {ip=ip, mac=mac}
|
|
|
|
|
|
|
+ -- Validate MAC before adding
|
|
|
|
|
+ if is_valid_mac(mac) then leases[mac] = {ip=ip, mac=mac} end
|
|
|
end
|
|
end
|
|
|
return leases
|
|
return leases
|
|
|
end
|
|
end
|
|
@@ -251,7 +252,8 @@ local function get_dhcp_leases()
|
|
|
if f then
|
|
if f then
|
|
|
for line in f:lines() do
|
|
for line in f:lines() do
|
|
|
local e, mac, ip, h, c = line:match("^(%S+) (%S+) (%S+) (%S+) (%S+)")
|
|
local e, mac, ip, h, c = line:match("^(%S+) (%S+) (%S+) (%S+) (%S+)")
|
|
|
- if mac then leases[mac] = {ip=ip, mac=mac, hostname=h} end
|
|
|
|
|
|
|
+ -- Validate MAC before adding
|
|
|
|
|
+ if mac and is_valid_mac(mac) then leases[mac] = {ip=ip, mac=mac, hostname=h} end
|
|
|
end
|
|
end
|
|
|
f:close()
|
|
f:close()
|
|
|
end
|
|
end
|