[pve-devel] [PATCH container] setup: fix alpine ipv6-slaac configuration

Stoiko Ivanov s.ivanov at proxmox.com
Tue Mar 19 16:34:27 CET 2019


busybox ifupdown implementation differs from debian's - configuration type
auto is not supported. If SLAAC is selected for the ipv6 configuration of an
interface, the complete networking is not started, because of that error.

This workaround sets the interface type to 'manual' in case SLAAC is selected
(as is already done for dhcpv6 (for different reasons)). That way all other
configuration stanzas are setup correctly, and if a ipv4 configuration is
present for the same interface the SLAAC-part usually works out of the box
anyways (unless 'accept_ra' is set to 0 for the interface in the kernel).

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
The only downside is that a ipv6-slaac only (no ipv4) use of the interface will
not work - the interface won't be set to up. The alternative being to either
copy the network/interfaces creation code from debian or refactoring it in a
bigger scope to take alpine specifics also into account. I suppose that few
ipv6-only use-cases rely on slaac (with random generated mac-addresses)

 src/PVE/LXC/Setup/Alpine.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Setup/Alpine.pm b/src/PVE/LXC/Setup/Alpine.pm
index e7b8e67..75d6ebe 100644
--- a/src/PVE/LXC/Setup/Alpine.pm
+++ b/src/PVE/LXC/Setup/Alpine.pm
@@ -79,6 +79,13 @@ sub setup_network {
     # we can remove this bit.
     #
     # Filter out ipv6 dhcp and turn it into 'manual' so they see what's up.
+    #
+    # XXX: slaac works different from debian - busybox has no 'auto'
+    # configuration type - https://wiki.alpinelinux.org/wiki/Configure_Networking#IPv6_Stateless_Autoconfiguration
+    # the suggested configuration sadly does not take the interface up, but
+    # at least with the workaround the networking starts and if an ipv4 is
+    # configured slaac for ipv6 works (unless accept_ra = 0 in the node)
+
     my $netconf = {};
     my $networks = {};
     foreach my $k (keys %$conf) {
@@ -86,7 +93,7 @@ sub setup_network {
 	my $netstring = $conf->{$k};
 	# check for dhcp6:
 	my $d = PVE::LXC::Config->parse_lxc_network($netstring);
-	if (defined($d->{ip6}) && $d->{ip6} eq 'dhcp') {
+	if (defined($d->{ip6}) && ($d->{ip6} eq 'dhcp' || $d->{ip6} eq 'auto')) {
 	    $d->{ip6} = 'manual';
 	    $netstring = PVE::LXC::Config->print_lxc_network($d);
 	}
-- 
2.11.0





More information about the pve-devel mailing list