applications/luci-splash: fix mac address detection in mixed IPv4/IPv6 environments
This commit is contained in:
parent
aae312e759
commit
a89c1fa5d2
1 changed files with 4 additions and 1 deletions
|
@ -19,7 +19,10 @@ 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("::") and (ip:gsub("^%[::ffff:(.+)%]", "%1")) or ip
|
||||
)
|
||||
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"))
|
||||
|
|
Loading…
Reference in a new issue