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 624D91FF146 for ; Tue, 07 Jul 2026 12:56:22 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E86F02143D; Tue, 07 Jul 2026 12:56:17 +0200 (CEST) From: Jakob Klocker To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox 1/2] network-api: add is_veth helper to IpLink Date: Tue, 7 Jul 2026 12:56:00 +0200 Message-ID: <20260707105601.309299-2-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260707105601.309299-1-j.klocker@proxmox.com> References: <20260707105601.309299-1-j.klocker@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL -0.351 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) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: 2ZKBDVGMLDG42NPJP7DSX3OXFJKVADNO X-Message-ID-Hash: 2ZKBDVGMLDG42NPJP7DSX3OXFJKVADNO X-MailFrom: jklocker@dev.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 CC: Jakob Klocker X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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