[pve-devel] [PATCH pve-container 2/3] Debian/RedHat: ipv6 slaac/autoconf support

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Jul 30 10:54:00 CEST 2015


---
 src/PVE/LXCSetup/Debian.pm | 8 ++++----
 src/PVE/LXCSetup/Redhat.pm | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXCSetup/Debian.pm b/src/PVE/LXCSetup/Debian.pm
index 7635e08..4fa2be9 100644
--- a/src/PVE/LXCSetup/Debian.pm
+++ b/src/PVE/LXCSetup/Debian.pm
@@ -113,7 +113,7 @@ sub setup_network {
 	if ($d->{name}) {
 	    my $net = {};
 	    if (defined($d->{ip})) {
-		if ($d->{ip} =~ /^(?:dhcp|manual)$/) {
+		if ($d->{ip} =~ /^(?:auto|dhcp|manual)$/) {
 		    $net->{address} = $d->{ip};
 		} else {
 		    my $ipinfo = PVE::LXC::parse_ipv4_cidr($d->{ip});
@@ -125,7 +125,7 @@ sub setup_network {
 		$net->{gateway} = $d->{'gw'};
 	    }
 	    if (defined($d->{ip6})) {
-		if ($d->{ip6} =~ /^(?:dhcp|manual)$/) {
+		if ($d->{ip6} =~ /^(?:auto|dhcp|manual)$/) {
 		    $net->{address6} = $d->{ip6};
 		} elsif ($d->{ip6} !~ /^($IPV6RE)\/(\d+)$/) {
 		    die "unable to parse ipv6 address/prefix\n";
@@ -163,7 +163,7 @@ sub setup_network {
 
 	    $interfaces .= "auto $section->{ifname}\n" if $new;
 
-	    if ($net->{address} =~ /^(dhcp|manual)$/) {
+	    if ($net->{address} =~ /^(auto|dhcp|manual)$/) {
 		$interfaces .= "iface $section->{ifname} inet $1\n";
 	    } elsif ($net->{address}) {
 		$interfaces .= "iface $section->{ifname} inet static\n";
@@ -180,7 +180,7 @@ sub setup_network {
 	} elsif ($section->{type} eq 'ipv6') {
 	    $done_v6_hash->{$section->{ifname}} = 1;
 	    
-	    if ($net->{address6} =~ /^(dhcp|manual)$/) {
+	    if ($net->{address6} =~ /^(auto|dhcp|manual)$/) {
 		$interfaces .= "iface $section->{ifname} inet6 $1\n";
 	    } elsif ($net->{address6}) {
 		$interfaces .= "iface $section->{ifname} inet6 static\n";
diff --git a/src/PVE/LXCSetup/Redhat.pm b/src/PVE/LXCSetup/Redhat.pm
index 74b0af7..8333951 100644
--- a/src/PVE/LXCSetup/Redhat.pm
+++ b/src/PVE/LXCSetup/Redhat.pm
@@ -247,6 +247,11 @@ sub setup_network {
 	    $data .= "ONBOOT=yes\n";
 	    $data .= "BOOTPROTO=none\n";
 	    $data .= "IPV6INIT=yes\n";
+	    if ($d->{ip6} eq 'auto') {
+		$data .= "IPV6_AUTOCONF=yes\n";
+	    } else {
+		$data .= "IPV6_AUTOCONF=no\n";
+	    }
 	    if ($d->{ip6} eq 'dhcp') {
 		$data .= "DHCPV6C=yes\n";
 	    } else {
-- 
2.1.4





More information about the pve-devel mailing list