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 BDC001FF146 for ; Tue, 07 Jul 2026 12:56:52 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 42BC021443; Tue, 07 Jul 2026 12:56:49 +0200 (CEST) From: Jakob Klocker To: pve-devel@lists.proxmox.com Subject: [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC Date: Tue, 7 Jul 2026 12:55:59 +0200 Message-ID: <20260707105601.309299-1-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL -0.374 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: Q6KQDLBK7BWWBBAVB7TJOTDSHOSQ67TE X-Message-ID-Hash: Q6KQDLBK7BWWBBAVB7TJOTDSHOSQ67TE 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: When PBS runs inside an LXC container, network traffic graphs stay empty for interfaces with non-standard names (e.g. wan0, vxb01). The reporter [0] observed that renaming to eth0 and restarting made data appear. The cause is in collect_netdev_stats(): an interface is recorded as NetdevType::Physical only if is_physical() returns true. Inside a container the uplink is one end of a veth pair (info_kind = "veth"), so is_physical() returns false and the code falls back to PHYSICAL_NIC_REGEX, which only matches conventional names. A standard name like eth0 matches the regex and is counted; a custom name does not, so its stats are silently dropped. In a VM the guest NIC appears as a normal hardware NIC without info_kind, which is why the VM case works. This series adds is_veth() to proxmox-network-api and gates the collector on whether PBS runs in a container (checking /run/systemd/container). RFC / open questions: This patch fixes the reported single-uplink case, but in a container with several veths it counts all of them, including a veth enslaved to a bridge. In testing (see below) a bridge-enslaved veth was still counted. An alternative would be to count root-level interfaces without a master instead of matching veth, which would exclude enslaved interfaces and also generalise beyond veth. Also this fix does not work if PBS is run in docker/podman, since the interface is not a veth there (it was `tap` in podman). LXC is the case that matters for PVE, so not covering podman/docker seems acceptable to me. Related, not fixed here: NETWORK_INTERFACE_CACHE is a OnceLock populated once at proxy startup and never refreshed, so interfaces added or renamed after startup are not picked up until a restart. This matches the reporter's note that a restart was required. It's pre-existing and independent of this fix. Testing: Reproduced in a PVE LXC running PBS with a custom-named veth uplink ("test"). Before: the interface produces no graph data. After: it is counted. Verified via a temporary debug print in the collector that: * the custom-named veth uplink is counted, * a bridge (info_kind = bridge) is correctly excluded, * with multiple veths present, all veths are counted, including a bridge-enslaved one - the limitation noted above. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=7198 proxmox: Jakob Klocker (1): network-api: add is_veth helper to IpLink proxmox-network-api/src/config/helper.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) proxmox-backup: Jakob Klocker (1): fix #7198: metric collection: count veth uplink when running in a container src/server/metric_collection/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Summary over all repositories: 2 files changed, 20 insertions(+), 1 deletions(-) -- Generated by murpp 0.12.0