@@ -4450,6 +4450,38 @@ static int rib_meta_queue_early_route_add(struct meta_queue *mq, void *data)
44504450 return 0 ;
44514451}
44524452
4453+ void rib_meta_queue_early_route_cleanup (const struct prefix * p , int route_type )
4454+ {
4455+ struct listnode * node , * nnode ;
4456+ struct zebra_early_route * ere ;
4457+
4458+ /* Iterate through the early route subqueue */
4459+ for (ALL_LIST_ELEMENTS (zrouter .mq -> subq [META_QUEUE_EARLY_ROUTE ], node , nnode , ere )) {
4460+ /* Check if this entry matches the prefix and route type */
4461+ if (prefix_same (& ere -> p , p ) && ere -> re -> type == route_type ) {
4462+ /* Remove from the list */
4463+ list_delete_node (zrouter .mq -> subq [META_QUEUE_EARLY_ROUTE ], node );
4464+
4465+ /* Update counters */
4466+ zrouter .mq -> size -- ;
4467+ atomic_fetch_sub_explicit (& zrouter .mq -> total_metaq , 1 ,
4468+ memory_order_relaxed );
4469+ atomic_fetch_sub_explicit (& zrouter .mq -> total_subq [META_QUEUE_EARLY_ROUTE ],
4470+ 1 , memory_order_relaxed );
4471+
4472+ /* Free the early route memory */
4473+ early_route_memory_free (ere );
4474+
4475+ if (IS_ZEBRA_DEBUG_RIB_DETAILED ) {
4476+ struct vrf * vrf = vrf_lookup_by_id (ere -> re -> vrf_id );
4477+
4478+ zlog_debug ("Route %pFX(%s) type %d removed from early route queue" ,
4479+ p , VRF_LOGNAME (vrf ), route_type );
4480+ }
4481+ }
4482+ }
4483+ }
4484+
44534485int rib_add_gr_run (afi_t afi , vrf_id_t vrf_id , uint8_t proto , uint8_t instance ,
44544486 time_t restart_time , bool stale_client_cleanup )
44554487{
0 commit comments