summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-splash
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-28 16:58:05 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-28 16:58:05 +0000
commit28b5b2b6378ef683b1aa5d6e033d7fae2b184df5 (patch)
treea4a94944230ea1d6cf1ddc7bf03916e0514f42c1 /applications/luci-splash
parent6a48025d6816ba34b473c93c938d47015d88d613 (diff)
applications/luci-splash: make it work with uhttpd
Diffstat (limited to 'applications/luci-splash')
-rwxr-xr-xapplications/luci-splash/htdocs/cgi-bin/splash/splash.sh3
-rwxr-xr-xapplications/luci-splash/root/etc/init.d/luci_splash48
2 files changed, 25 insertions, 26 deletions
diff --git a/applications/luci-splash/htdocs/cgi-bin/splash/splash.sh b/applications/luci-splash/htdocs/cgi-bin/splash/splash.sh
new file mode 100755
index 000000000..c9d614bf1
--- /dev/null
+++ b/applications/luci-splash/htdocs/cgi-bin/splash/splash.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo -en "Status: 302 Moved\r\n"
+echo -en "Location: http://$SERVER_ADDR/cgi-bin/luci/splash\r\n\r\n"
diff --git a/applications/luci-splash/root/etc/init.d/luci_splash b/applications/luci-splash/root/etc/init.d/luci_splash
index 351b9b376..d6f0a3376 100755
--- a/applications/luci-splash/root/etc/init.d/luci_splash
+++ b/applications/luci-splash/root/etc/init.d/luci_splash
@@ -24,29 +24,29 @@ ipt_log() {
iface_add() {
local cfg="$1"
-
+
config_get zone "$cfg" zone
[ -n "$zone" ] || return 0
-
+
config_get net "$cfg" network
[ -n "$net" ] || return 0
config_get ifname "$net" ifname
[ -n "$ifname" ] || return 0
-
+
config_get ipaddr "$net" ipaddr
[ -n "$ipaddr" ] || return 0
-
+
config_get netmask "$net" netmask
[ -n "$netmask" ] || return 0
-
+
config_get parentiface "$net" interface
[ -n "$parentiface" ] && {
config_get parentproto "$parentiface" proto
config_get parentipaddr "$parentiface" ipaddr
config_get parentnetmask "$parentiface" netmask
}
-
+
eval "$(ipcalc.sh $ipaddr $netmask)"
### Add interface specific chain entry rules
@@ -67,7 +67,7 @@ iface_add() {
}
iface_del() {
- config_get zone "$1" zone
+ config_get zone "$1" zone
[ -n "$zone" ] || return 0
config_get net "$1" network
@@ -92,10 +92,10 @@ mac_add() {
subnet_add() {
local cfg="$1"
-
+
config_get ipaddr "$cfg" ipaddr
config_get netmask "$cfg" netmask
-
+
[ -n "$ipaddr" ] && {
iptables -t nat -I luci_splash_prerouting -d "$ipaddr/${netmask:-32}" -j RETURN
iptables -t filter -I luci_splash_forwarding -d "$ipaddr/${netmask:-32}" -j RETURN
@@ -134,7 +134,7 @@ qos_iface_add() {
# set client upload speed
tc filter add dev "$iface" parent ffff: protocol ip prio 1 \
handle 79 fw police rate ${LIMIT_UP}kbit mtu 6k burst 6k drop
- fi
+ fi
}
qos_iface_del() {
@@ -147,20 +147,16 @@ qos_iface_del() {
boot() {
### Setup splash-relay
- uci get lucid.splashr 2>/dev/null || {
+ uci get uhttpd.splash 2>/dev/null || {
uci batch <<EOF
- set lucid.splashr=daemon
- set lucid.splashr.slave=httpd
- add_list lucid.splashr.address=8082
- add_list lucid.splashr.publisher=splashredir
- set lucid.splashr.enabled=1
-
- set lucid.splashredir=Redirector
- set lucid.splashredir.name=Splashd
- set lucid.splashredir.virtual='/'
- set lucid.splashredir.physical=':80/luci/splash'
-
- commit lucid
+ set uhttpd.splash=uhttpd
+ set uhttpd.splash.home="/www/cgi-bin/splash/"
+ set uhttpd.splash.interpreter=".sh=/bin/ash"
+ set uhttpd.splash.listen_http="8082"
+ set uhttpd.splash.index_page="splash.sh"
+ set uhttpd.splash.error_page="/splash.sh"
+
+ commit uhttpd
EOF
}
@@ -248,7 +244,7 @@ stop() {
silent iptables -t mangle -D PREROUTING -j luci_splash_mark_out
silent iptables -t mangle -D POSTROUTING -j luci_splash_mark_in
-
+
### Clear subchains
silent iptables -t nat -F luci_splash_prerouting
silent iptables -t nat -F luci_splash_leases
@@ -256,7 +252,7 @@ stop() {
silent iptables -t filter -F luci_splash_filter
silent iptables -t mangle -F luci_splash_mark_out
silent iptables -t mangle -F luci_splash_mark_in
-
+
### Delete subchains
silent iptables -t nat -X luci_splash_prerouting
silent iptables -t nat -X luci_splash_leases
@@ -264,7 +260,7 @@ stop() {
silent iptables -t filter -X luci_splash_filter
silent iptables -t mangle -X luci_splash_mark_out
silent iptables -t mangle -X luci_splash_mark_in
-
+
sed -ie '/\/usr\/sbin\/luci-splash sync/d' /var/spool/cron/crontabs/root
lock -u $LOCK