From 956f9ba365c18bf00d91ffd0842c09932dd9a5ec Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 8 Jul 2025 15:09:25 +0200 Subject: [PATCH] bridge: fix reapplying port VLANs If the bridge default-pvid is zero, it means that the default PVID is disabled. That is, the bridge PVID is not propagated to ports. Currently NM tries to merge the existing bridge VLANs on the port with the default PVID from the bridge, even when the PVID is zero. This causes an error when setting the new VLAN list in the kernel, because it rejects VLAN zero. Skip the merge of the default PVID when zero. Fixes: c5d1e35f993e ('device: support reapplying bridge-port VLANs') (cherry picked from commit bf79fbd6780fd38ca29c12a137951c8729379767) --- src/core/devices/nm-device-bridge.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/devices/nm-device-bridge.c b/src/core/devices/nm-device-bridge.c index 7c34fde07f..45cdd83f07 100644 --- a/src/core/devices/nm-device-bridge.c +++ b/src/core/devices/nm-device-bridge.c @@ -735,6 +735,11 @@ merge_bridge_vlan_default_pvid(NMPlatformBridgeVlan *vlans, guint *num_vlans, gu gboolean has_pvid = FALSE; guint i; + if (default_pvid == 0) { + /* default_pvid=0 means that the default PVID is disabled. No need to merge it. */ + return vlans; + } + for (i = 0; i < *num_vlans; i++) { if (vlans[i].pvid) { has_pvid = TRUE;