From: Jakob Klocker <j.klocker@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Jakob Klocker <j.klocker@proxmox.com>
Subject: [PATCH proxmox 1/2] network-api: add is_veth helper to IpLink
Date: Tue, 7 Jul 2026 12:56:00 +0200 [thread overview]
Message-ID: <20260707105601.309299-2-j.klocker@proxmox.com> (raw)
In-Reply-To: <20260707105601.309299-1-j.klocker@proxmox.com>
Add a method to check whether an interface is one end of a veth pair
(info_kind = "veth"). This is used to identify a LXC container's network
uplink, which is a veth rather than a physical NIC and therefore is
not recognized by is_physical().
Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
proxmox-network-api/src/config/helper.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/proxmox-network-api/src/config/helper.rs b/proxmox-network-api/src/config/helper.rs
index a9ae35fc..a13d6cc3 100644
--- a/proxmox-network-api/src/config/helper.rs
+++ b/proxmox-network-api/src/config/helper.rs
@@ -207,6 +207,19 @@ impl IpLink {
PHYSICAL_NIC_REGEX.is_match(&self.ifname)
}
+ /// Whether this is a `veth` (virtual ethernet) interface.
+ ///
+ /// Checks whether `info_kind` in `linkinfo` is set to `"veth"`. Inside an
+ /// LXC container, the uplink is one end of a veth pair rather than a physical
+ /// NIC, so this is used alongside [`is_physical`] to decide whether an
+ /// interface carries the machine's network traffic.
+ pub fn is_veth(&self) -> bool {
+ self.linkinfo
+ .as_ref()
+ .and_then(|li| li.info_kind.as_deref())
+ == Some("veth")
+ }
+
/// The name of the interface (ifname / IFLA_IFNAME).
pub fn name(&self) -> &str {
&self.ifname
--
2.47.3
next prev parent reply other threads:[~2026-07-07 10:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 10:55 [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC Jakob Klocker
2026-07-07 10:56 ` Jakob Klocker [this message]
2026-07-07 10:56 ` [PATCH proxmox-backup 2/2] fix #7198: metric collection: count veth uplink when running in a container Jakob Klocker
2026-07-07 11:17 ` [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC Jakob Klocker
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=20260707105601.309299-2-j.klocker@proxmox.com \
--to=j.klocker@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