feat(srv6): RFC 9256 candidate-path selection, dynamic BSID, SID verification, drop-upon-invalid#38
Merged
ryskn merged 1 commit intoJul 6, 2026
Conversation
…fication, drop-upon-invalid Port the RFC 9256/9830 receiver features from the safi73-vpp PoC into the agent's SR Policy path (bgp_watcher -> SRv6Provider). Selection (§2.9): getPolicyNode picked the highest Priority, which is wrong on two axes -- selection is Preference's job (higher wins, default 100, was not even parsed), and Priority orders revalidation with LOWER value first (§2.12, default 128, was defaulting to 0 = most urgent). Selection is now preference-based with §2.9 tie-breaks (lower originator from the BGP path source, then higher discriminator); Priority orders the RescanState revalidation sweep instead. Dynamic BSID (§6.2.1): advertisements without a BSID used to install an unusable all-zero-BSID policy. The provider now binds a BSID from the policy pool via Calico IPAM (handle-scoped per <endpoint, color>, stable across candidate switches, released with the last candidate, reclaimed across agent restarts). S-Flag (Specified-BSID-only, §6.2.3) still rejects. SID verification (§5.1): the first SID of every segment list, plus any segment with the V-Flag, must resolve in the FIB to a non-drop path or the list is invalid; lookup failures fail open. Adds vpplink.RouteLookup (LPM) and IsDrop mapping in FromFibPath. Drop-upon-invalid (§8.2, I-Flag): when a policy still has candidates but none is valid, orphaned steerings get a fail-closed drop route (FibTable preserved) instead of falling back to routing; lifted on recovery or when the policy's last candidate is withdrawn. Watcher parsing also gains: SRv6 Binding SID sub-TLV (type 20, arrives from gobgp as Unknown; preferred over type 13 per RFC 9830 §2.4.2), S/I flags, V-Flag masks, weight-0 rejection (§5.1), first-instance-wins sub-TLVs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Port the RFC 9256/9830 receiver-side features from the safi73-vpp PoC into the agent's SR Policy path (
bgp_watcher→SRv6Provider).getPolicyNodeselected by highest Priority — wrong on two axes. Selection belongs to Preference (higher wins, default 100; previously not parsed at all), while Priority orders revalidation with lower value first (§2.12, default 128; previously defaulted to 0 = most urgent). Selection is now preference-based with §2.9 tie-breaks (lower originator carried from the BGP path source, then higher discriminator). Priority now orders theRescanStaterevalidation sweep (revalidatePolicies).<endpoint, color>, stable across candidate switches, released with the last candidate, and reclaimed across agent restarts (release-before-assign on the same handle). S-Flag (Specified-BSID-only, §6.2.3) rejects instead.::/0default-drop counted as unreachable). Lookup failures fail open. Addsvpplink.RouteLookup(LPM) andIsDropmapping inFromFibPath.RoutePath{IsDrop}, FibTable preserved so the PodVRF node-IP steering drops in the right table) instead of escaping to routing. Lifted before re-steering on recovery, or when the policy's last candidate is withdrawn (policy gone → fail-open per RFC).Unknown, decoded raw and preferred over type 13 per RFC 9830 §2.4.2), S/I flags, V-Flag masks per list, weight-0 rejection (§5.1), first-instance-wins for single-instance sub-TLVs.Existing behaviors kept: >16-SID and SegmentTypeA rejection, NLRI-key replacement, failover re-steer, deferred BSID cleanup.
Notes
RescanStateinstead).Test
New:
routing/srpolicy_parse_test.go(defaults, S/I flags, type-20 preference, V-mask, weight-0, S-Flag-without-BSID) and 9 provider tests (preference selection + tie-breaks, dynamic BSID alloc/stability/release, S-Flag invalid, unreachable-first-SID / V-Flag / fail-open, drop engage / recovery / policy-gone release, priority-ordered revalidation).GOOS=linux go buildgreen for the whole module;go test ./calico-vpp-agent/connectivity/ ./calico-vpp-agent/routing/ ./vpplink/types/ ./srv6egress/...green (linux container, golang:1.26).