[pve-devel] [PATCH common] fix #1232: cleanup bridges on veth_delete

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jan 18 10:48:11 CET 2017

When a container stops or hotplug changes are applied we
do a veth_delete() which does not cleanup the firewall
bridges or OVS ports. This is problematic at the next
startup. When creating a network device we usually want to
copy the MTU of the bridge we intend to put it on, however,
with OVS still having the old port lying around the
recreated device gets associated with the bridge before we
read its MTU, potentially reducing it to that of the newly
created device.

This cleanup also gets rid of stale fwbr/fwln devices from
stopped containers.
 src/PVE/Network.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 1c03770..27492b5 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -277,7 +277,7 @@ sub veth_delete {
     if (-d "/sys/class/net/$veth") {
 	run_command("/sbin/ip link delete dev $veth", outfunc => sub {}, errfunc => sub {});
+    eval { tap_unplug($veth) };
 my $create_firewall_bridge_linux = sub {

More information about the pve-devel mailing list