From 78e912a3b7b3d6f394a43b25ac3cf47144d0aa90 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 20 Jun 2016 15:32:18 +0200 Subject: [PATCH] vlan fixups: remove existing vlan ids bridge_add_interface should remove the existing vids from the interface (which is usually 1, which was previously left on the interface) --- src/PVE/Network.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm index 63476d3..405f14b 100644 --- a/src/PVE/Network.pm +++ b/src/PVE/Network.pm @@ -181,8 +181,10 @@ my $bridge_add_interface = sub { if ($vlan_aware) { if ($tag) { - system("/sbin/bridge vlan add dev $iface vid $tag pvid untagged") == 0 || - die "unable to add vlan $tag to interface $iface\n"; + system({'/sbin/bridge'} 'bridge', 'vlan', 'del', 'dev', $iface, 'vid', '1-4094') == 0 + or die "failed to remove default vlan tags of $iface\n"; + system({'/sbin/bridge'} 'bridge', 'vlan', 'add', 'dev', $iface, 'vid', $tag, 'pvid', 'untagged') == 0 + or die "unable to add vlan $tag to interface $iface\n"; warn "Caution: Setting VLAN ID 1 on a VLAN aware bridge may be dangerous\n" if $tag == 1; } else { -- 2.39.2