this should not be a real problem yet, but the perl keys hash pseudo
random order was an issue way to often to bet on that..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
my ($cidr) = @_;
my $IPs = {};
my ($cidr) = @_;
my $IPs = {};
run_command(['/sbin/ip', 'address', 'show', 'to', $cidr, 'up'], outfunc => sub {
if ($_[0] =~ m!^\s*inet(?:6)?\s+($PVE::Tools::IPRE)(?:/\d+|\s+peer\s+)!) {
run_command(['/sbin/ip', 'address', 'show', 'to', $cidr, 'up'], outfunc => sub {
if ($_[0] =~ m!^\s*inet(?:6)?\s+($PVE::Tools::IPRE)(?:/\d+|\s+peer\s+)!) {
+ $IPs->{$1} = $i++ if !exists($IPs->{$1});
- return [ keys %{$IPs} ];
+ return [ sort { $IPs->{$a} <=> $IPs->{$b} } keys %{$IPs} ];