From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C426E1FF14F for ; Fri, 08 May 2026 18:33:32 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A6A7C1ED78; Fri, 8 May 2026 18:32:20 +0200 (CEST) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs v6 05/24] sdn: prefix lists: validate prefix lists Date: Fri, 8 May 2026 18:31:14 +0200 Message-ID: <20260508163134.481912-6-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260508163134.481912-1-s.hanreich@proxmox.com> References: <20260508163134.481912-1-s.hanreich@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778257794626 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.635 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: 64VTHKND6DU6EB4EJOOETOTALL5U3TJG X-Message-ID-Hash: 64VTHKND6DU6EB4EJOOETOTALL5U3TJG X-MailFrom: s.hanreich@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: Use the newly supplied validation methods from the prefix list section config to validate the prefix list configuration when reading or writing. Signed-off-by: Stefan Hanreich --- pve-rs/src/bindings/sdn/prefix_lists.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pve-rs/src/bindings/sdn/prefix_lists.rs b/pve-rs/src/bindings/sdn/prefix_lists.rs index 8087a9e..cf900c3 100644 --- a/pve-rs/src/bindings/sdn/prefix_lists.rs +++ b/pve-rs/src/bindings/sdn/prefix_lists.rs @@ -17,6 +17,7 @@ pub mod pve_rs_sdn_prefix_lists { use perlmod::Value; use proxmox_section_config::typed::{ApiSectionDataEntry, SectionConfigData}; + use proxmox_ve_config::common::valid::Validatable; use proxmox_ve_config::sdn::prefix_list::api::{ PrefixList as ApiPrefixList, PrefixListDeletableProperties, PrefixListEntry as ApiPrefixListEntry, PrefixListEntryDeletableProperties, @@ -41,6 +42,10 @@ pub mod pve_rs_sdn_prefix_lists { let raw_config = std::str::from_utf8(raw_config)?; let config = ConfigPrefixList::parse_section_config("prefix-lists.cfg", raw_config)?; + for prefix_list in config.values() { + prefix_list.validate()?; + } + Ok( perlmod::instantiate_magic!(&class, MAGIC => Box::new(PerlPrefixListConfig { prefix_lists: Mutex::new(config.deref().clone()), @@ -57,6 +62,10 @@ pub mod pve_rs_sdn_prefix_lists { let prefix_lists: SectionConfigData = SectionConfigData::from_iter(prefix_lists); + for prefix_list in prefix_lists.values() { + prefix_list.validate()?; + } + Ok( perlmod::instantiate_magic!(&class, MAGIC => Box::new(PerlPrefixListConfig { prefix_lists: Mutex::new(prefix_lists.deref().clone()), @@ -70,6 +79,11 @@ pub mod pve_rs_sdn_prefix_lists { #[try_from_ref] this: &PerlPrefixListConfig, ) -> Result, Error> { let config = this.prefix_lists.lock().unwrap(); + + for prefix_list in config.values() { + prefix_list.validate()?; + } + Ok(config.deref().clone()) } @@ -80,6 +94,10 @@ pub mod pve_rs_sdn_prefix_lists { pub fn to_raw(#[try_from_ref] this: &PerlPrefixListConfig) -> Result { let config = this.prefix_lists.lock().unwrap(); + for prefix_list in config.values() { + prefix_list.validate()?; + } + let prefix_lists: SectionConfigData = SectionConfigData::from_iter(config.deref().clone()); -- 2.47.3