public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-network-interface-pinning 08/13] network-interface-pinning: switch to proxmox-iproute2 crate
Date: Wed, 17 Jun 2026 13:10:05 +0200	[thread overview]
Message-ID: <20260617111012.312710-9-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20260617111012.312710-1-s.hanreich@proxmox.com>

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 Cargo.toml  |  1 +
 src/main.rs | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 6e6f982..eddcba4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,6 +17,7 @@ walkdir = "2.5.0"
 
 proxmox-async = "0.5.0"
 proxmox-log = "1.0.0"
+proxmox-iproute2 = "0.1.0"
 proxmox-network-api = { version = "1.0.3", features = [ "impl" ] }
 proxmox-network-types = "1"
 proxmox-product-config = "1"
diff --git a/src/main.rs b/src/main.rs
index 3129432..004db8c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,10 +51,7 @@ impl InterfaceMapping {
     ///
     /// It uses [`ip_links`] to determine the MAC address of the interfaces that should be pinned,
     /// since we pin based on MAC addresses.
-    pub fn write(
-        &self,
-        ip_links: HashMap<String, proxmox_network_api::IpLink>,
-    ) -> Result<(), Error> {
+    pub fn write(&self, ip_links: HashMap<String, proxmox_iproute2::IpLink>) -> Result<(), Error> {
         if self.mapping.is_empty() {
             return Ok(());
         }
@@ -63,7 +60,7 @@ impl InterfaceMapping {
 
         std::fs::create_dir_all(SYSTEMD_LINK_FILE_PATH)?;
 
-        let mut sorted_links: Vec<&proxmox_network_api::IpLink> = ip_links.values().collect();
+        let mut sorted_links: Vec<&proxmox_iproute2::IpLink> = ip_links.values().collect();
         sorted_links.sort_by_key(|a| a.index());
 
         for ip_link in sorted_links {
@@ -323,10 +320,10 @@ impl Display for LinkFile {
 #[derive(Debug, Clone, Eq, PartialEq, Hash)]
 /// A wrapper struct for [`proxmox_network_api::IpLink`], that implements Ord by comparing
 /// ifindexes.
-struct IpLink(proxmox_network_api::IpLink);
+struct IpLink(proxmox_iproute2::IpLink);
 
 impl Deref for IpLink {
-    type Target = proxmox_network_api::IpLink;
+    type Target = proxmox_iproute2::IpLink;
 
     fn deref(&self) -> &Self::Target {
         &self.0
@@ -345,8 +342,8 @@ impl Ord for IpLink {
     }
 }
 
-impl From<proxmox_network_api::IpLink> for IpLink {
-    fn from(value: proxmox_network_api::IpLink) -> Self {
+impl From<proxmox_iproute2::IpLink> for IpLink {
+    fn from(value: proxmox_iproute2::IpLink) -> Self {
         Self(value)
     }
 }
@@ -355,7 +352,7 @@ impl From<proxmox_network_api::IpLink> for IpLink {
 ///
 /// It holds all information required for generating
 pub struct PinningTool {
-    ip_links: HashMap<String, proxmox_network_api::IpLink>,
+    ip_links: HashMap<String, proxmox_iproute2::IpLink>,
     pinned_interfaces: PinnedInterfaces,
     existing_names: HashSet<String>,
 }
@@ -395,7 +392,7 @@ impl PinningTool {
 
     /// Constructs a new instance of the pinning tool.
     pub fn new() -> Result<Self, Error> {
-        let ip_links = proxmox_network_api::get_network_interfaces()?;
+        let ip_links = proxmox_iproute2::get_network_interfaces()?;
         let pinned_interfaces: PinnedInterfaces = Self::read_link_files()?.into_iter().collect();
 
         let mut existing_names = HashSet::new();
-- 
2.47.3





  parent reply	other threads:[~2026-06-17 11:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 11:09 [PATCH docs/manager/network/proxmox{,-backup,-datacenter-manager,-firewall,-network-interface-pinning,-ve-rs,-perl-rs} 00/13] Status reporting for wireguard fabrics Stefan Hanreich
2026-06-17 11:09 ` [PATCH proxmox 01/13] iproute2: schema: move iproute2 helpers to new create / schema Stefan Hanreich
2026-06-17 11:09 ` [PATCH proxmox 02/13] iproute2: add missing getters Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox 03/13] iproute2: add support for parsing interface flags Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox 04/13] wireguard: derive additional traits for public key Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox-backup 05/13] metric_collection: switch to proxmox-iproute2 crate Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox-datacenter-manager 06/13] " Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox-firewall 07/13] firewall config: " Stefan Hanreich
2026-06-17 11:10 ` Stefan Hanreich [this message]
2026-06-17 11:10 ` [PATCH proxmox-ve-rs 09/13] fabric: wireguard: add helper for findings peer based on endpoint Stefan Hanreich
2026-06-17 11:10 ` [PATCH proxmox-perl-rs 10/13] sdn status: fabrics: add status reporting for wireguard Stefan Hanreich
2026-06-17 11:10 ` [PATCH pve-network 11/13] api: fabric status: add schema for wireguard properties Stefan Hanreich
2026-06-17 11:10 ` [PATCH pve-manager 12/13] ui: fabric content: add wireguard protocol Stefan Hanreich
2026-06-17 11:10 ` [PATCH pve-docs 13/13] sdn: add documentation for wireguard status reporting Stefan Hanreich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260617111012.312710-9-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal