Skip to content

Commit 55c4954

Browse files
committed
Change if condition for checking the main ip to resolve always true.
1 parent a521c3c commit 55c4954

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/v-delete-sys-ip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ is_ip_key_empty '$U_SYS_USERS'
3838
# Import ip variables
3939
source $HESTIA/data/ips/$ip
4040
cidr=$(convert_netmask $NETMASK)
41+
main_ip=$(hostname -i)
4142

4243
# Checking main ip on the interface
4344
interface=$(/sbin/ip addr | grep "$ip/$cidr" | awk '{print $NF}')
44-
if [ ! -z "$interface" ] && [ -z "$(echo $interface |cut -s -f2 -d :)" ]; then
45+
if [ ! -z "$interface" ] && [ "$ip" = "$main_ip" ]; then
4546
echo "Error: can't delete main IP address"
4647
log_event "$E_FORBIDEN" "$ARGUMENTS"
4748
exit $E_FORBIDEN

0 commit comments

Comments
 (0)