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 E59621FF066 for ; Tue, 24 Nov 2026 18:57:39 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D6A2A21693; Tue, 24 Nov 2026 18:57:30 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices Date: Tue, 24 Nov 2026 18:57:11 +0100 Message-ID: <20261124175718.512428-2-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261124175718.512428-1-s.hanreich@proxmox.com> References: <20261124175718.512428-1-s.hanreich@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795543046624 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.179 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) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: O4F4Y5SG7C2XWLPWMK7LNCMHW4JMW5DL X-Message-ID-Hash: O4F4Y5SG7C2XWLPWMK7LNCMHW4JMW5DL X-MailFrom: s.hanreich@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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: pve-container requires the name of a network device, and qemu-server has no such property. With the MAC address and the type of a container network device becoming optional, the name is what is left to tell a container network device apart from a string that is a network device of neither guest type. Signed-off-by: Stefan Hanreich --- proxmox-ve-config/src/guest/vm.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs index 99574f68..08927218 100644 --- a/proxmox-ve-config/src/guest/vm.rs +++ b/proxmox-ve-config/src/guest/vm.rs @@ -204,6 +204,9 @@ pub struct LxcNetworkDevice { ty: NetworkDeviceModel, #[serde(rename = "hwaddr")] mac_address: MacAddress, + // never read, requiring it tells container network devices apart from QEMU ones + #[serde(rename = "name")] + _name: String, firewall: Option, ip: Option, ip6: Option, @@ -234,6 +237,11 @@ impl ApiType for LxcNetworkDevice { true, &StringSchema::new("IPv6 settings for this network device").schema(), ), + ( + "name", + false, + &StringSchema::new("name of the network device inside the container").schema(), + ), ( "type", false, @@ -501,6 +509,7 @@ mod tests { network_device, NetworkDevice::Lxc(LxcNetworkDevice { ty: NetworkDeviceModel::Veth, + _name: "eth0".to_string(), mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x24]), firewall: Some(false), ip: Some(LxcIpv4Addr::Dhcp), @@ -512,6 +521,7 @@ mod tests { .parse::() .expect_err("invalid network configuration"); + // neither a QEMU device without a model nor an LXC device without a name "bridge=public,firewall=0" .parse::() .expect_err("invalid network configuration"); @@ -519,6 +529,10 @@ mod tests { "".parse::() .expect_err("invalid network configuration"); + "hwaddr=AA:AA:AA:E2:3E:24,bridge=public,type=veth" + .parse::() + .expect_err("invalid network configuration"); + "name=eth0,bridge=public,firewall=0,hwaddr=AA:AA:AG:E2:3E:24,ip=dhcp,type=veth" .parse::() .expect_err("invalid network configuration"); @@ -619,6 +633,7 @@ unprivileged: 1" network_config.network_devices()[&0], NetworkDevice::Lxc(LxcNetworkDevice { ty: NetworkDeviceModel::Veth, + _name: "eth0".to_string(), mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x11]), firewall: Some(true), ip: Some(LxcIpv4Addr::Dhcp), @@ -630,6 +645,7 @@ unprivileged: 1" network_config.network_devices()[&2], NetworkDevice::Lxc(LxcNetworkDevice { ty: NetworkDeviceModel::Veth, + _name: "eth0".to_string(), mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x12]), firewall: Some(false), ip: Some(LxcIpv4Addr::Ip( @@ -643,6 +659,7 @@ unprivileged: 1" network_config.network_devices()[&5], NetworkDevice::Lxc(LxcNetworkDevice { ty: NetworkDeviceModel::Veth, + _name: "eth0".to_string(), mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x13]), firewall: Some(true), ip: None, -- 2.47.3