luci-base: read odhcpd leasefile location via uci
Check the location of the odhcpd leasefile from /etc/config/dhcp via uci. Fallback to the default location. This fixes #702 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
parent
4612c241d2
commit
51a7f96877
1 changed files with 9 additions and 1 deletions
|
@ -48,7 +48,15 @@ local function dhcp_leases_common(family)
|
||||||
fd:close()
|
fd:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local fd = io.open("/tmp/hosts/odhcpd", "r")
|
local lease6file = "/tmp/hosts/odhcpd"
|
||||||
|
uci:foreach("dhcp", "odhcpd",
|
||||||
|
function(t)
|
||||||
|
if t.leasefile and nfs.access(t.leasefile) then
|
||||||
|
lease6file = t.leasefile
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
local fd = io.open(lease6file, "r")
|
||||||
if fd then
|
if fd then
|
||||||
while true do
|
while true do
|
||||||
local ln = fd:read("*l")
|
local ln = fd:read("*l")
|
||||||
|
|
Loading…
Reference in a new issue