[pve-devel] [PATCH pve-container 3/6] get_primary_ips: take dhcp/manual settings into account

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Jul 24 09:14:55 CEST 2015


---
 src/PVE/LXC.pm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 19aaf3e..cfdd57d 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1116,9 +1116,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);
 }
-- 
2.1.4





More information about the pve-devel mailing list