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: c5d1e35f99 ('device: support reapplying bridge-port VLANs')
This commit is contained in:
Beniamino Galvani 2025-07-08 15:09:25 +02:00
parent f655cd1cba
commit bf79fbd678

View file

@ -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;