summaryrefslogtreecommitdiff
path: root/ripd/rip_nb_state.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-05-18 23:26:53 -0300
committerRenato Westphal <renato@opensourcerouting.org>2020-05-15 23:47:43 -0300
commit78769ea20595351136cff1fcf3ce0448b0cd4e21 (patch)
treec45a3c8b6bbe1132c029273a66be0d1a088331cf /ripd/rip_nb_state.c
parent9b4d578f4118ef85ddb1afc5d01ddbcec7e3cce1 (diff)
zebra: optimize the RIB get_next() callback
When fetching the next route node in the RIB, skip the empty ones to avoid calling other northbound callbacks later unnecessarily. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd/rip_nb_state.c')
-rw-r--r--ripd/rip_nb_state.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ripd/rip_nb_state.c b/ripd/rip_nb_state.c
index e88f33ec68..184c760998 100644
--- a/ripd/rip_nb_state.c
+++ b/ripd/rip_nb_state.c
@@ -175,6 +175,7 @@ ripd_instance_state_routes_route_get_next(struct nb_cb_get_next_args *args)
rn = route_top(rip->table);
else
rn = route_next((struct route_node *)args->list_entry);
+ /* Optimization: skip empty route nodes. */
while (rn && rn->info == NULL)
rn = route_next(rn);