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 "$zone" ] || return 0
13 iptables -t nat -A zone_$zone_prerouting -j luci_splash_portal
14 iptables -t nat -A luci_splash_portal -d "$gw" -p tcp -m multiport --dports 22,80,443 -j RETURN
20 config_get mac "$cfg" mac
21 [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j DROP
27 config_get mac "$cfg" mac
28 [ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j RETURN
32 ### Read chains from config
35 config_load luci_splash
38 iptables -t nat -N luci_splash
39 iptables -t nat -N luci_splash_portal
40 iptables -t nat -N luci_splash_leases
42 ### Build the main and portal rule
43 config_foreach blacklist_add blacklist
44 config_foreach whitelist_add whitelist
45 config_foreach iface_add iface
47 ### Build the portal rule
48 iptables -t nat -A luci_splash_portal -p udp --dport 53 -j RETURN
49 iptables -t nat -A luci_splash_portal -j luci_splash_leases
51 ### Build the leases rule
52 iptables -t nat -A luci_splash_leases -p tcp --dport 80 -j REDIRECT --to-ports 8082
53 iptables -t nat -A luci_splash_leases -j DROP
55 ### Start the splash httpd
56 start-stop-daemon -S -b -q -x /usr/bin/luci-splashd
61 iptables -t nat -F luci_splash_leases
62 iptables -t nat -F luci_splash_portal
63 iptables -t nat -F luci_splash
66 iptables -t nat -X luci_splash_leases
67 iptables -t nat -X luci_splash_portal
68 iptables -t nat -X luci_splash