From: Stefan Hanreich <s.hanreich@proxmox.com>
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 [thread overview]
Message-ID: <20261124175718.512428-2-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20261124175718.512428-1-s.hanreich@proxmox.com>
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 <s.hanreich@proxmox.com>
---
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<bool>,
ip: Option<LxcIpv4Addr>,
ip6: Option<LxcIpv6Addr>,
@@ -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::<NetworkDevice>()
.expect_err("invalid network configuration");
+ // neither a QEMU device without a model nor an LXC device without a name
"bridge=public,firewall=0"
.parse::<NetworkDevice>()
.expect_err("invalid network configuration");
@@ -519,6 +529,10 @@ mod tests {
"".parse::<NetworkDevice>()
.expect_err("invalid network configuration");
+ "hwaddr=AA:AA:AA:E2:3E:24,bridge=public,type=veth"
+ .parse::<NetworkDevice>()
+ .expect_err("invalid network configuration");
+
"name=eth0,bridge=public,firewall=0,hwaddr=AA:AA:AG:E2:3E:24,ip=dhcp,type=veth"
.parse::<NetworkDevice>()
.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
next prev parent reply other threads:[~2026-11-24 17:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
2026-11-24 17:57 ` Stefan Hanreich [this message]
2026-11-24 17:57 ` [PATCH proxmox-ve-rs 2/7] ve-config: guest: default the type of container network devices to veth Stefan Hanreich
2026-11-24 17:57 ` [PATCH proxmox-ve-rs 3/7] ve-config: guest: accept network devices without a MAC address Stefan Hanreich
2026-11-24 17:57 ` [PATCH proxmox-firewall 4/7] firewall: guest: handle " Stefan Hanreich
2026-11-25 7:28 ` Arthur Bied-Charreton
2026-11-24 17:57 ` [PATCH proxmox-firewall 5/7] tests: add network devices without " Stefan Hanreich
2026-11-24 17:57 ` [PATCH pve-firewall 6/7] firewall: drop the traffic of guest " Stefan Hanreich
2026-11-24 17:57 ` [PATCH pve-firewall 7/7] firewall: do not generate MAC addresses for guest network devices Stefan Hanreich
2026-11-25 7:14 ` [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Arthur Bied-Charreton
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=20261124175718.512428-2-s.hanreich@proxmox.com \
--to=s.hanreich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.