applications/luci-splash: implement alias interface support in luci-splashd
This commit is contained in:
parent
b6406c3980
commit
593bc2df7b
1 changed files with 15 additions and 11 deletions
|
@ -16,9 +16,10 @@ while true do
|
||||||
if client then
|
if client then
|
||||||
client:settimeout(1)
|
client:settimeout(1)
|
||||||
local srv
|
local srv
|
||||||
|
print (client:getpeername())
|
||||||
local ip = luci.ip.IPv4((client:getpeername()))
|
local ip = luci.ip.IPv4((client:getpeername()))
|
||||||
uci:foreach("network", "interface",
|
|
||||||
function (section)
|
local function find_srv(section)
|
||||||
if section.ipaddr then
|
if section.ipaddr then
|
||||||
local net = luci.ip.IPv4(section.ipaddr, section.netmask)
|
local net = luci.ip.IPv4(section.ipaddr, section.netmask)
|
||||||
if ip and net and net:contains(ip) then
|
if ip and net and net:contains(ip) then
|
||||||
|
@ -26,7 +27,10 @@ while true do
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
uci:foreach("network", "interface", find_srv)
|
||||||
|
uci:foreach("network", "alias", find_srv)
|
||||||
|
|
||||||
client:receive()
|
client:receive()
|
||||||
client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
|
client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
|
||||||
|
|
Loading…
Reference in a new issue