diff --git a/firewall/firewall-add b/firewall/firewall-add index 785d3da..a015d1f 100755 --- a/firewall/firewall-add +++ b/firewall/firewall-add @@ -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