summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ripd/rip_nb_state.c1
-rw-r--r--ripngd/ripng_nb_state.c1
-rw-r--r--zebra/zebra_nb_state.c5
3 files changed, 6 insertions, 1 deletions
diff --git a/ripd/rip_nb_state.c b/ripd/rip_nb_state.c
index e88f33ec6..184c76099 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);
diff --git a/ripngd/ripng_nb_state.c b/ripngd/ripng_nb_state.c
index 926573b40..02a00ac42 100644
--- a/ripngd/ripng_nb_state.c
+++ b/ripngd/ripng_nb_state.c
@@ -144,6 +144,7 @@ ripngd_instance_state_routes_route_get_next(struct nb_cb_get_next_args *args)
rn = agg_route_top(ripng->table);
else
rn = agg_route_next((struct agg_node *)args->list_entry);
+ /* Optimization: skip empty route nodes. */
while (rn && rn->info == NULL)
rn = agg_route_next(rn);
diff --git a/zebra/zebra_nb_state.c b/zebra/zebra_nb_state.c
index e1c06819f..afbabe342 100644
--- a/zebra/zebra_nb_state.c
+++ b/zebra/zebra_nb_state.c
@@ -221,12 +221,15 @@ const void *
lib_vrf_zebra_ribs_rib_route_get_next(struct nb_cb_get_next_args *args)
{
const struct zebra_router_table *zrt = args->parent_list_entry;
- const struct route_node *rn = args->list_entry;
+ struct route_node *rn = (struct route_node *)args->list_entry;
if (args->list_entry == NULL)
rn = route_top(zrt->table);
else
rn = srcdest_route_next((struct route_node *)rn);
+ /* Optimization: skip empty route nodes. */
+ while (rn && rn->info == NULL)
+ rn = route_next(rn);
/* Skip link-local routes. */
if (rn && rn->p.family == AF_INET6