applications/luci-splash: Minor Fixes
[project/luci.git] / applications / luci-splash / root / etc / init.d / luci_splash
old mode 100644 (file)
new mode 100755 (executable)
index 20f7865..02fdd8b
@@ -4,23 +4,18 @@ START=70
 iface_add() {
        local cfg="$1"
        
-       config_get net "$cfg" network
-       [ -n "$net" ] || return 0
+       config_get zone "$cfg" zone
+       [ -n "$zone" ] || return 0
        
-       config_get iface "$net" ifname
-       [ -n "$iface" ] || return 0
-       iface="${iface%%:*}"
+       config_get gw "$cfg" gateway
+       [ -n "$gw" ] || return 0
        
-       config_get ipaddr "$net" ipaddr
-       [ -n "$ipaddr" ] || return 0
+       iptables -t nat -A zone_$zone_prerouting -j luci_splash_portal
        
-       config_get netmask "$net" netmask
-       [ -n "$netmask" ] || return 0
-       
-       eval "$(ipcalc.sh $ipaddr $netmask)"
-       
-       iptables -t nat -A luci_splash -i "$iface" -s "$NETWORK/$PREFIX" -j luci_splash_portal
-       iptables -t nat -A luci_splash_portal -i "$iface" -s "$NETWORK/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN
+       for i in $gw
+       do
+               iptables -t nat -A luci_splash_portal -d "$i" -p tcp -m multiport --dports 22,80,443 -j RETURN
+       done
 }
 
 blacklist_add() {
@@ -62,16 +57,10 @@ start() {
        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
-       
-       ### Hook in the chain
-       iptables -t nat -A prerouting_rule -j luci_splash
+       start-stop-daemon -S -b -q -x /usr/bin/luci-splashd
 }
 
-stop() {
-       ### Hook out the chain
-       iptables -t nat -D prerouting_rule -j luci_splash
-       
+stop() {       
        ### Clear subchains
        iptables -t nat -F luci_splash_leases
        iptables -t nat -F luci_splash_portal