[pve-devel] [PATCH container 2/2] cleanup gateway hooks in debian network setup

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


remove the calls to "ip route" in post-up and pre-down even
if no new gateway was defined for an interface, otherwise
those hooks will remain until manually removed.
---
Note: we still leave the whole interface definition in place
on interface removal..

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

diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm
index d803949..c6b2998 100644
--- a/src/PVE/LXC/Setup/Debian.pm
+++ b/src/PVE/LXC/Setup/Debian.pm
@@ -202,8 +202,9 @@ sub setup_network {
 		$interfaces .= "iface $ifname inet static\n";
 		$interfaces .= "\taddress $net->{address}\n" if defined($net->{address});
 		$interfaces .= "\tnetmask $net->{netmask}\n" if defined($net->{netmask});
+
+		remove_gateway_scripts($section->{attr});
 		if (defined(my $gw = $net->{gateway})) {
-		    remove_gateway_scripts($section->{attr});
 		    if ($net->{needsroute}) {
 			$interfaces .= make_gateway_scripts($ifname, $gw);
 		    } else {
@@ -226,8 +227,8 @@ sub setup_network {
 		$interfaces .= "iface $ifname inet6 static\n";
 		$interfaces .= "\taddress $net->{address6}\n" if defined($net->{address6});
 		$interfaces .= "\tnetmask $net->{netmask6}\n" if defined($net->{netmask6});
+		remove_gateway_scripts($section->{attr});
 		if (defined(my $gw = $net->{gateway6})) {
-		    remove_gateway_scripts($section->{attr});
 		    if ($net->{needsroute6}) {
 			$interfaces .= make_gateway_scripts($ifname, $gw);
 		    } else {
-- 
2.1.4





More information about the pve-devel mailing list