From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C567B7673C for ; Fri, 16 Jul 2021 09:39:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B7D7AD062 for ; Fri, 16 Jul 2021 09:39:09 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 830DAD052 for ; Fri, 16 Jul 2021 09:39:08 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 47D7D41FBD for ; Fri, 16 Jul 2021 09:39:08 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Fri, 16 Jul 2021 09:39:01 +0200 Message-Id: <20210716073902.3964343-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.498 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH common 1/2] fix #2831: never set bridge_fd to 0 with STP on X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 07:39:09 -0000 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 --- Notes: these range checks are there in the kernel since 2011.. src/PVE/INotify.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 8cf4b44..4f682be 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -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})) { -- 2.30.2