From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id DFA0B1FF0AA for ; Tue, 17 Nov 2026 19:35:30 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0BA37216B4; Tue, 17 Nov 2026 19:35:12 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox v2 01/11] network-api: add missing getters Date: Tue, 17 Nov 2026 19:34:48 +0100 Message-ID: <20261117183500.750636-2-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261117183500.750636-1-s.hanreich@proxmox.com> References: <20261117183500.750636-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: 1794940507198 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.266 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: 6IXIAAJMV5LNREPRQCUMVE2G5J6MYL3L X-Message-ID-Hash: 6IXIAAJMV5LNREPRQCUMVE2G5J6MYL3L 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: Not all parsed fields provided getters for their value. Make them available at use sites by providing the missing getters. Signed-off-by: Stefan Hanreich --- proxmox-network-api/src/config/helper.rs | 20 ++++++++++++++++++++ proxmox-network-api/src/config/mod.rs | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/proxmox-network-api/src/config/helper.rs b/proxmox-network-api/src/config/helper.rs index a9ae35fc..7feaaa51 100644 --- a/proxmox-network-api/src/config/helper.rs +++ b/proxmox-network-api/src/config/helper.rs @@ -132,6 +132,16 @@ pub struct LinkInfo { info_kind: Option, } +impl LinkInfo { + pub fn info_slave_data(&self) -> Option<&SlaveData> { + self.info_slave_data.as_ref() + } + + pub fn info_kind(&self) -> Option<&String> { + self.info_kind.as_ref() + } +} + /// The fields specific to an interface of type `ether`. #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, serde::Deserialize)] pub struct EtherLink { @@ -231,6 +241,16 @@ impl IpLink { None } + /// The [`LinkInfo`] for this link. + pub fn linkinfo(&self) -> Option<&LinkInfo> { + self.linkinfo.as_ref() + } + + /// The operating state of the interface. + pub fn operstate(&self) -> &str { + &self.operstate + } + /// Returns an iterator over the altnames of an interface. pub fn altnames(&self) -> impl Iterator { self.altnames.iter() diff --git a/proxmox-network-api/src/config/mod.rs b/proxmox-network-api/src/config/mod.rs index 212abef1..25ddd13f 100644 --- a/proxmox-network-api/src/config/mod.rs +++ b/proxmox-network-api/src/config/mod.rs @@ -2,7 +2,9 @@ mod helper; mod lexer; mod parser; -pub use helper::{AltnameMapping, IpLink, assert_ifupdown2_installed, network_reload, parse_cidr}; +pub use helper::{ + AltnameMapping, IpLink, LinkInfo, assert_ifupdown2_installed, network_reload, parse_cidr, +}; use std::collections::{BTreeMap, HashMap, HashSet}; use std::io::Write; -- 2.47.3