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 67F221FF0DA for ; Thu, 19 Nov 2026 20:46:15 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 62CE821799; Thu, 19 Nov 2026 20:46:06 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox 01/14] network-api: expose the master device of a link Date: Thu, 19 Nov 2026 20:45:33 +0100 Message-ID: <20261119194547.674512-2-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119194547.674512-1-s.hanreich@proxmox.com> References: <20261119194547.674512-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: 1795117556771 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.244 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: PKWXJNCKVQWPOQCO5SY2KARDCYOALGU3 X-Message-ID-Hash: PKWXJNCKVQWPOQCO5SY2KARDCYOALGU3 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: The master of a link, as reported by iproute2, tells which bridge, bond or VRF an interface is enslaved to. Initially this will be used by the SDN stack to determine if an interface is the member of a VRF. Signed-off-by: Stefan Hanreich --- proxmox-network-api/src/config/helper.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/proxmox-network-api/src/config/helper.rs b/proxmox-network-api/src/config/helper.rs index a9ae35fc..e33c8e3d 100644 --- a/proxmox-network-api/src/config/helper.rs +++ b/proxmox-network-api/src/config/helper.rs @@ -177,6 +177,7 @@ pub struct IpLink { link_type: Link, linkinfo: Option, operstate: String, + master: Option, } impl IpLink { @@ -240,6 +241,11 @@ impl IpLink { pub fn active(&self) -> bool { self.operstate == "UP" } + + /// The name of the device this interface is enslaved to, e.g. a bridge, bond or VRF. + pub fn master(&self) -> Option<&str> { + self.master.as_deref() + } } /// A mapping of altnames to the interfaces' ifname. @@ -380,7 +386,8 @@ mod tests { "gro_ipv4_max_size": 65536 }"#; - serde_json::from_str::(interface).unwrap(); + let link = serde_json::from_str::(interface).unwrap(); + assert_eq!(link.master(), None); } #[test] @@ -464,7 +471,8 @@ mod tests { ] }"#; - serde_json::from_str::(interface).unwrap(); + let link = serde_json::from_str::(interface).unwrap(); + assert_eq!(link.master(), Some("vmbr0")); } #[test] -- 2.47.3