Skip to content

fix: allow full-width route targets on BGPVRFInstance - #19

Merged
scotwells merged 1 commit into
mainfrom
fix/route-target-uint32-width
Aug 24, 2026
Merged

fix: allow full-width route targets on BGPVRFInstance#19
scotwells merged 1 commit into
mainfrom
fix/route-target-uint32-width

Conversation

@scotwells

Copy link
Copy Markdown
Collaborator

A BGP route target's local administrator is a four-byte value when paired with a two-byte ASN, so it needs ten digits. The RouteTarget CEL rule capped both halves at nine, which rejects every value from 1000000000 up — roughly three quarters of the uint32 range.

Callers that derive the value from the low 32 bits of an identifier hit this constantly.

How this surfaced

galactic's CNI builds the route target in internal/cnibgp/bgp.go:routeTarget() as fmt.Sprintf("%d:%d", asNumber, uint32(v)) — deliberately the low 32 bits of the VPC identifier, so every node in a VRF agrees on it.

On us-central-1-staging-lab, a VPC with the base62 id ky6BQyqU decodes to 72369556180860. Its low word is 3652210556, giving the route target 33438:3652210556 — ten digits, legal BGP, rejected by the rule. Instance attachment fails with:

BGPVRFInstance "41d1d9b04f7c-psi-puborr" is invalid:
spec.importRouteTargets[0]: Invalid value: value must be in ASN:NN or IP:NN format

The value galactic built is correct; the schema was too narrow.

Change

Both halves widen to ten digits. MaxLength=21 already accommodates the longest legal pair (4294967295:4294967295). The dotted IP:NN alternative is untouched.

Adds a chainsaw case asserting 65000:4294967295 is accepted, which fails before this change.

Verified against the live cluster: patching the rule to the widened form let the CR be created (41d1d9b04f7c-psi-puborr, vrfID 1) and the instance's VPC interface attached.

Related

  • datum-cloud/infra#4155

A route target's local administrator is a four-byte value when paired
with a two-byte ASN, so it needs ten digits. The CEL rule capped both
halves at nine, which rejects everything from 1000000000 up -- about
three quarters of the range.

Callers that derive the value from the low 32 bits of an identifier hit
this constantly. galactic's CNI does exactly that, and a VPC whose low
word lands above 1e9 fails its attachment with "value must be in ASN:NN
or IP:NN format" even though the value it built is a legal route target.

Widen both halves to ten digits. MaxLength=21 already accommodates the
longest legal pair.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@scotwells
scotwells requested a review from a team as a code owner August 24, 2026 19:39
@scotwells
scotwells requested a review from AriaEdo August 24, 2026 19:39
@scotwells
scotwells merged commit 6afcb61 into main Aug 24, 2026
6 checks passed
@scotwells
scotwells deleted the fix/route-target-uint32-width branch August 24, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants