summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-01-23 17:09:27 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-01-23 17:09:27 +0100
commit8d451c77c1ced9229c829af1d069fde05c436117 (patch)
tree0b6b913cbf59db7978f48ee65e8f78406579a5b2
parent63d70daae1921d9f5a92cf2221ca4f1601c78ef5 (diff)
parentf779b00d883f965e405944f3c872b5ee763836e7 (diff)
Merge pull request #629 from chris5560/master
sys.lua _nethints(): read location of dhcp.lease file from uci
-rw-r--r--modules/luci-base/luasrc/sys.lua16
-rw-r--r--modules/luci-base/luasrc/tools/status.lua2
2 files changed, 11 insertions, 7 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index a1b5b8f64..ae3565245 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -185,14 +185,18 @@ local function _nethints(what, callback)
end
end
- if fs.access("/var/dhcp.leases") then
- for e in io.lines("/var/dhcp.leases") do
- mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)")
- if mac and ip then
- _add(what, mac:upper(), ip, nil, name ~= "*" and name)
+ cur:foreach("dhcp", "dnsmasq",
+ function(s)
+ if s.leasefile and fs.access(s.leasefile) then
+ for e in io.lines(s.leasefile) do
+ mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)")
+ if mac and ip then
+ _add(what, mac:upper(), ip, nil, name ~= "*" and name)
+ end
+ end
end
end
- end
+ )
cur:foreach("dhcp", "host",
function(s)
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index 0dd092c6d..ac053eac8 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -8,7 +8,7 @@ local uci = require "luci.model.uci".cursor()
local function dhcp_leases_common(family)
local rv = { }
local nfs = require "nixio.fs"
- local leasefile = "/var/dhcp.leases"
+ local leasefile = "/tmp/dhcp.leases"
uci:foreach("dhcp", "dnsmasq",
function(s)