From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id E8E901FF0AF for ; Fri, 20 Nov 2026 15:12:05 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2209221799; Fri, 20 Nov 2026 15:12:05 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH network] sdn: zones: warn about host interfaces in a missing zone VRF Date: Fri, 20 Nov 2026 15:11:56 +0100 Message-ID: <20261120141157.192734-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795183921835 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.223 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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 Message-ID-Hash: R2FNXXJ5WL4D7QNIPMJAGTC2IYFZGN5Q X-Message-ID-Hash: R2FNXXJ5WL4D7QNIPMJAGTC2IYFZGN5Q X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Thomas Lamprecht X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Disabling dedicated-vrf, removing the node from a zone or deleting the zone removes its VRF, but host interfaces may still be in it. ifreload then cannot enslave them or add their gateway, which is easy to miss in the apply log. Warn when generating the SDN network config of the node, as only the node sees its own interfaces file. Suggested-by: Thomas Lamprecht Signed-off-by: Gabriel Goller --- src/PVE/Network/SDN/Zones.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm index 1c90ea769a41..458ae8cc1b40 100644 --- a/src/PVE/Network/SDN/Zones.pm +++ b/src/PVE/Network/SDN/Zones.pm @@ -11,6 +11,7 @@ use PVE::Tools qw(extract_param dir_glob_regex run_command); use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file); use PVE::IPRoute2; use PVE::Network; +use PVE::RESTEnvironment qw(log_warn); use PVE::Network::SDN::Controllers; use PVE::Network::SDN::Dns; @@ -228,6 +229,21 @@ sub generate_etc_network_config { } } + # Disabling the dedicated VRF of a zone, removing the node from the zone or deleting the zone + # removes its VRF, but host interfaces may still reference it. ifreload then cannot enslave + # them. The zone API cannot check this, as the host network config is local to each node. + # + # Only zone VRFs (vrf_) are checked. Other VRFs can be defined in files sourced by + # /etc/network/interfaces, which are not parsed here. + my $host_ifaces = $interfaces_config->{ifaces}; + for my $iface (sort keys $host_ifaces->%*) { + my $vrf = $host_ifaces->{$iface}->{vrf}; + next if !$vrf || $vrf !~ m/^vrf_/; + next if $config->{$vrf} || $host_ifaces->{$vrf}; + + log_warn("host interface '$iface' is in VRF '$vrf', which does not exist on this node"); + } + my $raw_network_config = "\#version:$version\n"; foreach my $iface (sort keys %$config) { $raw_network_config .= "\n"; -- 2.47.3