]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/Network.pm
read_bridge_mtu: public method instead private
[pve-common.git] / src / PVE / Network.pm
index ac49536c27646602c0e60f239beb1dfecf567940..b5d3777cc4a5cef1016d5adbfc05a2be1841bc29 100644 (file)
@@ -115,7 +115,7 @@ sub tap_rate_limit {
     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");
@@ -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) {
@@ -275,7 +274,7 @@ sub tap_create {
 
     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);
@@ -289,7 +288,7 @@ sub veth_create {
 
     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") {
@@ -347,7 +346,7 @@ my $create_firewall_bridge_ovs = sub {
     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);