diff options
Diffstat (limited to 'applications/luci-app-splash/luasrc')
-rw-r--r-- | applications/luci-app-splash/luasrc/controller/splash/splash.lua | 11 | ||||
-rw-r--r-- | applications/luci-app-splash/luasrc/view/admin_status/splash.htm | 11 |
2 files changed, 17 insertions, 5 deletions
diff --git a/applications/luci-app-splash/luasrc/controller/splash/splash.lua b/applications/luci-app-splash/luasrc/controller/splash/splash.lua index 97d0400822..a41015ea1a 100644 --- a/applications/luci-app-splash/luasrc/controller/splash/splash.lua +++ b/applications/luci-app-splash/luasrc/controller/splash/splash.lua @@ -25,9 +25,18 @@ end function action_dispatch() local uci = luci.model.uci.cursor_state() - local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR")) or "" + local ipc = require "luci.ip" + + local i, n + local mac = "" local access = false + for i, n in ipairs(ipc.neighbors()) do + if n.mac and n.dest and n.dest:equal(luci.http.getenv("REMOTE_ADDR")) then + mac = n.mac + end + end + uci:foreach("luci_splash", "lease", function(s) if s.mac and s.mac:lower() == mac then access = true end end) diff --git a/applications/luci-app-splash/luasrc/view/admin_status/splash.htm b/applications/luci-app-splash/luasrc/view/admin_status/splash.htm index 67bb2fc49e..831fa75f65 100644 --- a/applications/luci-app-splash/luasrc/view/admin_status/splash.htm +++ b/applications/luci-app-splash/luasrc/view/admin_status/splash.htm @@ -9,6 +9,7 @@ local utl = require "luci.util" local ipt = require "luci.sys.iptparser".IptParser() local uci = require "luci.model.uci".cursor_state() local wat = require "luci.tools.webadmin" +local ipc = require "luci.ip" local fs = require "nixio.fs" local clients = { } @@ -100,10 +101,12 @@ if fs.access(leasefile) then end end -for i, a in ipairs(luci.sys.net.arptable()) do - local c = clients[a["HW address"]:lower()] - if c and not c.ip then - c.ip = a["IP address"] +for i, n in ipairs(ipc.neighbors({ family = 4 })) do + if n.mac and n.dest then + local c = clients[n.mac] + if c and not c.ip then + c.ip = n.dest:string() + end end end |