summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2016-04-17 12:10:24 +0300
committerHannu Nyman <hannu.nyman@iki.fi>2016-04-17 12:12:54 +0300
commit51a7f96877d8c5bf70217073ed8aa7ab6a196d20 (patch)
tree3591774fe6ff87534948e21e21230fc1489122f6 /modules/luci-base/luasrc
parent4612c241d276d7f4b3bb8919b0f3319bf525c237 (diff)
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>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/tools/status.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index ac053eac8..a1ecbe71d 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -48,7 +48,15 @@ local function dhcp_leases_common(family)
fd:close()
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
while true do
local ln = fd:read("*l")