From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id E81901FF17C for ; Wed, 23 Jul 2025 16:31:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1052415B49; Wed, 23 Jul 2025 16:32:37 +0200 (CEST) From: Gabriel Goller To: pve-devel@lists.proxmox.com Date: Wed, 23 Jul 2025 16:32:00 +0200 Message-Id: <20250723143200.737707-2-g.goller@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250723143200.737707-1-g.goller@proxmox.com> References: <20250723143200.737707-1-g.goller@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753281114515 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.009 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 Subject: [pve-devel] [PATCH proxmox-ve-rs 1/1] ve-config: fabrics: force ip-prefix to be canonical 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" FRR spits out a warning if the address of the access-list is not canonicalized (i.e. not a network address). So when the user creates a new fabric, just store the canonicalized version of the passed ip-prefix. Signed-off-by: Gabriel Goller --- proxmox-ve-config/src/sdn/fabric/mod.rs | 9 ++++++++- .../src/sdn/fabric/section_config/fabric.rs | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs index 9ec2f615c8f1..58a06f9423cb 100644 --- a/proxmox-ve-config/src/sdn/fabric/mod.rs +++ b/proxmox-ve-config/src/sdn/fabric/mod.rs @@ -587,11 +587,18 @@ impl FabricConfig { /// Add a fabric to the [`FabricConfig`]. /// /// Returns an error if a fabric with the same name exists. - pub fn add_fabric(&mut self, fabric: Fabric) -> Result<(), FabricConfigError> { + pub fn add_fabric(&mut self, mut fabric: Fabric) -> Result<(), FabricConfigError> { if self.fabrics.contains_key(fabric.id()) { return Err(FabricConfigError::DuplicateFabric(fabric.id().to_string())); } + if let Some(prefix) = fabric.ip_prefix() { + fabric.set_ip_prefix(prefix.canonical()); + } + if let Some(prefix) = fabric.ip6_prefix() { + fabric.set_ip6_prefix(prefix.canonical()); + } + self.fabrics.insert(fabric.id().clone(), fabric.into()); Ok(()) diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs index d41c6d82fd88..38911a624740 100644 --- a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs +++ b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs @@ -186,6 +186,16 @@ impl Fabric { } } + /// Set the ip-prefix (IPv4 CIDR) of the [`Fabric`]. + /// + /// This is a common property for all protocols. + pub fn set_ip_prefix(&mut self, ipv4_cidr: Ipv4Cidr) { + match self { + Fabric::Openfabric(fabric_section) => fabric_section.ip_prefix = Some(ipv4_cidr), + Fabric::Ospf(fabric_section) => fabric_section.ip_prefix = Some(ipv4_cidr), + } + } + /// Get the ip6-prefix (IPv6 CIDR) of the [`Fabric`]. /// /// This is a common property for all protocols. @@ -195,6 +205,16 @@ impl Fabric { Fabric::Ospf(fabric_section) => fabric_section.ip6_prefix(), } } + + /// Set the ip6-prefix (IPv6 CIDR) of the [`Fabric`]. + /// + /// This is a common property for all protocols. + pub fn set_ip6_prefix(&mut self, ipv6_cidr: Ipv6Cidr) { + match self { + Fabric::Openfabric(fabric_section) => fabric_section.ip6_prefix = Some(ipv6_cidr), + Fabric::Ospf(fabric_section) => fabric_section.ip6_prefix = Some(ipv6_cidr), + } + } } impl Validatable for Fabric { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel