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 89CA1724B8 for ; Mon, 12 Apr 2021 15:14:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 87DD31F3DA for ; Mon, 12 Apr 2021 15:14:45 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 67B611F386 for ; Mon, 12 Apr 2021 15:14:41 +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 350B145A19 for ; Mon, 12 Apr 2021 15:14:41 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Mon, 12 Apr 2021 15:14:38 +0200 Message-Id: <20210412131438.15859-3-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210412131438.15859-1-a.lauterer@proxmox.com> References: <20210412131438.15859-1-a.lauterer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.015 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces 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: Mon, 12 Apr 2021 13:14:45 -0000 Setting the vlan-id and vlan-raw-device value for vlan devices that follow the dot notaton (interface.vlan) aligns how dot notation vlan devices and vlan devices that use the explicit vlan-id and vlan-raw-device options, available with ifupdown2, are represented in API return values. Previously the type for both was 'vlan' but only the latter showed more details. Setting these values here should not have any influence on how the interfaces file is being written as these two values are already filtered in __write_etc_network_interfaces for dot notation devices. Signed-off-by: Aaron Lauterer --- 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 2bb87bb..a0281e2 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -1077,10 +1077,14 @@ sub __read_etc_network_interfaces { $ifaces->{$1}->{exists} = 0; $d->{exists} = 0; } - } elsif ($iface =~ m/^(\S+)\.\d+$/ || $d->{'vlan-raw-device'}) { + } elsif ($iface =~ m/^(\S+)\.(\d+)$/ || $d->{'vlan-raw-device'}) { $d->{type} = 'vlan'; - my $raw_iface = $d->{'vlan-raw-device'} ? $d->{'vlan-raw-device'} : $1; + $d->{'vlan-raw-device'} = $1 if $1 && !$d->{'vlan-raw-device'}; + $d->{'vlan-id'} = $2 if $2; + + my $raw_iface = $d->{'vlan-raw-device'}; + if (defined ($ifaces->{$raw_iface})) { $d->{exists} = $ifaces->{$raw_iface}->{exists}; } else { -- 2.20.1