diff --git a/zebra/rib.h b/zebra/rib.h index 65cc1ffab914..466c001bfee5 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -407,7 +407,8 @@ extern void rib_sweep_route(struct event *t); extern void rib_sweep_table(struct route_table *table); extern void rib_close_table(struct route_table *table); extern void rib_init(void); -extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance); +extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance, + uint32_t session_id); extern unsigned long rib_score_proto_table(uint8_t proto, unsigned short instance, struct route_table *table); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 357f11282189..4c75ce6593d7 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4627,12 +4627,19 @@ unsigned long rib_score_proto_table(uint8_t proto, unsigned short instance, } /* Remove specific by protocol routes. */ -unsigned long rib_score_proto(uint8_t proto, unsigned short instance) +unsigned long rib_score_proto(uint8_t proto, unsigned short instance, + uint32_t session_id) { struct vrf *vrf; struct zebra_vrf *zvrf; struct other_route_table *ort; unsigned long cnt = 0; + /* If this is a synchronous BGP Zebra client for label/table + * manager, then ignore it. It's not GR-aware, and causes GR to + * be skipped for the session_id == 0 (asynchronous). + */ + if (proto == ZEBRA_ROUTE_BGP && session_id == 1) + return cnt; RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { zvrf = vrf->info; diff --git a/zebra/zserv.c b/zebra/zserv.c index 85e1edeca069..9288a4225b21 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -587,18 +587,12 @@ static void zserv_client_free(struct zserv *client) close(client->sock); - /* If this is a synchronous BGP Zebra client for label/table - * manager, then ignore it. It's not GR-aware, and causes GR to - * be skipped for the session_id == 0 (asynchronous). - */ - if (client->proto == ZEBRA_ROUTE_BGP && client->session_id == 1) - return; - if (DYNAMIC_CLIENT_GR_DISABLED(client)) { zebra_mpls_client_cleanup_vrf_label(client->proto); nroutes = rib_score_proto(client->proto, - client->instance); + client->instance, + client->session_id); zlog_notice( "client %d disconnected %lu %s routes removed from the rib", client->sock, nroutes,