summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-splash/luasrc/controller
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-01-22 21:52:04 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-22 21:57:00 +0100
commitfac02283137f6ff59363695bb07a3f9cec58e577 (patch)
tree5c3c00701d39cabc86858d270d159ffb08aa52a5 /applications/luci-app-splash/luasrc/controller
parentb24dfd52ac4e45741bfe5049bf0f2e863ffffad2 (diff)
luci-app-splash: convert luci.sys.net.arptable() to luci.ip.neighbors()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-splash/luasrc/controller')
-rw-r--r--applications/luci-app-splash/luasrc/controller/splash/splash.lua11
1 files changed, 10 insertions, 1 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)