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 957E21FF0C1 for ; Wed, 26 Aug 2026 17:43:26 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9F2872149E; Wed, 26 Aug 2026 17:43:23 +0200 (CEST) From: Daniel Herzig To: pve-devel@lists.proxmox.com Subject: [pve-network 1/2] vnets: introduce get_subnets_with_config Date: Wed, 26 Aug 2026 17:43:17 +0200 Message-ID: <20260826154318.618730-1-d.herzig@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.667 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) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods 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 Message-ID-Hash: AJLIVWQDOZ4VDQMF5EW4UYEOA5LFDLU7 X-Message-ID-Hash: AJLIVWQDOZ4VDQMF5EW4UYEOA5LFDLU7 X-MailFrom: dherzig@emma.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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a sub to return the subnets of a vnet with certain subnet configuration given. Signed-off-by: Daniel Herzig --- src/PVE/Network/SDN/Vnets.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm index c327a4b..fdb2dd9 100644 --- a/src/PVE/Network/SDN/Vnets.pm +++ b/src/PVE/Network/SDN/Vnets.pm @@ -82,6 +82,19 @@ sub get_subnets { return $subnets; } +sub get_subnets_with_config { + my ($vnetid, $subnets_cfg) = @_; + + my $subnets = undef; + foreach my $subnetid (sort keys %{ $subnets_cfg->{ids} }) { + my $subnet = PVE::Network::SDN::Subnets::sdn_subnets_config($subnets_cfg, $subnetid); + next if !$subnet->{vnet} || ($vnetid && $subnet->{vnet} ne $vnetid); + $subnets->{$subnetid} = $subnet; + } + + return $subnets; +} + sub get_subnet_from_vnet_ip { my ($vnetid, $ip) = @_; -- 2.47.3