public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 1/1] network-api: make address field optional
Date: Wed,  6 Aug 2025 16:29:22 +0200	[thread overview]
Message-ID: <20250806142927.344007-2-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20250806142927.344007-1-s.hanreich@proxmox.com>

Certain network interfaces do not have a MAC address, for instance
tailscale is layer-3 only, therefore the interfaces do not have a MAC
address. Make the address field optional to prevent the network
interface parsing logic from throwing an error in such cases.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 proxmox-network-api/src/config/helper.rs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/proxmox-network-api/src/config/helper.rs b/proxmox-network-api/src/config/helper.rs
index 4f17b9ee..ca80d47f 100644
--- a/proxmox-network-api/src/config/helper.rs
+++ b/proxmox-network-api/src/config/helper.rs
@@ -137,7 +137,7 @@ pub struct IpLink {
     altnames: Vec<String>,
     ifindex: i64,
     link_type: String,
-    address: MacAddress,
+    address: Option<MacAddress>,
     linkinfo: Option<LinkInfo>,
     operstate: String,
 }
@@ -157,12 +157,10 @@ impl IpLink {
         &self.ifname
     }
 
-    pub fn permanent_mac(&self) -> MacAddress {
+    pub fn permanent_mac(&self) -> Option<MacAddress> {
         if let Some(link_info) = &self.linkinfo {
             if let Some(info_slave_data) = &link_info.info_slave_data {
-                if let Some(perm_hw_addr) = info_slave_data.perm_hw_addr {
-                    return perm_hw_addr;
-                }
+                return info_slave_data.perm_hw_addr;
             }
         }
 
-- 
2.47.2


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2025-08-06 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06 14:29 [pbs-devel] [PATCH proxmox{, -network-interface-pinning} 0/2] fix reading ip link output for interfaces without MAC address Stefan Hanreich
2025-08-06 14:29 ` Stefan Hanreich [this message]
2025-08-08  7:29   ` [pbs-devel] [PATCH proxmox 1/1] network-api: make address field optional Christian Ebner
2025-08-08  8:01     ` Stefan Hanreich
2025-08-06 14:29 ` [pbs-devel] [PATCH proxmox-network-interface-pinning 1/1] network-interface-pinning: adapt to optional mac address Stefan Hanreich
2025-08-08 11:56 ` [pbs-devel] superseded: [PATCH proxmox{, -network-interface-pinning} 0/2] fix reading ip link output for interfaces without MAC address 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=20250806142927.344007-2-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pbs-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