From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common 1/2] fix #2831: never set bridge_fd to 0 with STP on
Date: Fri, 16 Jul 2021 09:40:49 +0200 [thread overview]
Message-ID: <20210716074050.3981444-1-f.gruenbichler@proxmox.com> (raw)
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>
---
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
next reply other threads:[~2021-07-16 7:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 7:40 Fabian Grünbichler [this message]
2021-07-16 7:40 ` [pve-devel] [PATCH common 2/2] interfaces: improve bridge_fd handling Fabian Grünbichler
2021-07-16 10:56 ` Thomas Lamprecht
2021-07-16 10:54 ` [pve-devel] applied: [PATCH common 1/2] fix #2831: never set bridge_fd to 0 with STP on Thomas Lamprecht
-- strict thread matches above, loose matches on Subject: below --
2021-07-16 7:39 [pve-devel] " Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210716074050.3981444-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.