Filter when not all the variables exist for prerouting rulesx
This commit is contained in:
@@ -244,6 +244,11 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
prerouting() {
|
prerouting() {
|
||||||
|
if [ "$SOURCE_IP" != "" ]; then
|
||||||
|
if [ "$SOURCE_PORT" != "" ]; then
|
||||||
|
if [ "$TARGET_IP" != "" ]; then
|
||||||
|
if [ "$TARGET_PORT" != "" ]; then
|
||||||
|
|
||||||
LINES=$($IPTABLES -w -L --line-number -n | grep DNAT | grep $SOURCE_PORT |grep $TARGET_IP |grep $TARGET_PORT |grep $COMMENT | awk '{print $1}'| tac)
|
LINES=$($IPTABLES -w -L --line-number -n | grep DNAT | grep $SOURCE_PORT |grep $TARGET_IP |grep $TARGET_PORT |grep $COMMENT | awk '{print $1}'| tac)
|
||||||
debug "Previous prerouting lines: "$LINES
|
debug "Previous prerouting lines: "$LINES
|
||||||
# DELETE UNECESSARY LINES FROM PREVIOUS RULES
|
# DELETE UNECESSARY LINES FROM PREVIOUS RULES
|
||||||
@@ -257,6 +262,10 @@ prerouting() {
|
|||||||
|
|
||||||
debug "$IPTABLES -I PREROUTING -d $SOURCE_IP -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment $COMMENT -j DNAT --to $TARGET_IP:$TARGET_PORT"
|
debug "$IPTABLES -I PREROUTING -d $SOURCE_IP -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment $COMMENT -j DNAT --to $TARGET_IP:$TARGET_PORT"
|
||||||
$IPTABLES -w -I PREROUTING -d $SOURCE_IP -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment "$COMMENT" -j DNAT --to $TARGET_IP:$TARGET_PORT
|
$IPTABLES -w -I PREROUTING -d $SOURCE_IP -p $PROTOCOL --dport $SOURCE_PORT -m comment --comment "$COMMENT" -j DNAT --to $TARGET_IP:$TARGET_PORT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
postrouting() {
|
postrouting() {
|
||||||
|
Reference in New Issue
Block a user