Check TARGET IP and TARGET PORT exist

This commit is contained in:
2023-04-27 12:05:27 +00:00
parent c57549e032
commit 46fde8a19f

View File

@@ -248,9 +248,10 @@ fi
prerouting() { prerouting() {
if [ "$(set |grep -w SOURCE_IFACE)" != "" ]; then if [ "$(set |grep -w SOURCE_IFACE)" != "" ]; then
if [ "$TARGET_IP" != "" ] && [ "$TARGET_PORT" != "" ] ; then
debug "$IPTABLES -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment $COMMENT -j DNAT --to $TARGET_IP:$TARGET_PORT" debug "$IPTABLES -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment $COMMENT -j DNAT --to $TARGET_IP:$TARGET_PORT"
$IPTABLES -w -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment "$COMMENT" -j DNAT --to $TARGET_IP:$TARGET_PORT $IPTABLES -w -I PREROUTING -i $SOURCE_IFACE -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment "$COMMENT" -j DNAT --to $TARGET_IP:$TARGET_PORT
fi
elif [ "$SOURCE_IP" != "" ]; then elif [ "$SOURCE_IP" != "" ]; then
if [ "$SOURCE_PORT" != "" ]; then if [ "$SOURCE_PORT" != "" ]; then
if [ "$TARGET_IP" != "" ]; then if [ "$TARGET_IP" != "" ]; then