---
 PVE/API2/Ceph.pm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 217b8ce..b7eea84 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -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";
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to