+ [ -n "$mac" ] && {
+ iptables -t filter -I luci_splash_counter -m mac --mac-source "$mac" -j RETURN
+ iptables -t nat -I luci_splash_leases -m mac --mac-source "$mac" -j RETURN
+ }
+}
+
+lease_add() {
+ local cfg="$1"
+
+ config_get mac "$cfg" mac
+ config_get ban "$cfg" kicked
+
+ ban=${ban:+DROP}
+
+ [ -n "$mac" ] && {
+ local oIFS="$IFS"; IFS=":"
+ set -- $mac
+ IFS="$oIFS"; unset oIFS
+
+ local mac_pre="$1$2"
+ local mac_post="$3$4$5$6"
+ local handle="$6"
+
+ iptables -t filter -I luci_splash_counter -m mac --mac-source "$mac" -j RETURN
+ iptables -t mangle -I luci_splash_mark -m mac --mac-source "$mac" -j MARK --set-mark 79
+ iptables -t nat -I luci_splash_leases -m mac --mac-source "$mac" -j "${ban:-RETURN}"
+
+ for i in $SPLASH_INTERFACES; do
+ tc filter add dev $i parent 77:0 protocol ip prio 2 handle ::$handle u32 \
+ match u16 0x0800 0xFFFF at -2 match u32 0x$mac_post 0xFFFFFFFF at -12 \
+ match u16 0x$mac_pre 0xFFFF at -14 flowid 77:10
+ done
+ }
+}
+
+qos_iface_add() {
+ local iface="$1"
+
+ # 77 -> download root qdisc
+ # 78 -> upload root qdisc
+ # 79 -> fwmark
+
+ silent tc qdisc del dev "$iface" root handle 77:
+
+ if [ "$LIMIT_UP" -gt 0 -a "$LIMIT_DOWN" -gt 0 ]; then
+ tc qdisc add dev "$iface" root handle 77: htb
+
+ # assume maximum rate of 20.000 kilobit for wlan
+ tc class add dev "$iface" parent 77: classid 77:1 htb rate 20000kbit
+
+ # set download limit and burst
+ tc class add dev "$iface" parent 77:1 classid 77:10 htb \
+ rate ${LIMIT_DOWN}kbit ceil ${LIMIT_DOWN_BURST}kbit prio 2
+
+ tc qdisc add dev "$iface" parent 77:10 handle 78: sfq perturb 10
+
+ # adding ingress can result in "File exists" if qos-scripts are active
+ silent tc qdisc add dev "$iface" ingress
+
+ # 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
+}
+
+qos_iface_del() {
+ local iface="$1"
+
+ silent tc qdisc del dev "$iface" root handle 77:
+ silent tc qdisc del dev "$iface" root handle 78:
+ silent tc filter del dev "$iface" parent ffff: protocol ip prio 1 handle 79 fw
+}
+
+boot() {
+ ### Setup splash-relay
+ uci get lucid.splashr || {
+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
+EOF
+ }
+
+ ### We are started by the firewall include
+ exit 0