From: Thomas Lamprecht Date: Tue, 2 May 2017 09:51:22 +0000 (+0200) Subject: pvecm add: fix #1369 - re-allow using hostnames for ringX_addr X-Git-Url: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff_plain;h=9d69040c5a5cd5ad29380dc9ce5b9234cbe14fd3 pvecm add: fix #1369 - re-allow using hostnames for ringX_addr If an user passed a hostname as ring0_addr or ring1_addr the check_ip checked failed as it implicitly assumed IPs even if we allowed a general address (i.e. IP or hostname) as a format for those properties. Fixes: #1369 Reported here: https://forum.proxmox.com/threads/34342/ Signed-off-by: Thomas Lamprecht --- diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm index 4366066..e33a311 100755 --- a/data/PVE/CLI/pvecm.pm +++ b/data/PVE/CLI/pvecm.pm @@ -540,6 +540,15 @@ __PACKAGE__->register_method ({ my $check_ip = sub { my $ip = shift; if (defined($ip)) { + if (!PVE::JSONSchema::pve_verify_ip($ip, 1)) { + my $host = $ip; + eval { $ip = PVE::Network::get_ip_from_hostname($host); }; + if ($@) { + &$error("cannot use '$host': $@\n") ; + return; + } + } + my $cidr = (Net::IP::ip_is_ipv6($ip)) ? "$ip/128" : "$ip/32"; my $configured_ips = PVE::Network::get_local_ip_from_cidr($cidr);