5 require("luci.model.uci")
7 local uci = luci.model.uci.cursor_state()
10 local server = socket.bind("0.0.0.0", arg[1] or 8082)
11 server:settimeout(0, "t")
14 local client = server:accept()
19 print (client:getpeername())
20 local ip = luci.ip.IPv4((client:getpeername()))
22 local function find_srv(section)
23 if section.ipaddr then
24 local net = luci.ip.IPv4(section.ipaddr, section.netmask)
25 if ip and net and net:contains(ip) then
32 uci:foreach("network", "interface", find_srv)
33 uci:foreach("network", "alias", find_srv)
36 client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
37 (arg[2] or "/luci/splash") .. "\r\n\r\n")