summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/ffluci-splash/src/luci_splash.init
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-04-27 11:06:07 +0000
committerSteven Barth <steven@midlink.org>2008-04-27 11:06:07 +0000
commitace012a0325a4ad2249b137a0d7c7edcc2a71f54 (patch)
tree71051f83388ea5a5092f86f13e3bd6aa4a519591 /contrib/package/ffluci-splash/src/luci_splash.init
parent706da44cf275dc20426a55a4d01ed79026d3eb80 (diff)
Diffstat (limited to 'contrib/package/ffluci-splash/src/luci_splash.init')
-rw-r--r--contrib/package/ffluci-splash/src/luci_splash.init88
1 files changed, 0 insertions, 88 deletions
diff --git a/contrib/package/ffluci-splash/src/luci_splash.init b/contrib/package/ffluci-splash/src/luci_splash.init
deleted file mode 100644
index a7bb4abeb4..0000000000
--- a/contrib/package/ffluci-splash/src/luci_splash.init
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh /etc/rc.common
-START=70
-
-iface_add() {
- local cfg="$1"
-
- config_get net "$cfg" network
- [ -n "$net" ] || return 0
-
- config_get iface "$net" ifname
- [ -n "$iface" ] || return 0
- iface="${iface%%:*}"
-
- config_get ipaddr "$net" ipaddr
- [ -n "$ipaddr" ] || return 0
-
- config_get netmask "$net" netmask
- [ -n "$netmask" ] || return 0
-
- eval "$(ipcalc.sh $ipaddr $netmask)"
-
- iptables -t nat -A luci_splash -i "$iface" -s "$IP/$PREFIX" -j luci_splash_portal
- iptables -t nat -A luci_splash_portal -i "$iface" -s "$IP/$PREFIX" -d "$ipaddr" -p tcp --dport 80 -j RETURN
-}
-
-blacklist_add() {
- local cfg="$1"
-
- config_get mac "$cfg" mac
- [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j DROP
-}
-
-whitelist_add() {
- local cfg="$1"
-
- config_get mac "$cfg" mac
- [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j RETURN
-}
-
-start() {
- ### Read chains from config
- include /lib/network
- scan_interfaces
- config_load luci_splash
-
- ### Create subchains
- iptables -t nat -N luci_splash
- iptables -t nat -N luci_splash_portal
- iptables -t nat -N luci_splash_leases
-
- ### Build the main and portal rule
- config_foreach blacklist_add blacklist
- config_foreach whitelist_add whitelist
- config_foreach iface_add iface
-
- ### Build the portal rule
- iptables -t nat -A luci_splash_portal -p udp --dport 53 -j RETURN
- iptables -t nat -A luci_splash_portal -j luci_splash_leases
-
- ### Build the leases rule
- iptables -t nat -A luci_splash_leases -p tcp --dport 80 -j REDIRECT --to-ports 8082
- iptables -t nat -A luci_splash_leases -j DROP
-
- ### Start the splash httpd
- httpd -c /etc/luci_splash_httpd.conf -p 8082 -h /usr/lib/luci-splash/htdocs
-
- ### Sync leases
- /usr/lib/luci-splash/sync.lua
-
- ### Hook in the chain
- iptables -t nat -A prerouting_rule -j luci_splash
-}
-
-stop() {
- ### Hook out the chain
- iptables -t nat -D prerouting_rule -j luci_splash
-
- ### Clear subchains
- iptables -t nat -F luci_splash_leases
- iptables -t nat -F luci_splash_portal
- iptables -t nat -F luci_splash
-
- ### Delete subchains
- iptables -t nat -X luci_splash_leases
- iptables -t nat -X luci_splash_portal
- iptables -t nat -X luci_splash
-}
-