Skip to content

fix(srv6): free the tenant VRF on discard, not only on successful teardown#20

Merged
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-gateway-vrf-leak
Jul 3, 2026
Merged

fix(srv6): free the tenant VRF on discard, not only on successful teardown#20
ryskn merged 1 commit into
dev/srv6egress-v1from
fix/srv6-gateway-vrf-leak

Conversation

@ryskn

@ryskn ryskn commented Jul 3, 2026

Copy link
Copy Markdown
Owner

What

reconcileLocked always allocs a VRF table id before InstallGateway, but teardownLocked (the only caller of vrfs.free) early-returned when st.install == nil. So a policy whose install failed (st.install stays nil) and is later deleted/pruned never freed its VRF — byUID grew unbounded, table ids climbed forever.

Fix

Gate only WithdrawSID/RemoveGateway on st.install != nil; free the VRF unconditionally. Adds TestGateway_FailedInstallFreesVRF.

Review finding

Medium #9.

Test

go test ./calico-vpp-agent/srv6egress/... green; GOOS=linux go vet green.

…rdown

reconcileLocked always allocs a VRF table id before InstallGateway, but
teardownLocked (the only caller of vrfs.free) early-returned when
st.install == nil. A policy whose install failed (st.install stays nil)
and is then deleted or pruned therefore never freed its VRF: byUID grew
unbounded and table ids climbed monotonically.

Restructure teardownLocked to gate only WithdrawSID/RemoveGateway on
st.install != nil and free the VRF unconditionally, restoring alloc/free
symmetry. Adds TestGateway_FailedInstallFreesVRF.
@ryskn ryskn merged commit 89c8286 into dev/srv6egress-v1 Jul 3, 2026
1 check passed
@ryskn ryskn deleted the fix/srv6-gateway-vrf-leak branch July 3, 2026 01:10
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.

1 participant