PWD=`pwd`
LOCK="${PWD}/fw-drop"
LOCK_PID="${PWD}/fw-drop/pid"
-
+IPV4F="/proc/sys/net/ipv4/ip_forward"
+IPV6F="/proc/sys/net/ipv6/conf/all/forwarding"
LOCAL=`dirname $0`;
cd $LOCAL
mkdir ${LOCK} > /dev/null 2>&1
MSL=$?
if [ "${MSL}" = "0" ]; then
- # Lock aquired (setting the pid)
+ # Lock acquired (setting the pid)
echo "$$" > ${LOCK_PID}
return;
fi
i=`expr $i + 1`;
fi
- # Sleep 1 after 10/25 interactions
- if [ "$i" = "10" -o "$i" = "25" ]; then
- sleep 1;
- fi
+ sleep $i;
i=`expr $i + 1`;
COUNT=0;
while [ 1 ]; do
+ #
+ # Looking for IPV4 and IPV6 FORWARD
+ #
+ if [ -e "$IPV4F" ]
+ then
+ IPV4KEY="$(cat "$IPV4F")"
+ else
+ IPV4KEY="0"
+ fi
+ if [ -e "$IPV6F" ]
+ then
+ IPV6KEY="$(cat "$IPV6F")"
+ else
+ IPV6KEY="0"
+ fi
+
+ if [ "$IPV4KEY" = "0" ] && [ "$IPV6KEY" = "0" ]
+ then
+ break
+ fi
+
${IPTABLES} ${ARG2}
RES=$?
if [ $RES = 0 ]; then