Skip to content

fix(vpcnatgateway): bgp speaker would crash if no ipv4 is available#6059

Merged
oilbeater merged 1 commit intokubeovn:masterfrom
SkalaNetworks:fix-ipv6-natgw
Dec 16, 2025
Merged

fix(vpcnatgateway): bgp speaker would crash if no ipv4 is available#6059
oilbeater merged 1 commit intokubeovn:masterfrom
SkalaNetworks:fix-ipv6-natgw

Conversation

@SkalaNetworks
Copy link
Copy Markdown
Member

GoBGP v4 seems to crash when serializing with an invalid RouterID, whereas on older version, it defaulted to 0.0.0.0. There's functionally no problem with multiple peers having the same RouterID when doing eBGP. If using route reflectors, it might be more of a problem. In that case, users can use the --router-id parameter. Note that this case should not occur anyway, the NAT GW doesn't support IPv6 only networks right now as it cannot do NATv6. This is purely a failover to prevent crashes.

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)

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 15, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @SkalaNetworks, 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 provides a crucial fix to prevent the BGP speaker from crashing in scenarios where an IPv4 address is not available for its RouterID. It ensures that the RouterID defaults to '0.0.0.0' to maintain compatibility and stability with GoBGP v4. Additionally, the change includes making the pod's IP addresses explicitly accessible to the speaker container via an environment variable, which is essential for the updated RouterID determination logic.

Highlights

  • BGP Speaker Crash Fix: Addresses a critical bug where the GoBGP v4 speaker would crash if no IPv4 address was available to be used as the RouterID, which previously defaulted to '0.0.0.0' in older versions.
  • RouterID Fallback: Implements a fallback mechanism to explicitly set the BGP RouterID to '0.0.0.0' when an IPv4 address is not detected for the speaker, ensuring stability and preventing crashes.
  • POD_IPS Environment Variable: Introduces the POD_IPS environment variable to the BGP speaker container, making the pod's IP addresses (both IPv4 and IPv6) available for configuration logic.
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.

@dosubot dosubot bot added the bug Something isn't working label Dec 15, 2025
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 crash in the BGP speaker when no IPv4 address is available by falling back to 0.0.0.0 as the router ID. While the intent is correct, the implementation introduces two critical issues. In pkg/speaker/config.go, a necessary nil check is removed, which can lead to a panic. In pkg/util/vpc_nat_gateway.go, a missing comma in a struct literal will cause a compilation failure. I have provided suggestions to fix both of these critical issues.

@SkalaNetworks SkalaNetworks force-pushed the fix-ipv6-natgw branch 2 times, most recently from aa3e8d6 to 6bc7423 Compare December 15, 2025 18:21
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Dec 15, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 15, 2025

Pull Request Test Coverage Report for Build 20243397977

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 22.351%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/speaker/config.go 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/speaker/config.go 1 0.0%
Totals Coverage Status
Change from base Build 20235791399: 0.004%
Covered Lines: 11776
Relevant Lines: 52686

💛 - Coveralls

GoBGP v4 seems to crash when serializing with an invalid RouterID, whereas on older version, it defaulted to 0.0.0.0. There's functionally no problem with multiple peers having the same RouterID when doing eBGP. If using route reflectors, it might be more of a problem. In that case, users can use the --router-id parameter. Note that this case should not occur anyway, the NAT GW doesn't support IPv6 only networks right now as it cannot do NATv6. This is purely a failover to prevent crashes.

Signed-off-by: SkalaNetworks <contact@skala.network>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 16, 2025
@oilbeater oilbeater merged commit d1044aa into kubeovn:master Dec 16, 2025
73 of 75 checks passed
donghee-park-rsk pushed a commit to donghee-park-rsk/kube-ovn that referenced this pull request Jan 5, 2026
…ubeovn#6059)

GoBGP v4 seems to crash when serializing with an invalid RouterID, whereas on older version, it defaulted to 0.0.0.0. There's functionally no problem with multiple peers having the same RouterID when doing eBGP. If using route reflectors, it might be more of a problem. In that case, users can use the --router-id parameter. Note that this case should not occur anyway, the NAT GW doesn't support IPv6 only networks right now as it cannot do NATv6. This is purely a failover to prevent crashes.

Signed-off-by: SkalaNetworks <contact@skala.network>
Signed-off-by: donghee-park-rsk <donghee.park@rakuten.com>
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 size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants