summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-splash/luasrc/controller/splash
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-30 22:38:46 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-30 22:38:46 +0000
commit6a2bb359fdb3bb6a2a2545f46d70e83d608ca49b (patch)
treebc59f0666e4c6c36ec9159e718fabfe9b4eeee3a /applications/luci-splash/luasrc/controller/splash
parente96429a425d9eb2a2021e77cda0a93a54c064fee (diff)
applications/luci-splash: properly fix mac address detection in mixed IPv4/IPv6 environments (thanks stargieg)
Diffstat (limited to 'applications/luci-splash/luasrc/controller/splash')
-rw-r--r--applications/luci-splash/luasrc/controller/splash/splash.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/applications/luci-splash/luasrc/controller/splash/splash.lua b/applications/luci-splash/luasrc/controller/splash/splash.lua
index 5731efc8ca..8603b141fa 100644
--- a/applications/luci-splash/luasrc/controller/splash/splash.lua
+++ b/applications/luci-splash/luasrc/controller/splash/splash.lua
@@ -19,7 +19,8 @@ function action_dispatch()
end
function action_activate()
- local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR"))
+ local ip = luci.http.getenv("REMOTE_ADDR") or "127.0.0.1"
+ local mac = luci.sys.net.ip4mac(ip:match("^[\[::ffff:]*(%d+.%d+%.%d+%.%d+)\]*$"))
if mac and luci.http.formvalue("accept") then
os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
luci.http.redirect(luci.model.uci.cursor():get("freifunk", "community", "homepage"))