Merge pull request #706 from KevinOConnor/anonidentity-20160407
[project/luci.git] / modules / luci-base / luasrc / tools / status.lua
index 0efc51b..a1ecbe7 100644 (file)
@@ -1,15 +1,5 @@
---[[
-LuCI - Lua Configuration Interface
-
-Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-]]--
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
 
 module("luci.tools.status", package.seeall)
 
@@ -18,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)
@@ -58,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")
@@ -130,7 +128,9 @@ function wifi_networks()
                                assoclist  = net:assoclist(),
                                country    = net:country(),
                                txpower    = net:txpower(),
-                               txpoweroff = net:txpower_offset()
+                               txpoweroff = net:txpower_offset(),
+                               disabled   = (dev:get("disabled") == "1" or
+                                            net:get("disabled") == "1")
                        }
                end