fix vrf active value in YANG oper-state#20633
Merged
Jafaral merged 3 commits intoFRRouting:masterfrom Jan 30, 2026
Merged
Conversation
Contributor
choppsv1
commented
Jan 30, 2026
- lib: Check vrf active state as a flag not with == VRF_ACTIVE
- tests: Update oper-state test to explicitly configure the vrf in FRR so that the VRF_CONFIGURED flag gets set and exposes the bug and verifies the fix.
- lib: Drop vrf's YANG state cache, and just use new printf variants nb_notif_addf() nb_notif_deletef().
- tests: Extend notify topotest to verify these changes.
Update one test to explicitly configure the vrf in FRR so that the VRF_CONFIGURED flag gets set and exposes the bug and verifies the fix. Signed-off-by: Christian Hopps <chopps@labn.net>
- use new path "printf" variants for nb_notif_add() nb_notif_delete() functions. Signed-off-by: Christian Hopps <chopps@labn.net>
- also modify the mgmt_testc client. We need to improve this further to load whatever modules are needed by the user provided paths to listen for. Signed-off-by: Christian Hopps <chopps@labn.net>
Greptile OverviewGreptile SummaryThis PR fixes a critical bug where VRF active state was incorrectly reported in YANG operational state when both Key changes:
The refactoring improves the architecture by eliminating the cached YANG state tree and using direct notifications, making the code simpler and more maintainable. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant VtyShell
participant VRF Module
participant Northbound
participant YANG State
participant Management Daemon
Note over User,Management Daemon: VRF Creation Flow
User->>VtyShell: Configure VRF (vrf red)
VtyShell->>VRF Module: vrf_get(name="red")
VRF Module->>VRF Module: Create/lookup VRF struct
VRF Module->>VRF Module: SET_FLAG(status, VRF_CONFIGURED)
VRF Module->>Northbound: nb_notif_addf("/frr-vrf:lib/vrf[name='red']")
Northbound->>Northbound: darr_vsprintf(path, args)
Northbound->>Northbound: nb_notif_add(formatted_path)
Northbound->>Management Daemon: Queue notification
Note over User,Management Daemon: VRF Activation Flow (kernel link up)
User->>VRF Module: ip link add red (kernel event)
VRF Module->>VRF Module: vrf_enable()
VRF Module->>VRF Module: SET_FLAG(status, VRF_ACTIVE)
VRF Module->>VRF Module: vrf_update_state()
VRF Module->>Northbound: nb_notif_addf("/frr-vrf:lib/vrf[name='red']/state")
Northbound->>Management Daemon: REPLACE notification
Note over YANG State: State Query (Fixed Bug Here)
Management Daemon->>VRF Module: lib_vrf_state_active_get_elem()
VRF Module->>VRF Module: CHECK_FLAG(status, VRF_ACTIVE)
Note right of VRF Module: OLD: status == VRF_ACTIVE (BUG!)<br/>NEW: CHECK_FLAG(status, VRF_ACTIVE)<br/>Correctly handles multiple flags
VRF Module->>Management Daemon: return yang_data_new_bool(active)
Note over User,Management Daemon: VRF Deletion Flow
User->>VtyShell: Delete VRF (no vrf red)
VtyShell->>VRF Module: vrf_delete()
VRF Module->>VRF Module: UNSET_FLAG(status, VRF_CONFIGURED)
VRF Module->>Northbound: nb_notif_deletef("/frr-vrf:lib/vrf[name='red']")
Northbound->>Management Daemon: DELETE notification
|
Contributor
Author
|
@Mergifyio backport stable/10.5 |
✅ Backports have been createdDetails
|
Jafaral
added a commit
that referenced
this pull request
Jan 30, 2026
fix vrf active value in YANG oper-state (backport #20633)
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.