Modifying source or target IP addresses in case of POSTROUTING rules is applied

This commit is contained in:
2022-05-16 09:05:26 +00:00
parent 6da9d2efd0
commit dd0ffa2d56

View File

@@ -39,6 +39,17 @@ elif [[ "$(echo $SOURCE_IP | cut -d . -f4)" == "0" ]] ; then
SOURCE_IP="$SOURCE_IP/24";
debug "source ip is $SOURCE_IP"
# Modifying source or target IP addresses if POSTROUTING rules needed to applied
elif [[ ! -z "$POSTROUTING" ]]; then
if [[ ! -z "$SOURCE_IP" ]]; then
SOURCE_IP="$(echo $SOURCE_IP | cut -d . -f1-3).0/24";
debug "source ip is $SOURCE_IP"
fi
if [[ ! -z "$TARGET_IP" ]]; then
TARGET_IP="$(echo $TARGET_IP | cut -d . -f1-3).0/24";
debug "target ip is $TARGET_IP"
fi
fi;
if [[ -z "$TARGET_IP" ]]; then