From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <root@dev.dominic.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 D013072DFE
 for <pve-devel@lists.proxmox.com>; Wed, 14 Apr 2021 11:54:29 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id C24D0CA58
 for <pve-devel@lists.proxmox.com>; Wed, 14 Apr 2021 11:53:59 +0200 (CEST)
Received: from dev.dominic.proxmox.com (unknown [94.136.29.99])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2A180CA43
 for <pve-devel@lists.proxmox.com>; Wed, 14 Apr 2021 11:53:59 +0200 (CEST)
Received: by dev.dominic.proxmox.com (Postfix, from userid 0)
 id 0D974228CB; Wed, 14 Apr 2021 11:53:53 +0200 (CEST)
From: =?UTF-8?q?Dominic=20J=C3=A4ger?= <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 14 Apr 2021 11:53:12 +0200
Message-Id: <20210414095313.96550-1-d.jaeger@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  2
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery
 methods
 NO_DNS_FOR_FROM         0.379 Envelope sender has no MX or A DNS records
 RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_NONE                0.001 SPF: sender does not publish an 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. [inotify.pm]
Subject: [pve-devel] [PATCH common] Fix #2711: inotify: Allow 'v' as VLAN
 separator
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, 14 Apr 2021 09:54:29 -0000

VLANs with a name like vmbr0v5 had type UNKNOWN unless vlan-raw-device was set.
This way we return type VLAN for them as we do for vmbr0.5

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/PVE/INotify.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 2bb87bb..adcc91a 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -27,6 +27,8 @@ use base 'Exporter';
 
 our @EXPORT_OK = qw(read_file write_file register_file);
 
+my $VLAN_RE = qr!^(\S+)[v\.](\d+)$!;
+
 my $ccache;
 my $ccachemap;
 my $ccacheregex;
@@ -1077,7 +1079,7 @@ sub __read_etc_network_interfaces {
 		$ifaces->{$1}->{exists} = 0;
 		$d->{exists} = 0;
 	    }
-	} elsif ($iface =~ m/^(\S+)\.\d+$/ || $d->{'vlan-raw-device'}) {
+	} elsif ($iface =~ $VLAN_RE || $d->{'vlan-raw-device'}) {
 	    $d->{type} = 'vlan';
 
 	    my $raw_iface = $d->{'vlan-raw-device'} ? $d->{'vlan-raw-device'} : $1;
@@ -1550,7 +1552,7 @@ sub __write_etc_network_interfaces {
 	    my $p = undef;
 	    my $vlanid = undef;
 
-	    if ($iface =~ m/^(\S+)\.(\d+)$/) {
+	    if ($iface =~ $VLAN_RE) {
 		$p = $1;
 		$vlanid = $2;
 		delete $d->{'vlan-raw-device'} if $d->{'vlan-raw-device'};
-- 
2.20.1