setup_tc_rate_limit($iface, $rate, $burst);
}
-my $read_bridge_mtu = sub {
+sub read_bridge_mtu {
my ($bridge) = @_;
my $mtu = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/mtu");
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) {
die "unable to get bridge setting\n" if !$bridge;
- my $bridgemtu = &$read_bridge_mtu($bridge);
+ my $bridgemtu = read_bridge_mtu($bridge);
eval {
disable_ipv6($iface);
die "unable to get bridge setting\n" if !$bridge;
- my $bridgemtu = &$read_bridge_mtu($bridge);
+ my $bridgemtu = read_bridge_mtu($bridge);
# create veth pair
if (! -d "/sys/class/net/$veth") {
my ($vmid, $devid) = &$parse_tap_device_name($iface);
my ($fwbr, undef, undef, $ovsintport) = &$compute_fwbr_names($vmid, $devid);
- my $bridgemtu = &$read_bridge_mtu($bridge);
+ my $bridgemtu = read_bridge_mtu($bridge);
&$cond_create_bridge($fwbr);
&$activate_interface($fwbr);