]> git.proxmox.com Git - pve-common.git/commitdiff
fix #2831: never set bridge_fd to 0 with STP on
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 16 Jul 2021 07:40:49 +0000 (09:40 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Jul 2021 09:50:40 +0000 (11:50 +0200)
it's an invalid combination that causes the network reload/setup to
fail. unfortunately, this is not caught by ifupdown2 itself, but only
rejected by the kernel with ERANGE over netlink.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/INotify.pm

index 8cf4b445381639c8626779086970bc6a0e26bdab..4f682be94903e750e8dde622b8bfb563c24407fa 100644 (file)
@@ -1061,13 +1061,12 @@ sub __read_etc_network_interfaces {
        } elsif ($iface =~ m/^vmbr\d+$/) {
            if (!$d->{ovs_type}) {
                $d->{type} = 'bridge';
-
-               if (!defined ($d->{bridge_fd})) {
-                   $d->{bridge_fd} = 0;
-               }
                if (!defined ($d->{bridge_stp})) {
                    $d->{bridge_stp} = 'off';
                }
+               if (!defined($d->{bridge_fd}) && $d->{bridge_stp} eq 'off') {
+                   $d->{bridge_fd} = 0;
+               }
            } elsif ($d->{ovs_type} eq 'OVSBridge') {
                $d->{type} = $d->{ovs_type};
            }
@@ -1259,11 +1258,16 @@ sub __interface_to_string {
        $done->{bridge_ports} = 1;
 
        my $v = defined($d->{bridge_stp}) ? $d->{bridge_stp} : 'off';
+       my $no_stp = $v eq 'off';
+
        $raw .= "\tbridge-stp $v\n";
        $done->{bridge_stp} = 1;
 
        $v = defined($d->{bridge_fd}) ? $d->{bridge_fd} : 0;
-       $raw .= "\tbridge-fd $v\n";
+       # 0 is only allowed when STP is disabled
+       if ($v || $no_stp) {
+           $raw .= "\tbridge-fd $v\n";
+       }
        $done->{bridge_fd} = 1;
 
        if( defined($d->{bridge_vlan_aware})) {