|
@@ -494,8 +494,18 @@ local function co_dhcp()
|
|
|
|
|
|
|
|
while true do
|
|
while true do
|
|
|
if cfg.debug then log("debug", "CHECK DHCP") end
|
|
if cfg.debug then log("debug", "CHECK DHCP") end
|
|
|
- local f = io.open("/var/lib/dnsmasq/dnsmasq.leases", "r")
|
|
|
|
|
- if not f and cfg.debug then log("debug", "No DHCP file") end
|
|
|
|
|
|
|
+ -- Try multiple lease file locations
|
|
|
|
|
+ local lease_files = {
|
|
|
|
|
+ "/var/lib/dnsmasq/dnsmasq.leases",
|
|
|
|
|
+ "/tmp/dhcp.leases",
|
|
|
|
|
+ "/etc/dhcp.leases"
|
|
|
|
|
+ }
|
|
|
|
|
+ local f = nil
|
|
|
|
|
+ for _, path in ipairs(lease_files) do
|
|
|
|
|
+ f = io.open(path, "r")
|
|
|
|
|
+ if f then break end
|
|
|
|
|
+ end
|
|
|
|
|
+ if not f and cfg.debug then log("debug", "No DHCP file found") end
|
|
|
if f then
|
|
if f then
|
|
|
local current = {}
|
|
local current = {}
|
|
|
for line in f:lines() do
|
|
for line in f:lines() do
|