Skip to content

cni-server: fix vlan id reference#6365

Merged
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-fdb
Feb 28, 2026
Merged

cni-server: fix vlan id reference#6365
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-fdb

Conversation

@zhangzujian
Copy link
Copy Markdown
Member

Pull Request

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes

Fixes #(issue-number)

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zhangzujian zhangzujian added bug Something isn't working need backport labels Feb 28, 2026
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 28, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug in the CNI server where an incorrect field was referenced for the VLAN ID when creating FDB (Forwarding Database) entries. By updating the code to use the correct VLAN ID field, this change ensures that FDB entries are accurately generated, preventing potential network misconfigurations or connectivity issues related to VLANs.

Highlights

  • VLAN ID Reference Fix: Corrected the field used to retrieve the VLAN ID when constructing FDB entries, switching from vlan.Spec.VlanID to vlan.Spec.ID.
Changelog
  • pkg/daemon/fdb.go
    • Updated the fdbIndex creation to correctly reference vlan.Spec.ID instead of vlan.Spec.VlanID.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix a reference to a deprecated VLAN ID field. While the change correctly uses the new vlan.Spec.ID field, it overlooks backward compatibility for existing resources that might only have the deprecated vlan.Spec.VlanID field populated. This could lead to incorrect network behavior. I've added a comment with a suggestion to handle this transition gracefully.

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}

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 28, 2026
@zhangzujian zhangzujian merged commit b0d58bb into kubeovn:master Feb 28, 2026
77 checks passed
zhangzujian added a commit that referenced this pull request Feb 28, 2026
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
zhangzujian added a commit that referenced this pull request Feb 28, 2026
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zhangzujian zhangzujian deleted the fix-fdb branch February 28, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer need backport size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants