[pve-devel] applied: [PATCH common] network: bridge add IF: do not add all VLANs if $trunks are passed

Thomas Lamprecht t.lamprecht at proxmox.com
Sat May 9 21:02:20 CEST 2020


fixes commit 89ea13ef6b1555f92309da5c298e16579163eaf4 and
restores old behavior, the "if !$trunks" post-if was a bit suble, it
did not guard the die, but the system command previously - the die
was || (ORd) to the command, bad code style to begin with..

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

Thanks to https://forum.proxmox.com/threads/trunks-broken.69551/#post-311832

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

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index ac49536..04a964a 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -224,10 +224,9 @@ my $bridge_add_interface = sub {
 	    die "unable to add vlan $tag to interface $iface - $@\n" if $@;
 
 	    warn "Caution: Setting VLAN ID 1 on a VLAN aware bridge may be dangerous\n" if $tag == 1;
-	} else {
+	} elsif (!$trunks) {
 	    eval { run_command(['/sbin/bridge', 'vlan', 'add', 'dev', $iface, 'vid', '2-4094']) };
-	    die "unable to add default vlan tags to interface $iface - $@\n"
-		if $@ && !$trunks;
+	    die "unable to add default vlan tags to interface $iface - $@\n" if $@;
 	}
 
 	if ($trunks) {
-- 
2.20.1





More information about the pve-devel mailing list