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 local ip = luci.ip.IPv4((client:getpeername()))
21 local function find_srv(section)
22 if section.ipaddr then
23 local net = luci.ip.IPv4(section.ipaddr, section.netmask)
24 if ip and net and net:contains(ip) then
31 uci:foreach("network", "interface", find_srv)
32 uci:foreach("network", "alias", find_srv)
35 client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
36 (arg[2] or "/luci/splash") .. "\r\n\r\n")