Add info_count to route_table for accurate RIB entry reporting #20206
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.
Description
This PR adds a new info_count field to struct route_table that tracks only nodes with actual data (info != NULL), excluding auxiliary/glue nodes that exist solely for the Patricia trie structure.
Problem
BGP stores prefix destinations using the Patricia trie in lib/table.[ch].
This data structure requires auxiliary glue nodes to preserve tree structure invariants.
The show ip bgp summary command displays "RIB entries" using route_table_count(),
which counts all nodes in the Patricia trie, including internal glue nodes.
This is misleading because glue nodes don't represent actual routes.
Example - Before (incorrect):
In this example, there are only 4 actual prefixes (PfxSnt 4), but "RIB entries" shows 7 because it includes 3 auxiliary glue nodes created by the Patricia trie structure.
Example - After (correct):
Solution
Add info_count field to struct route_table to track nodes with info != NULL
Add route_node_set_info() helper function that automatically maintains info_count when setting/clearing a node's info pointer
Update BGP to use route_node_set_info()