]> git.proxmox.com Git - pve-container.git/commitdiff
centos: fixup ipv6 out-of-subnet route
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Apr 2016 14:20:43 +0000 (16:20 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 26 Apr 2016 13:58:55 +0000 (15:58 +0200)
Centos needs these in route6-$iface, not route-$iface.
It also seems to make sense to not include the
IPV6_DEFAULTGW when a route6-$iface file is used containing
the default gateway.

Also adding the device to the routes.

src/PVE/LXC/Setup/CentOS.pm
src/test/run_setup_tests.pl
src/test/test-centos6-002/etc/sysconfig/network-scripts/ifcfg-eth0.exp
src/test/test-centos6-002/etc/sysconfig/network-scripts/route-eth0.exp
src/test/test-centos6-002/etc/sysconfig/network-scripts/route6-eth0.exp [new file with mode: 0644]

index c0330c2525fb9df5bd5031d6d1d17b11634752c1..2becc35a6bfd619ce74a1ed530c2aae9af6b3873 100644 (file)
@@ -177,7 +177,9 @@ sub setup_network {
 
        my $filename = "/etc/sysconfig/network-scripts/ifcfg-$d->{name}";
        my $routefile = "/etc/sysconfig/network-scripts/route-$d->{name}";
+       my $route6file = "/etc/sysconfig/network-scripts/route6-$d->{name}";
        my $routes = '';
+       my $routes6 = '';
 
        my $header = "DEVICE=$d->{name}\nONBOOT=yes\n";
        my $data = '';
@@ -195,7 +197,7 @@ sub setup_network {
                    $data .= "GATEWAY=$d->{gw}\n";
                    if (!PVE::Network::is_ip_in_cidr($d->{gw}, $d->{ip}, 4)) {
                        $routes .= "$d->{gw} dev $d->{name}\n";
-                       $routes .= "default via $d->{gw}\n";
+                       $routes .= "default via $d->{gw} dev $d->{name}\n";
                    }
                }
            }
@@ -214,11 +216,12 @@ sub setup_network {
            } else {
                $data .= "IPV6ADDR=$d->{ip6}\n";
                if (defined($d->{gw6})) {
-                   $data .= "IPV6_DEFAULTGW=$d->{gw6}\n";
                    if (!PVE::Network::is_ip_in_cidr($d->{gw6}, $d->{ip6}, 6) &&
                        !PVE::Network::is_ip_in_cidr($d->{gw6}, 'fe80::/10', 6)) {
-                       $routes .= "$d->{gw6} dev $d->{name}\n";
-                       $routes .= "default via $d->{gw6}\n";
+                       $routes6 .= "$d->{gw6} dev $d->{name}\n";
+                       $routes6 .= "default via $d->{gw6} dev $d->{name}\n";
+                   } else {
+                       $data .= "IPV6_DEFAULTGW=$d->{gw6}\n";
                    }
                }
            }
@@ -228,6 +231,7 @@ sub setup_network {
        $header .= "BOOTPROTO=$bootproto\n";
        $self->ct_file_set_contents($filename, $header . $data);
        $self->ct_modify_file($routefile, $routes, delete => 1, prepend => 1);
+       $self->ct_modify_file($route6file, $routes6, delete => 1, prepend => 1);
     }
 
     my $sysconfig_network = "/etc/sysconfig/network";
index fc92dbb10e1ef80d5ec6fee88a3bf2a3dcd2d717..b103cfa57301727188195e686ea9cc79130a7654 100755 (executable)
@@ -53,12 +53,16 @@ sub run_test {
                           /etc/sysconfig/network
                           /etc/sysconfig/network-scripts/ifcfg-eth0
                           /etc/sysconfig/network-scripts/route-eth0
+                          /etc/sysconfig/network-scripts/route6-eth0
                           /etc/sysconfig/network-scripts/ifcfg-eth1
                           /etc/sysconfig/network-scripts/route-eth1
+                          /etc/sysconfig/network-scripts/route6-eth1
                           /etc/sysconfig/network-scripts/ifcfg-eth2
                           /etc/sysconfig/network-scripts/route-eth2
+                          /etc/sysconfig/network-scripts/route6-eth2
                           /etc/sysconfig/network-scripts/ifcfg-eth3
                           /etc/sysconfig/network-scripts/route-eth3
+                          /etc/sysconfig/network-scripts/route6-eth3
                           /etc/sysconfig/network/ifcfg-eth0
                           /etc/sysconfig/network/ifroute-eth0
                           /etc/sysconfig/network/ifcfg-eth1
index 1935e2043e9548b153d219d206ab8993d3a6d772..a6cc799a0c6ee3e66a47ab2842efee9f21d67c9c 100644 (file)
@@ -7,4 +7,3 @@ GATEWAY=4.3.2.1
 IPV6INIT=yes
 IPV6_AUTOCONF=no
 IPV6ADDR=2000::1/64
-IPV6_DEFAULTGW=20ff::1
index 6bf6cbbfb9c8ccc6178d869b98dc7bafb32b1d19..144a9c1b3258ed76a22de246fd6a84d9d9a91c2b 100644 (file)
@@ -1,6 +1,4 @@
 # --- BEGIN PVE ---
 4.3.2.1 dev eth0
-default via 4.3.2.1
-20ff::1 dev eth0
-default via 20ff::1
+default via 4.3.2.1 dev eth0
 # --- END PVE ---
diff --git a/src/test/test-centos6-002/etc/sysconfig/network-scripts/route6-eth0.exp b/src/test/test-centos6-002/etc/sysconfig/network-scripts/route6-eth0.exp
new file mode 100644 (file)
index 0000000..e11687a
--- /dev/null
@@ -0,0 +1,4 @@
+# --- BEGIN PVE ---
+20ff::1 dev eth0
+default via 20ff::1 dev eth0
+# --- END PVE ---