[pve-devel] [PATCH container 1/2] fix uninitialized value warning

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon May 2 15:41:13 CEST 2016


---
Note: this only triggered for some corner cases with partially removing
interfaces.

 src/PVE/LXC/Setup/Debian.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm
index 21bced5..d803949 100644
--- a/src/PVE/LXC/Setup/Debian.pm
+++ b/src/PVE/LXC/Setup/Debian.pm
@@ -196,7 +196,7 @@ sub setup_network {
 	if ($section->{type} eq 'ipv4') {
 	    $done_v4_hash->{$ifname} = 1;
 
-	    if ($net->{address} =~ /^(dhcp|manual)$/) {
+	    if (defined($net->{address}) && $net->{address} =~ /^(dhcp|manual)$/) {
 		$interfaces .= "iface $ifname inet $1\n";
 	    } else {
 		$interfaces .= "iface $ifname inet static\n";
@@ -220,7 +220,7 @@ sub setup_network {
 	} elsif ($section->{type} eq 'ipv6') {
 	    $done_v6_hash->{$ifname} = 1;
 
-	    if ($net->{address6} =~ /^(auto|dhcp|manual)$/) {
+	    if (defined($net->{address6}) && $net->{address6} =~ /^(auto|dhcp|manual)$/) {
 		$interfaces .= "iface $ifname inet6 $1\n";
 	    } else {
 		$interfaces .= "iface $ifname inet6 static\n";
-- 
2.1.4





More information about the pve-devel mailing list