Skip to content

Commit

Permalink
zebra: Fix removal of routes on MetaQ when client goes down
Browse files Browse the repository at this point in the history
It is possible that right before an upper level protocol dies
or is killed routes would be installed into zebra.  These routes
could be on the Meta-Q for early route-processing.  Leaving us with
a situation where the client is removed, and all it's routes that are
in the rib at that time, and then after that the MetaQ is run and the
routes are reprocessed leaving routes from an upper level daemon
post daemon going away from zebra's perspective.  These routes will
be abandoned.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Jul 30, 2024
1 parent 6186368 commit e88341c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3837,7 +3837,8 @@ static void rib_meta_queue_free(struct meta_queue *mq, struct list *l,
}

static void early_route_meta_queue_free(struct meta_queue *mq, struct list *l,
struct zebra_vrf *zvrf)
struct zebra_vrf *zvrf, uint8_t proto,
uint8_t instance)
{
struct zebra_early_route *ere;
struct listnode *node, *nnode;
Expand All @@ -3846,6 +3847,10 @@ static void early_route_meta_queue_free(struct meta_queue *mq, struct list *l,
if (zvrf && ere->re->vrf_id != zvrf->vrf->vrf_id)
continue;

if (proto != ZEBRA_ROUTE_ALL &&
(proto != ere->re->type && instance != ere->re->instance))
continue;

early_route_memory_free(ere);
node->data = NULL;
list_delete_node(l, node);
Expand Down Expand Up @@ -3884,7 +3889,8 @@ void meta_queue_free(struct meta_queue *mq, struct zebra_vrf *zvrf)
evpn_meta_queue_free(mq, mq->subq[i], zvrf);
break;
case META_QUEUE_EARLY_ROUTE:
early_route_meta_queue_free(mq, mq->subq[i], zvrf);
early_route_meta_queue_free(mq, mq->subq[i], zvrf,
ZEBRA_ROUTE_ALL, 0);
break;
case META_QUEUE_EARLY_LABEL:
early_label_meta_queue_free(mq, mq->subq[i], zvrf);
Expand Down Expand Up @@ -4752,6 +4758,10 @@ unsigned long rib_score_proto(uint8_t proto, unsigned short instance)
if (!zvrf)
continue;

early_route_meta_queue_free(zrouter.mq,
zrouter.mq->subq[META_QUEUE_EARLY_ROUTE],
zvrf, proto, instance);

cnt += rib_score_proto_table(proto, instance,
zvrf->table[AFI_IP][SAFI_UNICAST])
+ rib_score_proto_table(
Expand Down

0 comments on commit e88341c

Please sign in to comment.