4 require("luci.model.uci")
6 luci.model.uci.set_savedir(luci.model.uci.savedir_state)
10 local ip = os.getenv("REMOTE_ADDR")
11 luci.model.uci.foreach("network", "interface",
13 if section.ipaddr then
14 local p = luci.sys.net.mask4prefix(section.netmask)
15 if luci.sys.net.belongs(ip, section.ipaddr, p) then
16 net = section[".name"]
24 luci.model.uci.foreach("luci_splash", "iface",
26 if section.network == net then
32 print("Content-Type: text/plain\n")
33 print("Unable to detect network settings!")
35 print("Status: 302 Found")
36 print("Location: http://" .. srv)
38 local action = "splash"
40 local mac = luci.sys.net.ip4mac(ip)
45 local status = luci.sys.execl("luci-splash status "..mac)[1]
47 if status == "whitelisted" or status == "lease" then
51 print("Status: 302 Found")
52 print("Location: http://" .. srv .. "/cgi-bin/luci-splash/" .. action)