From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A188D1FF15C for ; Fri, 8 Aug 2025 10:39:18 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 15F0310897; Fri, 8 Aug 2025 10:40:51 +0200 (CEST) Date: Fri, 08 Aug 2025 10:40:44 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20250807142141.72815-1-h.laimer@proxmox.com> In-Reply-To: <20250807142141.72815-1-h.laimer@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1754642298.y2oj4cigw2.astroid@yuna.none> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1754642423421 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.050 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, inotify.pm] Subject: Re: [pve-devel] [PATCH pve-common] inotify: interfaces: also set type 'bridge' for empty bridges 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On August 7, 2025 4:21 pm, Hannes Laimer wrote: > If a bridge has `bridge_ports` set to `none` we just skip the field. > Later we use the existance of the field to determine whether the type > should be `bridge`. This led to bridges without `bridge_ports` not > being recognized as bridges. > > In the `/nodes/{}/network` we do permissions checks but only for ifaces > with type `bridge`(or `OVSBridge`). So interfaces were returned by the > endpoint even if the user did not have permissions the correct > permissions because the interface did not have type `bridge`. > > This fixes this by also setting the type to `bridge` for empty bridges. > > Signed-off-by: Hannes Laimer > --- Note: this patch is likely a candidate for stable-bookworm as well? > src/PVE/INotify.pm | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm > index bbcb9f8..5a42ddd 100644 > --- a/src/PVE/INotify.pm > +++ b/src/PVE/INotify.pm > @@ -994,7 +994,10 @@ SECTION: while (defined($line = <$fh>)) { > } elsif ($id eq 'slaves' || $id eq 'bridge_ports') { this elsif here is taken for both bonds and bridges > my $devs = {}; > foreach my $p (split(/\s+/, $value)) { > - next if $p eq 'none'; > + if ($p eq 'none') { > + $d->{'is_empty_bridge'} = 1; so this here should be guarded with `if $id eq 'bridge_ports'`.. do we also need special handling of "empty" bonds (which make less sense in practice, but might still exist?) - in particular if we ever plan on dropping the naming restrictions there? > + next; > + } > $devs->{$p} = 1; > } > my $str = join(' ', sort keys %{$devs}); > @@ -1077,7 +1080,8 @@ OUTER: > > my $ip_link = $ip_links->{$altnames->{$iface} // $iface}; > > - if (defined $d->{'bridge_ports'}) { > + if (defined $d->{'bridge_ports'} || $d->{'is_empty_bridge'}) { > + delete $d->{'is_empty_bridge'} if defined $d->{'is_empty_bridge'}; > $d->{type} = 'bridge'; > if (!defined($d->{bridge_stp})) { > $d->{bridge_stp} = 'off'; > -- > 2.47.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel