Skip to content

Commit 2f47e84

Browse files
committed
use py_captive_portal_enabled and restore captive_portal_enabled
1 parent 516daef commit 2f47e84

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

roles/network/templates/gateway/iiab-gen-iptables

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ kalite_server_port={{ kalite_server_port }}
6060
sugarizer_port={{ sugarizer_port }}
6161
block_DNS={{ block_DNS }}
6262
captive_portal_enabled={{ captive_portal_enabled }}
63+
py_captive_portal_enabled={{ py_captive_portal_enabled }}
6364

6465
echo "Lan is $lan and WAN is $wan"
6566
#
@@ -105,7 +106,7 @@ if [ "$gw_block_https" == "True" ]; then
105106
fi
106107

107108
# Allow outgoing connections from the LAN side.
108-
if ! [ "$captive_portal_enabled" == "True" ];then
109+
if ! [ "$py_captive_portal_enabled" == "True" ];then
109110
$IPTABLES -A FORWARD -i $lan -o $wan -j ACCEPT
110111
fi
111112
# Don't forward from the outside to the inside.
@@ -117,13 +118,13 @@ if [ "$block_DNS" == "True" ];then
117118
$IPTABLES -t nat -A PREROUTING -i $lan -p udp --dport 53 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:53
118119
fi
119120

120-
#if [ "$captive_portal_enabled" == "True" ];then
121-
# $IPTABLES -t mangle -N internet
122-
# $IPTABLES -t mangle -A PREROUTING -i {{ iiab_lan_iface }} -p tcp -m tcp --dport 80 -j internet
123-
# $IPTABLES -t mangle -A internet -j MARK --set-mark 99
124-
# $IPTABLES -t nat -A PREROUTING -i {{ iiab_lan_iface }} -p tcp -m mark --mark 99 -m tcp --dport 80 -j DNAT --to-destination {{ lan_ip }}:
125-
126121
if [ "$captive_portal_enabled" == "True" ];then
122+
$IPTABLES -t mangle -N internet
123+
$IPTABLES -t mangle -A PREROUTING -i {{ iiab_lan_iface }} -p tcp -m tcp --dport 80 -j internet
124+
$IPTABLES -t mangle -A internet -j MARK --set-mark 99
125+
$IPTABLES -t nat -A PREROUTING -i {{ iiab_lan_iface }} -p tcp -m mark --mark 99 -m tcp --dport 80 -j DNAT --to-destination {{ lan_ip }}
126+
127+
elif [ "py_$captive_portal_enabled" == "True" ];then
127128
$IPTABLES -t nat -A PREROUTING -i $lan -p tcp --dport 80 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:9090
128129

129130
elif [ "$HTTPCACHE_ON" == "True" ]; then

0 commit comments

Comments
 (0)