* [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address
@ 2026-11-24 17:57 Stefan Hanreich
2026-11-24 17:57 ` [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices Stefan Hanreich
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
A guest network device without a MAC address is valid for qemu-server
and pve-container, which generate a random one each time they parse the
device. The API always stores one, but manual edits and restored
backups are accepted without any MAC or type set.
pve-firewall built its MAC and IP filters from random addresses, a
different one for each rule and on every compile. With the MAC filter
enabled, it thus dropped all traffic the device sent, and the IP filter
dropped traffic from its link-local addresses. (unless you were really
lucky).
proxmox-firewall failed to parse such a guest's network config
completely.
Both firewalls now drop the traffic of a device without MAC address
explicitly if the MAC filter is enabled. and the IP filter drops its
auto-derived link-local addresses. That keeps the effective behavior
of pve-firewall, with stable rules, and proxmox-firewall behaves the
same.
## Dependencies
pve-firewall requires pve-container from my other patch series [1]
proxmox-firewall requires proxmox-ve-rs
semver: ve-rs change breaks the public API
[1] https://lore.proxmox.com/pve-devel/20261124145651.335234-1-s.hanreich@proxmox.com/T/#t
proxmox-ve-rs:
Stefan Hanreich (3):
ve-config: guest: require the name of container network devices
ve-config: guest: default the type of container network devices to
veth
ve-config: guest: accept network devices without a MAC address
proxmox-ve-config/src/guest/vm.rs | 99 ++++++++++++++++++++++++-------
1 file changed, 79 insertions(+), 20 deletions(-)
proxmox-firewall:
Stefan Hanreich (2):
firewall: guest: handle network devices without a MAC address
tests: add network devices without MAC address
proxmox-firewall/src/firewall.rs | 38 +-
proxmox-firewall/tests/input/100.conf | 1 +
proxmox-firewall/tests/input/101.conf | 1 +
.../integration_tests__firewall.snap | 399 ++++++++++++++++++
4 files changed, 429 insertions(+), 10 deletions(-)
pve-firewall:
Stefan Hanreich (2):
firewall: drop the traffic of guest network devices without MAC
address
firewall: do not generate MAC addresses for guest network devices
src/PVE/Firewall.pm | 46 +++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)
Summary over all repositories:
6 files changed, 532 insertions(+), 52 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices
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
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
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH proxmox-ve-rs 2/7] ve-config: guest: default the type of container network devices to veth
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 ` [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices Stefan Hanreich
@ 2026-11-24 17:57 ` 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
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
The type of a container network device is optional for pve-container,
which only supports veth and sets it when parsing the device. A config
with a network device without a type thus works for the container, but
proxmox-firewall failed to parse it.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-ve-config/src/guest/vm.rs | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
index 08927218..e809c2e0 100644
--- a/proxmox-ve-config/src/guest/vm.rs
+++ b/proxmox-ve-config/src/guest/vm.rs
@@ -193,6 +193,10 @@ impl FromStr for LxcIpv6Addr {
}
}
+fn default_lxc_network_device_model() -> NetworkDeviceModel {
+ NetworkDeviceModel::Veth
+}
+
/// Representation of the network device property string of a LXC guest.
///
/// It currently only cotains properties that are required for the firewall to function, there are
@@ -200,7 +204,7 @@ impl FromStr for LxcIpv6Addr {
#[derive(Debug, Deserialize)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct LxcNetworkDevice {
- #[serde(rename = "type")]
+ #[serde(rename = "type", default = "default_lxc_network_device_model")]
ty: NetworkDeviceModel,
#[serde(rename = "hwaddr")]
mac_address: MacAddress,
@@ -244,7 +248,7 @@ impl ApiType for LxcNetworkDevice {
),
(
"type",
- false,
+ true,
&StringSchema::new("type of the network device").schema(),
),
]),
@@ -521,6 +525,22 @@ mod tests {
.parse::<NetworkDevice>()
.expect_err("invalid network configuration");
+ network_device = "name=eth0,bridge=public,firewall=1,hwaddr=AA:AA:AA:E2:3E:25"
+ .parse()
+ .expect("valid network configuration");
+
+ assert_eq!(
+ network_device,
+ NetworkDevice::Lxc(LxcNetworkDevice {
+ ty: NetworkDeviceModel::Veth,
+ _name: "eth0".to_string(),
+ mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x25]),
+ firewall: Some(true),
+ ip: None,
+ ip6: None,
+ })
+ );
+
// neither a QEMU device without a model nor an LXC device without a name
"bridge=public,firewall=0"
.parse::<NetworkDevice>()
@@ -533,6 +553,10 @@ mod tests {
.parse::<NetworkDevice>()
.expect_err("invalid network configuration");
+ "hwaddr=AA:AA:AA:E2:3E:24,bridge=public"
+ .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");
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH proxmox-ve-rs 3/7] ve-config: guest: accept network devices without a MAC address
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 ` [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices Stefan Hanreich
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 ` Stefan Hanreich
2026-11-24 17:57 ` [PATCH proxmox-firewall 4/7] firewall: guest: handle " Stefan Hanreich
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
qemu-server and pve-container accept network devices without a MAC
address and generate a random one each time they parse the device. The
API always stores a MAC address, but a manual edit or a restored backup
can lack it. proxmox-firewall failed to parse such a config, and with it
the whole firewall configuration of the node, if the guest had a
firewall config.
Make the MAC address optional for both guest types, and return an
Option from mac_address(), so that users have to decide how to handle
a device without one.
Also take the model as default key, as qemu-server does, so that a
device like 'virtio,bridge=vmbr0' without a MAC address can be parsed.
As unknown models are accepted, a bare unknown word now parses as a
network device as well, so test an invalid value with a property that
neither guest type has instead.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-ve-config/src/guest/vm.rs | 56 ++++++++++++++++++++-----------
1 file changed, 37 insertions(+), 19 deletions(-)
diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
index e809c2e0..ec6cbc91 100644
--- a/proxmox-ve-config/src/guest/vm.rs
+++ b/proxmox-ve-config/src/guest/vm.rs
@@ -77,7 +77,7 @@ impl FromStr for NetworkDeviceModel {
pub struct QemuNetworkDevice {
model: NetworkDeviceModel,
#[serde(rename = "macaddr")]
- mac_address: MacAddress,
+ mac_address: Option<MacAddress>,
firewall: Option<bool>,
}
@@ -93,7 +93,7 @@ impl ApiType for QemuNetworkDevice {
),
(
"macaddr",
- false,
+ true,
&StringSchema::new("mac address for this network device").schema(),
),
(
@@ -104,6 +104,7 @@ impl ApiType for QemuNetworkDevice {
]),
)
.additional_properties(true)
+ .default_key("model")
.key_alias_info(KeyAliasInfo::new(
"model",
&sorted!([
@@ -207,7 +208,7 @@ pub struct LxcNetworkDevice {
#[serde(rename = "type", default = "default_lxc_network_device_model")]
ty: NetworkDeviceModel,
#[serde(rename = "hwaddr")]
- mac_address: MacAddress,
+ mac_address: Option<MacAddress>,
// never read, requiring it tells container network devices apart from QEMU ones
#[serde(rename = "name")]
_name: String,
@@ -228,7 +229,7 @@ impl ApiType for LxcNetworkDevice {
),
(
"hwaddr",
- false,
+ true,
&StringSchema::new("mac address for this network device").schema(),
),
(
@@ -276,8 +277,8 @@ impl NetworkDevice {
}
}
- /// Returns the MAC address of the network device
- pub fn mac_address(&self) -> MacAddress {
+ /// Returns the MAC address of the network device, if set in the configuration.
+ pub fn mac_address(&self) -> Option<MacAddress> {
match self {
NetworkDevice::Qemu(qemu_network_device) => qemu_network_device.mac_address,
NetworkDevice::Lxc(lxc_network_device) => lxc_network_device.mac_address,
@@ -469,7 +470,7 @@ mod tests {
network_device,
NetworkDevice::Qemu(QemuNetworkDevice {
model: NetworkDeviceModel::VirtIO,
- mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81]),
+ mac_address: Some(MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81])),
firewall: Some(true),
})
);
@@ -482,7 +483,7 @@ mod tests {
network_device,
NetworkDevice::Qemu(QemuNetworkDevice {
model: NetworkDeviceModel::VirtIO,
- mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81]),
+ mac_address: Some(MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81])),
firewall: None,
})
);
@@ -497,7 +498,7 @@ mod tests {
network_device,
NetworkDevice::Qemu(QemuNetworkDevice {
model: NetworkDeviceModel::VirtIO,
- mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81]),
+ mac_address: Some(MacAddress::new([0xAA, 0xAA, 0xAA, 0x17, 0x19, 0x81])),
firewall: Some(true),
})
);
@@ -514,16 +515,33 @@ mod tests {
NetworkDevice::Lxc(LxcNetworkDevice {
ty: NetworkDeviceModel::Veth,
_name: "eth0".to_string(),
- mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x24]),
+ mac_address: Some(MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x24])),
firewall: Some(false),
ip: Some(LxcIpv4Addr::Dhcp),
ip6: None,
})
);
- "model=virtio"
- .parse::<NetworkDevice>()
- .expect_err("invalid network configuration");
+ network_device = "virtio,bridge=public"
+ .parse()
+ .expect("valid network configuration");
+
+ assert_eq!(
+ network_device,
+ NetworkDevice::Qemu(QemuNetworkDevice {
+ model: NetworkDeviceModel::VirtIO,
+ mac_address: None,
+ firewall: None,
+ })
+ );
+
+ network_device = "model=virtio".parse().expect("valid network configuration");
+ assert_eq!(network_device.mac_address(), None);
+
+ network_device = "name=eth0,bridge=public"
+ .parse()
+ .expect("valid network configuration");
+ assert_eq!(network_device.mac_address(), None);
network_device = "name=eth0,bridge=public,firewall=1,hwaddr=AA:AA:AA:E2:3E:25"
.parse()
@@ -534,7 +552,7 @@ mod tests {
NetworkDevice::Lxc(LxcNetworkDevice {
ty: NetworkDeviceModel::Veth,
_name: "eth0".to_string(),
- mac_address: MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x25]),
+ mac_address: Some(MacAddress::new([0xAA, 0xAA, 0xAA, 0xE2, 0x3E, 0x25])),
firewall: Some(true),
ip: None,
ip6: None,
@@ -629,7 +647,7 @@ vmgenid: 706fbe99-d28b-4047-a9cd-3677c859ca8a"
network_config.network_devices()[&0],
NetworkDevice::Qemu(QemuNetworkDevice {
model: NetworkDeviceModel::VirtIO,
- mac_address: MacAddress::new([0xAA, 0xBB, 0xCC, 0xF2, 0xFE, 0x75]),
+ mac_address: Some(MacAddress::new([0xAA, 0xBB, 0xCC, 0xF2, 0xFE, 0x75])),
firewall: None,
})
);
@@ -658,7 +676,7 @@ unprivileged: 1"
NetworkDevice::Lxc(LxcNetworkDevice {
ty: NetworkDeviceModel::Veth,
_name: "eth0".to_string(),
- mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x11]),
+ mac_address: Some(MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x11])),
firewall: Some(true),
ip: Some(LxcIpv4Addr::Dhcp),
ip6: Some(LxcIpv6Addr::Auto),
@@ -670,7 +688,7 @@ unprivileged: 1"
NetworkDevice::Lxc(LxcNetworkDevice {
ty: NetworkDeviceModel::Veth,
_name: "eth0".to_string(),
- mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x12]),
+ mac_address: Some(MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x12])),
firewall: Some(false),
ip: Some(LxcIpv4Addr::Ip(
Ipv4Cidr::from_str("123.123.123.123/24").expect("valid ipv4")
@@ -684,7 +702,7 @@ unprivileged: 1"
NetworkDevice::Lxc(LxcNetworkDevice {
ty: NetworkDeviceModel::Veth,
_name: "eth0".to_string(),
- mac_address: MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x13]),
+ mac_address: Some(MacAddress::new([0xBC, 0x24, 0x11, 0x47, 0x83, 0x13])),
firewall: Some(true),
ip: None,
ip6: Some(LxcIpv6Addr::Ip(
@@ -717,7 +735,7 @@ unprivileged: 1"
assert_eq!(network_config.ignored_keys(), ["net32"]);
// a network device key with an invalid value is still an error
- NetworkConfig::parse("net0: foo".as_bytes()).expect_err("invalid network device");
+ NetworkConfig::parse("net0: foo=bar".as_bytes()).expect_err("invalid network device");
// which definition the guest uses depends on its validation of the values
NetworkConfig::parse(
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH proxmox-firewall 4/7] firewall: guest: handle network devices without a MAC address
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
` (2 preceding siblings ...)
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 ` 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
` (3 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
A guest network device can lack a MAC address, for example after a
manual edit of the config. qemu-server and pve-container then use a
random one, which the firewall cannot know. Such a guest failed the
parsing of its network config, and with it the whole firewall update.
Leave the device out of the MAC filter, so that the filter drops its
traffic, like it drops the traffic from any other unknown MAC address.
If none of the devices of a guest has a MAC address, there is no set
to match against, so drop all traffic of the guest instead of skipping
the filter. Likewise, leave the link-local address out of the default
IP filter, which then drops traffic from link-local addresses of the
device.
pve-firewall effectively behaves the same, as it builds the filters
from a random MAC address that does not match the one of the guest.
This requires the version of proxmox-ve-config in which the MAC address
of a network device is optional.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-firewall/src/firewall.rs | 38 +++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/proxmox-firewall/src/firewall.rs b/proxmox-firewall/src/firewall.rs
index 5689bdd..1fe35a2 100644
--- a/proxmox-firewall/src/firewall.rs
+++ b/proxmox-firewall/src/firewall.rs
@@ -671,16 +671,28 @@ impl Firewall {
if config.macfilter() {
log::debug!("setting macfilter for guest #{vmid}");
- let mac_address_set: Vec<Expression> = config
+ let firewall_devices: Vec<_> = config
.network_config()
.network_devices()
.iter()
.filter(|(_, device)| device.has_firewall())
- .map(|(index, device)| {
- Expression::concat([
- Expression::from(config.iface_name_by_index(*index)),
- Expression::from(device.mac_address().to_string()),
- ])
+ .collect();
+
+ let mac_address_set: Vec<Expression> = firewall_devices
+ .iter()
+ .filter_map(|(index, device)| {
+ let Some(mac_address) = device.mac_address() else {
+ log::warn!(
+ "guest #{vmid}: net{index} has no MAC address, the MAC filter drops \
+ its traffic"
+ );
+ return None;
+ };
+
+ Some(Expression::concat([
+ Expression::from(config.iface_name_by_index(**index)),
+ Expression::from(mac_address.to_string()),
+ ]))
})
.collect();
@@ -717,6 +729,11 @@ impl Firewall {
commands.push(Add::rule(macfilter_rule));
commands.push(Add::rule(macfilter_arp_rule));
+ } else if !firewall_devices.is_empty() {
+ commands.push(Add::rule(AddRule::from_statement(
+ chain_out.clone(),
+ Statement::make_drop(),
+ )));
}
}
@@ -885,10 +902,11 @@ impl Firewall {
let ipset_name = IpsetName::new(IpsetScope::Guest, ipfilter_name);
let mut ipset = Ipset::new(ipset_name);
- let cidr =
- Ipv6Cidr::from(network_device.mac_address().eui64_link_local_address());
-
- ipset.push(IpsetEntry::from(Cidr::from(cidr)));
+ // without a MAC address, the filter drops traffic from link-local addresses
+ if let Some(mac_address) = network_device.mac_address() {
+ let cidr = Ipv6Cidr::from(mac_address.eui64_link_local_address());
+ ipset.push(IpsetEntry::from(Cidr::from(cidr)));
+ }
if let Some(ip_address) = network_device.ip() {
ipset.push(IpsetEntry::from(Cidr::from(Ipv4Cidr::from(
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH proxmox-firewall 5/7] tests: add network devices without MAC address
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
` (3 preceding siblings ...)
2026-11-24 17:57 ` [PATCH proxmox-firewall 4/7] firewall: guest: handle " Stefan Hanreich
@ 2026-11-24 17:57 ` Stefan Hanreich
2026-11-24 17:57 ` [PATCH pve-firewall 6/7] firewall: drop the traffic of guest " Stefan Hanreich
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
Cover a container network device without MAC address and type, whose
default IP filter has no link-local address, and a VM network device
without MAC address, for which the MAC filter drops all traffic of the
guest.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-firewall/tests/input/100.conf | 1 +
proxmox-firewall/tests/input/101.conf | 1 +
.../integration_tests__firewall.snap | 399 ++++++++++++++++++
3 files changed, 401 insertions(+)
diff --git a/proxmox-firewall/tests/input/100.conf b/proxmox-firewall/tests/input/100.conf
index 1f81186..8bce621 100644
--- a/proxmox-firewall/tests/input/100.conf
+++ b/proxmox-firewall/tests/input/100.conf
@@ -6,6 +6,7 @@ memory: 512
net1: name=eth0,bridge=simple1,firewall=1,hwaddr=BC:24:11:4D:B0:FF,ip=dhcp,ip6=fd80::1234/64,type=veth
net2: name=eth0,bridge=simple1,hwaddr=BC:24:11:4D:B0:FF,ip=dhcp,ip6=fd80::1234/64,type=veth
net3: name=eth0,bridge=simple2,firewall=1,hwaddr=BC:24:11:4D:B0:FE,ip=192.0.2.10/24,ip6=fd80::1235/64,type=veth
+net4: name=eth0,bridge=simple2,firewall=1,ip=192.0.2.11/24
ostype: debian
rootfs: local-lvm:vm-90001-disk-0,size=2G
swap: 512
diff --git a/proxmox-firewall/tests/input/101.conf b/proxmox-firewall/tests/input/101.conf
index 394e2e4..65f2e99 100644
--- a/proxmox-firewall/tests/input/101.conf
+++ b/proxmox-firewall/tests/input/101.conf
@@ -3,6 +3,7 @@ cores: 2
cpu: x86-64-v2-AES
memory: 2048
meta: creation-qemu=8.1.5,ctime=1712322773
+net0: virtio,bridge=public,firewall=1
numa: 0
ostype: l26
scsihw: virtio-scsi-single
diff --git a/proxmox-firewall/tests/snapshots/integration_tests__firewall.snap b/proxmox-firewall/tests/snapshots/integration_tests__firewall.snap
index 69fb10a..439a379 100644
--- a/proxmox-firewall/tests/snapshots/integration_tests__firewall.snap
+++ b/proxmox-firewall/tests/snapshots/integration_tests__firewall.snap
@@ -5493,6 +5493,337 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
}
}
},
+ {
+ "add": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v4-guest-100/ipfilter-net4",
+ "type": "ipv4_addr",
+ "flags": [
+ "interval"
+ ],
+ "auto-merge": true
+ }
+ }
+ },
+ {
+ "flush": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v4-guest-100/ipfilter-net4"
+ }
+ }
+ },
+ {
+ "add": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v4-guest-100/ipfilter-net4-nomatch",
+ "type": "ipv4_addr",
+ "flags": [
+ "interval"
+ ],
+ "auto-merge": true
+ }
+ }
+ },
+ {
+ "flush": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v4-guest-100/ipfilter-net4-nomatch"
+ }
+ }
+ },
+ {
+ "add": {
+ "element": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v4-guest-100/ipfilter-net4",
+ "elem": [
+ {
+ "prefix": {
+ "addr": "192.0.2.11",
+ "len": 32
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v6-guest-100/ipfilter-net4",
+ "type": "ipv6_addr",
+ "flags": [
+ "interval"
+ ],
+ "auto-merge": true
+ }
+ }
+ },
+ {
+ "flush": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v6-guest-100/ipfilter-net4"
+ }
+ }
+ },
+ {
+ "add": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v6-guest-100/ipfilter-net4-nomatch",
+ "type": "ipv6_addr",
+ "flags": [
+ "interval"
+ ],
+ "auto-merge": true
+ }
+ }
+ },
+ {
+ "flush": {
+ "set": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "v6-guest-100/ipfilter-net4-nomatch"
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-in",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "oifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "!=",
+ "left": {
+ "payload": {
+ "protocol": "arp",
+ "field": "daddr ip"
+ }
+ },
+ "right": "@v4-guest-100/ipfilter-net4"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-out",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "iifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "!=",
+ "left": {
+ "payload": {
+ "protocol": "ip",
+ "field": "saddr"
+ }
+ },
+ "right": "@v4-guest-100/ipfilter-net4"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-out",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "iifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "ip",
+ "field": "saddr"
+ }
+ },
+ "right": "@v4-guest-100/ipfilter-net4-nomatch"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-out",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "iifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "!=",
+ "left": {
+ "payload": {
+ "protocol": "ip6",
+ "field": "saddr"
+ }
+ },
+ "right": "@v6-guest-100/ipfilter-net4"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-out",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "iifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "payload": {
+ "protocol": "ip6",
+ "field": "saddr"
+ }
+ },
+ "right": "@v6-guest-100/ipfilter-net4-nomatch"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-100-out",
+ "expr": [
+ {
+ "match": {
+ "op": "==",
+ "left": {
+ "meta": {
+ "key": "iifname"
+ }
+ },
+ "right": "veth100i4"
+ }
+ },
+ {
+ "match": {
+ "op": "!=",
+ "left": {
+ "payload": {
+ "protocol": "arp",
+ "field": "saddr ip"
+ }
+ },
+ "right": "@v4-guest-100/ipfilter-net4"
+ }
+ },
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
{
"add": {
"rule": {
@@ -5859,6 +6190,14 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
"target": "guest-100-in"
}
}
+ ],
+ [
+ "veth100i4",
+ {
+ "goto": {
+ "target": "guest-100-in"
+ }
+ }
]
]
}
@@ -6011,6 +6350,14 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
"target": "guest-100-out"
}
}
+ ],
+ [
+ "veth100i4",
+ {
+ "goto": {
+ "target": "guest-100-out"
+ }
+ }
]
]
}
@@ -6216,6 +6563,20 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
}
}
},
+ {
+ "add": {
+ "rule": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "chain": "guest-101-out",
+ "expr": [
+ {
+ "drop": null
+ }
+ ]
+ }
+ }
+ },
{
"add": {
"rule": {
@@ -6390,6 +6751,25 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
}
}
},
+ {
+ "add": {
+ "element": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "vm-map-in",
+ "elem": [
+ [
+ "tap101i0",
+ {
+ "goto": {
+ "target": "guest-101-in"
+ }
+ }
+ ]
+ ]
+ }
+ }
+ },
{
"add": {
"rule": {
@@ -6425,6 +6805,25 @@ expression: "firewall.full_host_fw().expect(\"firewall can be generated\")"
}
}
},
+ {
+ "add": {
+ "element": {
+ "family": "bridge",
+ "table": "proxmox-firewall-guests",
+ "name": "vm-map-out",
+ "elem": [
+ [
+ "tap101i0",
+ {
+ "goto": {
+ "target": "guest-101-out"
+ }
+ }
+ ]
+ ]
+ }
+ }
+ },
{
"add": {
"rule": {
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH pve-firewall 6/7] firewall: drop the traffic of guest network devices without MAC address
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
` (4 preceding siblings ...)
2026-11-24 17:57 ` [PATCH proxmox-firewall 5/7] tests: add network devices without " Stefan Hanreich
@ 2026-11-24 17:57 ` 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
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
A guest network device can lack a MAC address, for example after a
manual edit of the config. qemu-server and pve-container then use a
random one, which the firewall cannot know.
With the MAC filter enabled, drop all traffic of such a device, as the
MAC filter drops the traffic from any MAC address that is not the one
of the device. So far, the rule was skipped without a MAC address.
Likewise, leave the link-local address out of the default IP filter,
which then drops traffic from link-local addresses of the device.
This changes nothing yet, as the parsers of the guest configs always
generate a MAC address so far.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/PVE/Firewall.pm | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 93af383..053b289 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -2839,8 +2839,9 @@ sub ruleset_create_vm_chain {
}
if ($direction eq 'OUT') {
- if (defined($macaddr) && !(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
- ruleset_addrule($ruleset, $chain, "-m mac ! --mac-source $macaddr", "-j DROP");
+ if (!(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
+ my $match = defined($macaddr) ? "-m mac ! --mac-source $macaddr" : '';
+ ruleset_addrule($ruleset, $chain, $match, "-j DROP");
}
if ($ipversion == 6 && !$options->{radv}) {
ruleset_addrule(
@@ -4817,10 +4818,9 @@ sub compile_ipsets {
}
my $macaddr = $net->{macaddr};
- my $linklocal = mac_to_linklocal($macaddr);
- $device_ips->{$netid} = [
- { cidr => $linklocal }, { cidr => 'fe80::/10', nomatch => 1 },
- ];
+ my $set = $device_ips->{$netid} = [{ cidr => 'fe80::/10', nomatch => 1 }];
+ # without a MAC address, the filter drops traffic from link-local addresses
+ push @$set, { cidr => mac_to_linklocal($macaddr) } if defined($macaddr);
}
generate_ipset_chains(
@@ -4871,10 +4871,9 @@ sub compile_ipsets {
}
my $macaddr = $net->{hwaddr};
- my $linklocal = mac_to_linklocal($macaddr);
- my $set = $device_ips->{$netid} = [
- { cidr => $linklocal }, { cidr => 'fe80::/10', nomatch => 1 },
- ];
+ my $set = $device_ips->{$netid} = [{ cidr => 'fe80::/10', nomatch => 1 }];
+ # without a MAC address, the filter drops traffic from link-local addresses
+ push @$set, { cidr => mac_to_linklocal($macaddr) } if defined($macaddr);
if (defined($net->{ip}) && $net->{ip} =~ m!^($IPV4RE)(?:/\d+)?\z!) {
my $address = $1;
pve_verify_ip_or_cidr($net->{ip});
@@ -5042,14 +5041,17 @@ sub generate_tap_layer2filter {
my $tapchain = $iface . "-OUT";
- # ebtables remove zeros from mac pairs
- $macaddr =~ s/0([0-9a-f])/$1/ig;
- $macaddr = lc($macaddr);
-
ruleset_create_chain($ruleset, $tapchain);
- if (defined($macaddr) && !(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
- ruleset_addrule($ruleset, $tapchain, "-s ! $macaddr", '-j DROP');
+ if (!(defined($options->{macfilter}) && $options->{macfilter} == 0)) {
+ if (defined($macaddr)) {
+ # ebtables remove zeros from mac pairs
+ $macaddr =~ s/0([0-9a-f])/$1/ig;
+ $macaddr = lc($macaddr);
+ ruleset_addrule($ruleset, $tapchain, "-s ! $macaddr", '-j DROP');
+ } else {
+ ruleset_addrule($ruleset, $tapchain, '', '-j DROP');
+ }
}
if (defined($arpfilter)) {
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH pve-firewall 7/7] firewall: do not generate MAC addresses for guest network devices
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
` (5 preceding siblings ...)
2026-11-24 17:57 ` [PATCH pve-firewall 6/7] firewall: drop the traffic of guest " Stefan Hanreich
@ 2026-11-24 17:57 ` 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
7 siblings, 0 replies; 10+ messages in thread
From: Stefan Hanreich @ 2026-11-24 17:57 UTC (permalink / raw)
To: pve-devel
The parsers of qemu-server and pve-container generate a random MAC
address for a network device without one, so each compilation built
the MAC filter and the IP filter from a different address. The filters
dropped the traffic of the device anyway, as the address never matched
the one the guest uses, but the ruleset changed on every compilation,
so it was applied again each time.
Parse the devices without generating a MAC address, so that such a
device has none, and the filters drop its traffic consistently.
pve-container only supports this from the version that fixes starting
containers with such a device. With an older version, a random MAC
address is generated as before.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/PVE/Firewall.pm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 053b289..369d8d8 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -4659,7 +4659,7 @@ sub compile_iptables_filter {
foreach my $netid (sort keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::QemuServer::Network::parse_net($conf->{$netid});
+ my $net = PVE::QemuServer::Network::parse_net($conf->{$netid}, 1);
next if !$net->{firewall};
my $iface = "tap${vmid}i$1";
@@ -4709,7 +4709,7 @@ sub compile_iptables_filter {
foreach my $netid (sort keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid});
+ my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid}, 1);
next if !$net->{firewall};
my $iface = "veth${vmid}i$1";
@@ -4810,7 +4810,7 @@ sub compile_ipsets {
my $device_ips = {};
foreach my $netid (keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::QemuServer::Network::parse_net($conf->{$netid});
+ my $net = PVE::QemuServer::Network::parse_net($conf->{$netid}, 1);
next if !$net->{firewall};
if ($vmfw_conf->{options}->{ipfilter} && !$ipsets->{"ipfilter-$netid"}) {
@@ -4863,7 +4863,7 @@ sub compile_ipsets {
my $device_ips = {};
foreach my $netid (keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid});
+ my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid}, 1);
next if !$net->{firewall};
if ($vmfw_conf->{options}->{ipfilter} && !$ipsets->{"ipfilter-$netid"}) {
@@ -4974,7 +4974,7 @@ sub compile_ebtables_filter {
foreach my $netid (sort keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::QemuServer::Network::parse_net($conf->{$netid});
+ my $net = PVE::QemuServer::Network::parse_net($conf->{$netid}, 1);
next if !$net->{firewall};
my $iface = "tap${vmid}i$1";
next if !valid_interface_name($iface);
@@ -5005,7 +5005,7 @@ sub compile_ebtables_filter {
foreach my $netid (sort keys %$conf) {
next if $netid !~ m/^net(\d+)$/;
- my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid});
+ my $net = PVE::LXC::Config->parse_lxc_network($conf->{$netid}, 1);
next if !$net->{firewall};
my $iface = "veth${vmid}i$1";
next if !valid_interface_name($iface);
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address
2026-11-24 17:57 [PATCH firewall/proxmox{-ve-rs,-firewall} 0/7] firewall: handle guest network devices without a MAC address Stefan Hanreich
` (6 preceding siblings ...)
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 ` Arthur Bied-Charreton
7 siblings, 0 replies; 10+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-25 7:14 UTC (permalink / raw)
To: Stefan Hanreich; +Cc: pve-devel
On Tue, Nov 24, 2026 at 06:57:10PM +0100, Stefan Hanreich wrote:
> A guest network device without a MAC address is valid for qemu-server
> and pve-container, which generate a random one each time they parse the
> device. The API always stores one, but manual edits and restored
> backups are accepted without any MAC or type set.
>
> pve-firewall built its MAC and IP filters from random addresses, a
> different one for each rule and on every compile. With the MAC filter
> enabled, it thus dropped all traffic the device sent, and the IP filter
> dropped traffic from its link-local addresses. (unless you were really
> lucky).
>
> proxmox-firewall failed to parse such a guest's network config
> completely.
>
> Both firewalls now drop the traffic of a device without MAC address
> explicitly if the MAC filter is enabled. and the IP filter drops its
> auto-derived link-local addresses. That keeps the effective behavior
> of pve-firewall, with stable rules, and proxmox-firewall behaves the
> same.
>
[snip]
tested this series with both VM and container guests, works as
advertised!
VM 129 with firewall enabled on net0, MAC address removed
from the config manually (net0: virtio,bridge=tara,firewall=1)
before the series:
- pve-firewall: compile output differed on every run
because of the randomly generated MAC
- proxmox-firewall: compile failed entirely
with the series applied:
- pve-firewall: output is stable, tap129i0-OUT chain now drops
unconditionally instead of matching a random MAC
- proxmox-firewall: compile succeeds, warns that net0 has no MAC and
adds an unconditional drop to guest-129-out
CT 130 firewall and ipfilter enabled, static ipv4 on net0, tested with:
A no hwaddr, no type
B no hwaddr, type=veth
C hwaddr set, no type
before the series:
- pve-firewall: A and B produced a random MAC filter and a random
link-local address in the ipfilter set on every run, C was fine
- proxmox-firewall: compile failed for all 3
with the series:
- pve-firewall: A and B produce stable output with unconditional drop
on veth130i0-OUT and the ipfilter set contains the static IP and
fe80::/10 nomatch entry, C still works
- proxmox-firewall: compile succeeds for all three, A and B warn and
drop unconditionally, C gets the MAC filter
have one comment on one of the proxmox-firewall patches but that's not a
blocker IMO, consider this:
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH proxmox-firewall 4/7] firewall: guest: handle network devices without a MAC address
2026-11-24 17:57 ` [PATCH proxmox-firewall 4/7] firewall: guest: handle " Stefan Hanreich
@ 2026-11-25 7:28 ` Arthur Bied-Charreton
0 siblings, 0 replies; 10+ messages in thread
From: Arthur Bied-Charreton @ 2026-11-25 7:28 UTC (permalink / raw)
To: Stefan Hanreich; +Cc: pve-devel
On Tue, Nov 24, 2026 at 06:57:14PM +0100, Stefan Hanreich wrote:
> A guest network device can lack a MAC address, for example after a
> manual edit of the config. qemu-server and pve-container then use a
> random one, which the firewall cannot know. Such a guest failed the
> parsing of its network config, and with it the whole firewall update.
>
> Leave the device out of the MAC filter, so that the filter drops its
> traffic, like it drops the traffic from any other unknown MAC address.
> If none of the devices of a guest has a MAC address, there is no set
> to match against, so drop all traffic of the guest instead of skipping
> the filter. Likewise, leave the link-local address out of the default
> IP filter, which then drops traffic from link-local addresses of the
> device.
>
> pve-firewall effectively behaves the same, as it builds the filters
> from a random MAC address that does not match the one of the guest.
>
[snip]
> + let mac_address_set: Vec<Expression> = firewall_devices
> + .iter()
> + .filter_map(|(index, device)| {
> + let Some(mac_address) = device.mac_address() else {
> + log::warn!(
> + "guest #{vmid}: net{index} has no MAC address, the MAC filter drops \
> + its traffic"
> + );
this warning gets logged every 5 seconds for each such device. since
rules are compiled for stopped guests as well it can keep going for a
while.
pve-firewall handles the same case silently. i think a warning is good
but maybe we could do it once per device? not a blocker & fine as a
follow-up/future refactor though imo.
[snip]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-25 7:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH proxmox-ve-rs 1/7] ve-config: guest: require the name of container network devices Stefan Hanreich
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
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.