Skip to content

Install a VPC static route over a BGP route for the same prefix - #14942

Open
MitchDrage wants to merge 1 commit into
apache:mainfrom
MitchDrage:static-route-over-bgp
Open

MitchDrage wants to merge 1 commit into
apache:mainfrom
MitchDrage:static-route-over-bgp

Conversation

@MitchDrage

Copy link
Copy Markdown
Contributor

Description

This PR programs a VPC static route when the router already has a BGP route for the same prefix.
Today the static isn't programmed, because CsStaticRoutes.py only adds a route when ip route show | grep '^<prefix>' finds nothing for that prefix. If the static is there first, it stays and BGP never replaces it, so whichever route arrives first wins and the result can flip after a router restart.

  • The check ignores routes with proto bgp, so the static is added at metric 0 beside the BGP route.
  • zebra sees the static as a kernel route (distance 0) and withdraws its own route from the kernel.
  • New unit test TestCsStaticRoutes.

Operator BGP peers only accept a default route, so this comes up with tenant BGP on private gateways (#14687). There, keeping the static routes in place while BGP comes up is the migration path.

Closes: #14941

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

  • Unit tests in TestCsStaticRoutes: a route is added to an empty table, is not added twice, and is added over a single-path and a multipath BGP route. The two BGP tests fail without this change. The mocked execute runs the real grep pipeline against a sample route table.
  • A lab running the router's CsStaticRoutes.py against FRR 8.4.4 on Debian 12, with two BGP peers announcing the same prefix:
Before this PR With this PR
BGP route present, static added Static skipped, BGP carries traffic Static carries traffic
Static present, BGP learns the prefix Static carries traffic Static carries traffic
  • With the change, the static held through BGP session resets, the peers withdrawing and re-announcing the prefix, and a zebra restart. Removing the static brought the BGP route back at once.

How did you try to break this feature and the system with this change?

  • Sent the same static route twice. It is added once, as before.
  • A static for 0.0.0.0/0 with the public default route present still fails with File exists, as on main.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static route on a VPC VR should win over a BGP route for the same prefix

1 participant