From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <s.hanreich@proxmox.com>
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 AE028941DA
 for <pve-devel@lists.proxmox.com>; Wed, 21 Feb 2024 15:23:05 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 913E019266
 for <pve-devel@lists.proxmox.com>; Wed, 21 Feb 2024 15:23:05 +0100 (CET)
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
 for <pve-devel@lists.proxmox.com>; Wed, 21 Feb 2024 15:23:04 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BA250444AB;
 Wed, 21 Feb 2024 15:23:04 +0100 (CET)
Message-ID: <3c459701-ea0f-4a96-88d3-dbafb275563c@proxmox.com>
Date: Wed, 21 Feb 2024 15:23:03 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Jillian Morgan <jillian.morgan@primordial.ca>
References: <20240126171741.2251760-1-jillian.morgan@primordial.ca>
 <20240126171741.2251760-3-jillian.morgan@primordial.ca>
From: Stefan Hanreich <s.hanreich@proxmox.com>
In-Reply-To: <20240126171741.2251760-3-jillian.morgan@primordial.ca>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.497 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
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH close #545,
 #5203: Allow bridges to have any valid interface name 2/2]
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 21 Feb 2024 14:23:05 -0000

Hit send a bit too early, had another remark on this

On 1/26/24 18:17, Jillian Morgan wrote:
> Detect bridge interface by bridge_ports attribute
> Repo: pve-common
> 
> Similar to other interface types, we can detect a bridge by the presense of
> it's bridge_ports attribute rather than solely relying on the "vmbr" ifname
> prefix heuristic.
> 
> Signed-off-by: Jillian Morgan <jillian.morgan@primordial.ca>
> ---
>  pve-common/src/PVE/INotify.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index 6432295..9b45346 100644
> --- a/src/PVE/INotify.pm
> +++ b/src/PVE/INotify.pm
> @@ -1053,7 +1053,7 @@ sub __read_etc_network_interfaces {
>  		my $tag = &$extract_ovs_option($d, 'tag');
>  		$d->{ovs_tag} = $tag if defined($tag);
>  	    }
> -	} elsif ($iface =~ m/^vmbr\d+$/) {
> +	} elsif ($iface =~ m/^vmbr\d+$/ || $d->{'bridge_ports'}) {

This only works for bridges that actually have a bridge port assigned.
In cases of bridges with no default bridge_port

$d->{'bridge_ports'}) === ''

which evaluates to false. Something like exists/defined would fit better.

>  	    if (!$d->{ovs_type}) {
>  		$d->{type} = 'bridge';
>  		if (!defined ($d->{bridge_stp})) {
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
>