Complete firewall in case of network defined in rules

This commit is contained in:
2023-03-08 20:53:13 +00:00
parent 05aacbba3c
commit 7cce2b5394

View File

@@ -400,6 +400,11 @@ else
IPTABLES_OPTIONS=""
GREP_OPTIONS=""
if [ "$SOURCE_IP" != "" ]; then
if [ "$(echo $SOURCE_IP | cut -d . -f4)" == "0" ]; then
SOURCE_IP="$(echo $SOURCE_IP | cut -d . -f1-3).0/24";
fi
IPTABLES_OPTIONS=$IPTABLES_OPTIONS" -s $SOURCE_IP";
GREP_OPTIONS=$GREP_OPTIONS"|grep -e $SOURCE_IP";
@@ -410,6 +415,11 @@ else
fi
if [ "$TARGET_IP" != "" ]; then
if [ "$(echo $TARGET_IP | cut -d . -f4)" == "0" ]; then
TARGET_IP="$(echo $TARGET_IP | cut -d . -f1-3).0/24";
fi
IPTABLES_OPTIONS=$IPTABLES_OPTIONS" -d $TARGET_IP";
GREP_OPTIONS=$GREP_OPTIONS"|grep -e $TARGET_IP";