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 E11DB1FF0E1 for ; Thu, 27 Aug 2026 15:58:25 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id ADCCF214C0; Thu, 27 Aug 2026 15:58:25 +0200 (CEST) Message-ID: <157c7399-c2ac-46b1-a7f4-cc6121bab204@proxmox.com> Date: Thu, 27 Aug 2026 15:58:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [pve-network 1/2] vnets: introduce get_subnets_with_config To: Daniel Herzig , pve-devel@lists.proxmox.com References: <20260826154318.618730-1-d.herzig@proxmox.com> From: Hannes Laimer Content-Language: en-US In-Reply-To: <20260826154318.618730-1-d.herzig@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787839092554 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.891 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: WMRHCMWWAG3C2KKDE3R6XV3MF2SKQE4K X-Message-ID-Hash: WMRHCMWWAG3C2KKDE3R6XV3MF2SKQE4K X-MailFrom: h.laimer@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: On 2026-08-26 17:43, Daniel Herzig wrote: > 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; > + } > + this loop is the same as in `get_subnets`, `get_subnets` could just also call this helper, so filtering is only done in one place > + return $subnets; > +} > + > sub get_subnet_from_vnet_ip { > my ($vnetid, $ip) = @_; >