19,6 → 19,7 |
private_ip_mask=${private_ip_mask:=192.168.182.1/24} |
PRIVATE_IP=`echo $private_ip_mask |cut -d"/" -f1` |
PRIVATE_IP=${PRIVATE_IP:=192.168.182.1} |
MULTIWAN=`grep ^MULTIWAN= $CONF_FILE|cut -d"=" -f2` |
current_users_file="/tmp/current_users.txt" # file containing active users with their "status.php" tab open |
DIR_WEB="/var/www/html" |
Index_Page="$DIR_WEB/index.php" |
48,7 → 49,7 |
;; |
esac |
net_pb=`grep "network_pb = true;" $Index_Page|wc -l` |
if [ $net_pb = "0" ] # user alert (only the first time) |
if [ $net_pb = "0" ] # if previously up |
then |
/bin/sed -i "s?^\$network_pb.*?\$network_pb = true;?g" $Index_Page |
$IPTABLES -I PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56 |
78,6 → 79,8 |
then |
systemctl restart network |
else |
if [ "$MULTIWAN" == "off" ] || [ "$MULTIWAN" == "Off" ] |
then |
IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3` |
arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2` |
if [ $arp_reply -eq "0" ] |
86,6 → 89,7 |
fi |
fi |
fi |
fi |
# DNS request testing (twice) |
if [ $LAN_DOWN -eq "0" ] |
then |
106,7 → 110,7 |
else |
echo "Internet access is OK for now" |
net_pb=`grep "network_pb = true;" $Index_Page|wc -l` |
if [ $net_pb != "0" ] |
if [ $net_pb != "0" ] # if already down |
then |
/bin/sed -i "s?^\$network_pb.*?\$network_pb = false;?g" $Index_Page |
$IPTABLES -D PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56 |