]> git.proxmox.com Git - pve-container.git/commitdiff
get_primary_ips: take dhcp/manual settings into account
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 24 Jul 2015 07:14:55 +0000 (09:14 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 24 Jul 2015 11:06:08 +0000 (13:06 +0200)
src/PVE/LXC.pm

index 6252e4436a32fc4f966786d68c184ecbacece4a3..b8ac53601e6673a988d382c1d6a674d8325f2dbe 100644 (file)
@@ -1191,9 +1191,21 @@ sub get_primary_ips {
     return undef if !$net;
 
     my $ipv4 = $net->{ip};
-    $ipv4 =~ s!/\d+$!! if $ipv4;
+    if ($ipv4) {
+       if ($ipv4 =~ /^(dhcp|manual)$/) {
+           $ipv4 = undef
+       } else {
+           $ipv4 =~ s!/\d+$!!;
+       }
+    }
     my $ipv6 = $net->{ip6};
-    $ipv6 =~ s!/\d+$!! if $ipv6;
+    if ($ipv6) {
+       if ($ipv6 =~ /^(dhcp|manual)$/) {
+           $ipv6 = undef;
+       } else {
+           $ipv6 =~ s!/\d+$!!;
+       }
+    }
 
     return ($ipv4, $ipv6);
 }