diff options
Diffstat (limited to 'bgpd/bgp_evpn_mh.c')
| -rw-r--r-- | bgpd/bgp_evpn_mh.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index f064f87830..8f81278dee 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -699,7 +699,6 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp, int ret; afi_t afi; safi_t safi; - char buf[PREFIX_STRLEN]; struct bgp_dest *rd_dest, *dest; struct bgp_table *table; struct bgp_path_info *pi; @@ -744,13 +743,11 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp, if (ret) { flog_err( - EC_BGP_EVPN_FAIL, - "Failed to %s EVPN %s route in ESI %s", - install ? "install" + EC_BGP_EVPN_FAIL, + "Failed to %s EVPN %pFX route in ESI %s", + install ? "install" : "uninstall", - prefix2str(evp, buf, - sizeof(buf)), - es->esi_str); + evp, es->esi_str); return ret; } } @@ -1316,11 +1313,14 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi) * This just frees appropriate memory, caller should have taken other * needed actions. */ -static void bgp_evpn_es_free(struct bgp_evpn_es *es) +static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller) { if (es->flags & (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) return; + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("%s: es %s free", caller, es->esi_str); + /* cleanup resources maintained against the ES */ list_delete(&es->es_evi_list); list_delete(&es->es_vtep_list); @@ -1367,7 +1367,7 @@ static void bgp_evpn_es_local_info_clear(struct bgp_evpn_es *es) bf_release_index(bm->rd_idspace, es->rd_id); - bgp_evpn_es_free(es); + bgp_evpn_es_free(es, __func__); } /* eval remote info associated with the ES */ @@ -1378,7 +1378,7 @@ static void bgp_evpn_es_remote_info_re_eval(struct bgp_evpn_es *es) } else { if (CHECK_FLAG(es->flags, BGP_EVPNES_REMOTE)) { UNSET_FLAG(es->flags, BGP_EVPNES_REMOTE); - bgp_evpn_es_free(es); + bgp_evpn_es_free(es, __func__); } } } @@ -2320,7 +2320,7 @@ int bgp_evpn_remote_es_evi_add(struct bgp *bgp, struct bgpevpn *vpn, if (!es_evi) { es_evi = bgp_evpn_es_evi_new(es, vpn); if (!es_evi) { - bgp_evpn_es_free(es); + bgp_evpn_es_free(es, __func__); return -1; } } @@ -2903,17 +2903,15 @@ void bgp_evpn_mh_finish(void) { struct bgp_evpn_es *es; struct bgp_evpn_es *es_next; - struct bgp *bgp; - bgp = bgp_get_evpn(); - if (bgp) { - RB_FOREACH_SAFE(es, bgp_es_rb_head, - &bgp_mh_info->es_rb_tree, es_next) { - /* XXX - need to force free remote ESs here */ - bgp_evpn_local_es_do_del(bgp, es); - } + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) + zlog_debug("evpn mh finish"); + + RB_FOREACH_SAFE (es, bgp_es_rb_head, &bgp_mh_info->es_rb_tree, + es_next) { + bgp_evpn_es_local_info_clear(es); } - thread_cancel(bgp_mh_info->t_cons_check); + thread_cancel(&bgp_mh_info->t_cons_check); list_delete(&bgp_mh_info->local_es_list); list_delete(&bgp_mh_info->pend_es_list); |
