- [ "$LIMIT_UP" -gt 0 -a "$LIMIT_DOWN" -gt 0 ] && {
- iptables -t mangle -N luci_splash_mark_out
- iptables -t mangle -N luci_splash_mark_in
- iptables -t mangle -I PREROUTING -j luci_splash_mark_out
- iptables -t mangle -I POSTROUTING -j luci_splash_mark_in
+ $IPT -t mangle -N luci_splash_mark_out
+ $IPT -t mangle -N luci_splash_mark_in
+ $IPT -t mangle -I PREROUTING -j luci_splash_mark_out
+ $IPT -t mangle -I POSTROUTING -j luci_splash_mark_in
+
+ if [ "$HAS_IPV6" = 1 ]; then
+ $IPT6 -t mangle -N luci_splash_mark_out
+ $IPT6 -t mangle -N luci_splash_mark_in
+ $IPT6 -t mangle -I PREROUTING -j luci_splash_mark_out
+ $IPT6 -t mangle -I POSTROUTING -j luci_splash_mark_in
+ fi
+
+ ### Build the main and portal rule
+ config_foreach iface_add iface
+ config_foreach subnet_add subnet
+
+ ### Add the community homepage to the list of allowed destination subnets
+ hp=$(uci -q get freifunk.community.homepage) && {
+ chp=${hp#http*://}
+ chp=${chp%%/*}
+ $IPT -t nat -I luci_splash_prerouting -d "${chp}/32" -j RETURN
+ $IPT -t filter -I luci_splash_forwarding -d "${chp}/32" -j RETURN