Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions zebra/connected.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ static void connected_remove_kernel_for_connected(afi_t afi, safi_t safi, struct
rib_dest_t *dest;
struct route_table *table = zebra_vrf_table(afi, SAFI_UNICAST, zvrf->vrf->vrf_id);

/*
* Needs to be early as that the actual route_node may not exist yet
*/
rib_meta_queue_early_route_cleanup(p, ZEBRA_ROUTE_KERNEL);

if (!table)
return;

Expand Down
1 change: 1 addition & 0 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ int zebra_rib_queue_evpn_rem_vtep_del(vrf_id_t vrf_id, vni_t vni,

extern void meta_queue_free(struct meta_queue *mq, struct zebra_vrf *zvrf);
extern int zebra_rib_labeled_unicast(struct route_entry *re);
extern void rib_meta_queue_early_route_cleanup(const struct prefix *p, int route_type);
extern struct route_table *rib_table_ipv6;

extern uint32_t zebra_rib_meta_queue_size(void);
Expand Down
32 changes: 32 additions & 0 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,38 @@ static int rib_meta_queue_early_route_add(struct meta_queue *mq, void *data)
return 0;
}

void rib_meta_queue_early_route_cleanup(const struct prefix *p, int route_type)
{
struct listnode *node, *nnode;
struct zebra_early_route *ere;

/* Iterate through the early route subqueue */
for (ALL_LIST_ELEMENTS(zrouter.mq->subq[META_QUEUE_EARLY_ROUTE], node, nnode, ere)) {
/* Check if this entry matches the prefix and route type */
if (prefix_same(&ere->p, p) && ere->re->type == route_type) {
/* Remove from the list */
list_delete_node(zrouter.mq->subq[META_QUEUE_EARLY_ROUTE], node);

/* Update counters */
zrouter.mq->size--;
atomic_fetch_sub_explicit(&zrouter.mq->total_metaq, 1,
memory_order_relaxed);
atomic_fetch_sub_explicit(&zrouter.mq->total_subq[META_QUEUE_EARLY_ROUTE],
1, memory_order_relaxed);

/* Free the early route memory */
early_route_memory_free(ere);

if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
struct vrf *vrf = vrf_lookup_by_id(ere->re->vrf_id);

zlog_debug("Route %pFX(%s) type %d removed from early route queue",
p, VRF_LOGNAME(vrf), route_type);
}
}
}
}

int rib_add_gr_run(afi_t afi, vrf_id_t vrf_id, uint8_t proto, uint8_t instance,
time_t restart_time, bool stale_client_cleanup)
{
Expand Down
Loading