Commit 043b8c33 authored by Wolfgang Bumiller's avatar Wolfgang Bumiller Committed by Dietmar Maurer

PVE::API2::Ceph: network_interfaces update + ipv6

parent f01ad0c5
......@@ -765,16 +765,18 @@ __PACKAGE__->register_method ({
my $find_node_ip = sub {
my ($cidr) = @_;
my $config = PVE::INotify::read_file('interfaces');
my $net = Net::IP->new($cidr) || die Net::IP::Error() . "\n";
my $id = $net->version == 6 ? 'address6' : 'address';
my $config = PVE::INotify::read_file('interfaces');
my $ifaces = $config->{ifaces};
foreach my $iface (keys %$config) {
foreach my $iface (keys %$ifaces) {
my $d = $config->{$iface};
next if !$d->{address};
my $a = Net::IP->new($d->{address});
next if !$d->{$id};
my $a = Net::IP->new($d->{$id});
next if !$a;
return $d->{address} if $net->overlaps($a);
return $d->{$id} if $net->overlaps($a);
}
die "unable to find local address within network '$cidr'\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment