From 746216b251f03be05ca7af837910d874984097b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ber=C3=A9nyi=20Gy=C3=B6rgy?= Date: Tue, 15 Feb 2022 16:14:21 +0000 Subject: [PATCH] Checking COUNTER variables if their value are zero, chnaging to one. --- firewall/firewall-add | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firewall/firewall-add b/firewall/firewall-add index 1dcdbc6..6ffacd5 100755 --- a/firewall/firewall-add +++ b/firewall/firewall-add @@ -84,21 +84,25 @@ COUNT_SOURCE_PORT=$(set |grep SOURCE_PORT |wc -l) COUNT_TARGET_IP=$(set |grep TARGET_IP |wc -l) COUNT_TARGET_PORT=$(set |grep TARGET_PORT |wc -l) +if [ "$COUNT_SOURCE_IP" == 0 ] ; then COUNT_SOURCE_IP=1 ; fi for source_ip_index in $(seq 1 $COUNT_SOURCE_IP) ; do if set |grep SOURCE_IP_ ; then SOURCE_IP=$(eval "echo \${"SOURCE_IP_$source_ip_index"}") fi - + + if [ "$COUNT_SOURCE_PORT" == 0 ] ; then COUNT_SOURCE_PORT=1 ; fi for source_port_index in $(seq 1 $COUNT_SOURCE_PORT) ; do if set |grep SOURCE_PORT_ ; then SOURCE_PORT=$(eval "echo \${"SOURCE_PORT_$source_port_index"}") fi + if [ "$COUNT_TARGET_IP" == 0 ] ; then COUNT_TARGET_IP=1 ; fi for target_ip_index in $(seq 1 $COUNT_TARGET_IP) ; do if set |grep TARGET_IP_ ; then TARGET_IP=$(eval "echo \${"TARGET_IP_$target_ip_index"}") fi + if [ "$COUNT_TARGET_PORT" == 0 ] ; then COUNT_TARGET_PORT=1 ; fi for target_port_index in $(seq 1 $COUNT_TARGET_PORT) ; do if set |grep TARGET_PORT_ ; then TARGET_PORT=$(eval "echo \${"TARGET_PORT_$target_port_index"}")