Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/daemon/fdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (c *Controller) syncFdb() {
klog.Warningf("patch port %s not found on bridge %s", port, bridge)
continue
}
index := fdbIndex{vlan.Spec.VlanID, subnet.Status.U2OInterconnectionMAC}
index := fdbIndex{vlan.Spec.ID, subnet.Status.U2OInterconnectionMAC}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While this change correctly moves towards using the non-deprecated ID field, it could introduce a bug. If an existing Vlan custom resource was created using only the deprecated vlanId field, vlan.Spec.ID would be 0 while vlan.Spec.VlanID holds the correct value. This would result in installing an FDB entry for VLAN 0, which is likely incorrect, as VLAN 0 is typically used for untagged traffic.

To ensure backward compatibility during the transition period, I suggest adding a fallback to the deprecated field when the new ID field is not set. A more robust long-term solution would be to implement migration logic in the vlan controller (or a conversion webhook) to populate ID from VlanID on resource reconciliation, making ID the single source of truth throughout the codebase.

		vlanID := vlan.Spec.ID
		if vlan.Spec.ID == 0 && vlan.Spec.VlanID != 0 {
			vlanID = vlan.Spec.VlanID
		}
		index := fdbIndex{vlanID, subnet.Status.U2OInterconnectionMAC}

entries := current[bridge]
if entries != nil && entries[index] == port {
// the fdb entry already exists, remove it from current entries to avoid deletion
Expand Down