summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-02-19 23:09:28 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-02-19 23:09:28 +0000
commit593bc2df7bc51478def55b1fd20eb4b80a954c2d (patch)
tree6ae1083efb50f6ab790d97e52d445fbe33164d93 /applications
parentb6406c3980e472bcb05144640b2b91a119619a5b (diff)
applications/luci-splash: implement alias interface support in luci-splashd
Diffstat (limited to 'applications')
-rwxr-xr-xapplications/luci-splash/root/usr/bin/luci-splashd26
1 files changed, 15 insertions, 11 deletions
diff --git a/applications/luci-splash/root/usr/bin/luci-splashd b/applications/luci-splash/root/usr/bin/luci-splashd
index 946c6966a..c94537fbc 100755
--- a/applications/luci-splash/root/usr/bin/luci-splashd
+++ b/applications/luci-splash/root/usr/bin/luci-splashd
@@ -16,17 +16,21 @@ while true do
if client then
client:settimeout(1)
local srv
- local ip = luci.ip.IPv4((client:getpeername()))
- uci:foreach("network", "interface",
- function (section)
- if section.ipaddr then
- local net = luci.ip.IPv4(section.ipaddr, section.netmask)
- if ip and net and net:contains(ip) then
- srv = section.ipaddr
- return
- end
- end
- end)
+ print (client:getpeername())
+ local ip = luci.ip.IPv4((client:getpeername()))
+
+ local function find_srv(section)
+ if section.ipaddr then
+ local net = luci.ip.IPv4(section.ipaddr, section.netmask)
+ if ip and net and net:contains(ip) then
+ srv = section.ipaddr
+ return
+ end
+ end
+ end
+
+ uci:foreach("network", "interface", find_srv)
+ uci:foreach("network", "alias", find_srv)
client:receive()
client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..