From a3c247ed6fb833efb1f668d0a988a2734f840255 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 17 Jun 2022 20:12:31 +0200 Subject: [PATCH] Fix remove rule with source IP on VPS FW --- openmptcprouter/files/etc/init.d/openmptcprouter-vps | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 60a2764cd..dcde475fc 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -1072,6 +1072,7 @@ _vps_firewall_close_port() { src_dport=$(echo $line | awk '{print $5}' | tr -d "\n") source_port=$(echo $line | awk '{print $6}' | tr -d "\n") source_dip=$(echo $line | awk '{print $7}' | tr -d "\n") + [ "$source_dip" = "#" ] && source_sip="" source_ip=$(echo $line | awk '{print $2}' | awk -F ":" '{print $2}' | tr -d "\n") if [ "$source_port" = "-" ]; then settings='{"name" : "router '$src_dport'","port" : "'$src_dport'","proto" : "'$proto'","fwtype" : "DNAT","source_dip": "'$source_dip'","source_ip": "'$source_ip'"}' @@ -1096,6 +1097,7 @@ _vps_firewall_close_port() { src_dport=$(echo $line | awk '{print $5}' | tr -d "\n") source_port=$(echo $line | awk '{print $6}' | tr -d "\n") source_dip=$(echo $line | awk '{print $7}' | tr -d "\n") + [ "$source_dip" = "#" ] && source_sip="" source_ip=$(echo $line | awk '{print $2}' | awk -F ":" '{print $2}' | tr -d "\n") if [ "$source_port" = "-" ]; then settings='{"name" : "router '$src_dport'","port" : "'$src_dport'","proto" : "'$proto'","fwtype" : "DNAT","ipproto" : "ipv6","source_dip": "'$source_dip'","source_ip": "'$source_ip'"}'