1 #!/bin/sh /etc/rc.common
7 config_get zone "$cfg" zone
8 [ -n "$zone" ] || return 0
10 config_get gw "$cfg" gateway
11 [ -n "$gw" ] || return 0
13 iptables -t nat -A zone_${zone}_prerouting -j luci_splash_portal
17 iptables -t nat -A luci_splash_portal -d "$i" -p tcp -m multiport --dports 22,80,443 -j RETURN
24 config_get mac "$cfg" mac
25 [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j DROP
31 config_get mac "$cfg" mac
32 [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j RETURN
36 ### Read chains from config
39 config_load luci_splash
42 iptables -t nat -N luci_splash
43 iptables -t nat -N luci_splash_portal
44 iptables -t nat -N luci_splash_leases
46 ### Build the main and portal rule
47 config_foreach blacklist_add blacklist
48 config_foreach whitelist_add whitelist
49 config_foreach iface_add iface
51 ### Build the portal rule
52 iptables -t nat -A luci_splash_portal -p udp --dport 53 -j RETURN
53 iptables -t nat -A luci_splash_portal -j luci_splash_leases
55 ### Build the leases rule
56 iptables -t nat -A luci_splash_leases -p tcp --dport 80 -j REDIRECT --to-ports 8082
57 iptables -t nat -A luci_splash_leases -j DROP
59 ### Start the splash httpd
60 start-stop-daemon -S -b -q -x /usr/bin/luci-splashd
65 iptables -t nat -F luci_splash_leases
66 iptables -t nat -F luci_splash_portal
67 iptables -t nat -F luci_splash
70 iptables -t nat -X luci_splash_leases
71 iptables -t nat -X luci_splash_portal
72 iptables -t nat -X luci_splash