summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-core
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-01-17 15:46:56 +0000
committerSteven Barth <steven@midlink.org>2014-01-17 15:46:56 +0000
commit493b7d4ee9325c1e9e36481123ed6112a4a6bd07 (patch)
tree21e56bd440c6ff45abbd39dcb622a7891fcc6afe /modules/admin-core
parentecbd62be125d4da8f521f5bb3b6c92593cb19764 (diff)
Adapt IPv6 interface to new architecture
Diffstat (limited to 'modules/admin-core')
-rw-r--r--modules/admin-core/luasrc/tools/status.lua58
1 files changed, 29 insertions, 29 deletions
diff --git a/modules/admin-core/luasrc/tools/status.lua b/modules/admin-core/luasrc/tools/status.lua
index becd7d4659..27bc925bd2 100644
--- a/modules/admin-core/luasrc/tools/status.lua
+++ b/modules/admin-core/luasrc/tools/status.lua
@@ -58,6 +58,34 @@ local function dhcp_leases_common(family)
fd:close()
end
+ local fd = io.open("/tmp/hosts/odhcpd", "r")
+ if fd then
+ while true do
+ local ln = fd:read("*l")
+ if not ln then
+ break
+ else
+ local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (%d+) (%S+) (%S+) (.*)")
+ if ip and iaid ~= "ipv4" and family == 6 then
+ rv[#rv+1] = {
+ expires = os.difftime(tonumber(ts) or 0, os.time()),
+ duid = duid,
+ ip6addr = ip,
+ hostname = (name ~= "-") and name
+ }
+ elseif ip and iaid == "ipv4" and family == 4 then
+ rv[#rv+1] = {
+ expires = os.difftime(tonumber(ts) or 0, os.time()),
+ macaddr = duid,
+ ipaddr = ip,
+ hostname = (name ~= "-") and name
+ }
+ end
+ end
+ end
+ fd:close()
+ end
+
return rv
end
@@ -66,35 +94,7 @@ function dhcp_leases()
end
function dhcp6_leases()
- local nfs = require "nixio.fs"
- local leasefile = "/tmp/hosts/6relayd"
- local rv = {}
-
- if nfs.access(leasefile, "r") then
- local fd = io.open(leasefile, "r")
- if fd then
- while true do
- local ln = fd:read("*l")
- if not ln then
- break
- else
- local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (%d+) (%S+) (%S+) (.*)")
- if ip then
- rv[#rv+1] = {
- expires = os.difftime(tonumber(ts) or 0, os.time()),
- duid = duid,
- ip6addr = ip,
- hostname = (name ~= "-") and name
- }
- end
- end
- end
- fd:close()
- end
- return rv
- elseif luci.sys.call("dnsmasq --version 2>/dev/null | grep -q ' DHCPv6 '") == 0 then
- return dhcp_leases_common(6)
- end
+ return dhcp_leases_common(6)
end
function wifi_networks()