From d656e0aea6f51bfac46a0d7812bdfc1661295a60 Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Tue, 18 Aug 2020 06:52:40 -0700 Subject: [PATCH] bgpd: Rename macip_path_list to macip_evi_path_list This is done to clearly indicate what routes are being linked to the list i.e. MAC-IP routes in the VNI table. Signed-off-by: Anuradha Karuppiah --- bgpd/bgp_evpn_mh.c | 35 ++++++++++++++++++----------------- bgpd/bgp_evpn_mh.h | 2 +- bgpd/bgp_evpn_vty.c | 20 +++++++++++--------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 41640efb34..c7e6c01758 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -1433,7 +1433,7 @@ void bgp_evpn_path_es_unlink(struct bgp_path_es_info *es_info) zlog_debug("vni %u path %pFX unlinked from es %s", es_info->vni, &pi->net->p, es->esi_str); - list_delete_node(es->macip_path_list, &es_info->es_listnode); + list_delete_node(es->macip_evi_path_list, &es_info->es_listnode); es_info->es = NULL; /* if there are no other references against the ES it @@ -1486,7 +1486,7 @@ void bgp_evpn_path_es_link(struct bgp_path_info *pi, vni_t vni, esi_t *esi) /* link mac-ip path to the new destination ES */ es_info->es = es; listnode_init(&es_info->es_listnode, es_info); - listnode_add(es->macip_path_list, &es_info->es_listnode); + listnode_add(es->macip_evi_path_list, &es_info->es_listnode); } /* XXX - When a remote ES is added to a VRF, routes using that as @@ -1515,7 +1515,7 @@ bgp_evpn_es_path_update_on_vtep_chg(struct bgp_evpn_es_vtep *es_vtep, zlog_debug("update paths linked to es %s on vtep chg", es->esi_str); - for (ALL_LIST_ELEMENTS_RO(es->macip_path_list, node, es_info)) { + for (ALL_LIST_ELEMENTS_RO(es->macip_evi_path_list, node, es_info)) { pi = es_info->pi; if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)) continue; @@ -1591,8 +1591,8 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi) listset_app_node_mem(es->es_vrf_list); /* Initialise the route list used for efficient event handling */ - es->macip_path_list = list_new(); - listset_app_node_mem(es->macip_path_list); + es->macip_evi_path_list = list_new(); + listset_app_node_mem(es->macip_evi_path_list); QOBJ_REG(es, bgp_evpn_es); @@ -1606,7 +1606,7 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi) static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller) { if ((es->flags & (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) - || listcount(es->macip_path_list)) + || listcount(es->macip_evi_path_list)) return; if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) @@ -1616,7 +1616,7 @@ static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller) list_delete(&es->es_evi_list); list_delete(&es->es_vrf_list); list_delete(&es->es_vtep_list); - list_delete(&es->macip_path_list); + list_delete(&es->macip_evi_path_list); bgp_table_unlock(es->route_table); /* remove the entry from various databases */ @@ -1692,8 +1692,9 @@ bool bgp_evpn_es_add_l3_ecomm_ok(esi_t *esi) || bgp_evpn_local_es_is_active(es)); } -/* Update all MAC-IP routes associated with the ES. When the ES is down - * the routes are advertised without the L3 extcomm +/* Update all local MAC-IP routes in the VNI routing table associated + * with the ES. When the ES is down the routes are advertised without + * the L3 extcomm */ static void bgp_evpn_mac_update_on_es_oper_chg(struct bgp_evpn_es *es) { @@ -1712,7 +1713,7 @@ static void bgp_evpn_mac_update_on_es_oper_chg(struct bgp_evpn_es *es) es->esi_str); bgp = bgp_get_evpn(); - for (ALL_LIST_ELEMENTS_RO(es->macip_path_list, node, es_info)) { + for (ALL_LIST_ELEMENTS_RO(es->macip_evi_path_list, node, es_info)) { pi = es_info->pi; if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)) continue; @@ -2184,7 +2185,7 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty, json_object_int_add(json, "vrfCount", listcount(es->es_vrf_list)); json_object_int_add(json, "macipPathCount", - listcount(es->macip_path_list)); + listcount(es->macip_evi_path_list)); json_object_int_add(json, "inconsistentVniVtepCount", es->incons_evi_vtep_cnt); if (listcount(es->es_vtep_list)) { @@ -2233,7 +2234,7 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty, es->remote_es_evi_cnt); vty_out(vty, " VRF Count: %d\n", listcount(es->es_vrf_list)); vty_out(vty, " MACIP Path Count: %d\n", - listcount(es->macip_path_list)); + listcount(es->macip_evi_path_list)); vty_out(vty, " Inconsistent VNI VTEP Count: %d\n", es->incons_evi_vtep_cnt); if (es->inconsistencies) { @@ -2576,11 +2577,6 @@ static void bgp_evpn_es_vrf_delete(struct bgp_evpn_es_vrf *es_vrf) zlog_debug("es %s vrf %u nhg %u delete", es->esi_str, bgp_vrf->vrf_id, es_vrf->nhg_id); - /* update paths in the VRF that may already be associated with - * this destination ES - */ - bgp_evpn_es_path_update_on_es_vrf_chg(es_vrf, false); - /* Remove the NHG resources */ bgp_evpn_l3nhg_deactivate(es_vrf); if (es_vrf->nhg_id) @@ -2596,6 +2592,11 @@ static void bgp_evpn_es_vrf_delete(struct bgp_evpn_es_vrf *es_vrf) /* remove from the VRF-ESI rb tree */ RB_REMOVE(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, es_vrf); + /* update paths in the VRF that may already be associated with + * this destination ES + */ + bgp_evpn_es_path_update_on_es_vrf_chg(es_vrf, false); + XFREE(MTYPE_BGP_EVPN_ES_VRF, es_vrf); } diff --git a/bgpd/bgp_evpn_mh.h b/bgpd/bgp_evpn_mh.h index f22a38e7b4..62414994b6 100644 --- a/bgpd/bgp_evpn_mh.h +++ b/bgpd/bgp_evpn_mh.h @@ -106,7 +106,7 @@ struct bgp_evpn_es { /* List of MAC-IP VNI paths using this ES as destination - * element is bgp_path_info_extra->es_info */ - struct list *macip_path_list; + struct list *macip_evi_path_list; /* Number of remote VNIs referencing this ES */ uint32_t remote_es_evi_cnt; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index b101589a79..8f03006705 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -687,8 +687,8 @@ static void show_esi_routes(struct bgp *bgp, } /* Display all MAC-IP VNI routes linked to an ES */ -static void bgp_evpn_show_routes_mac_ip_es(struct vty *vty, esi_t *esi, - json_object *json, int detail) +static void bgp_evpn_show_routes_mac_ip_evi_es(struct vty *vty, esi_t *esi, + json_object *json, int detail) { struct bgp_node *rn; struct bgp_path_info *pi; @@ -713,7 +713,8 @@ static void bgp_evpn_show_routes_mac_ip_es(struct vty *vty, esi_t *esi, if (esi && memcmp(esi, &es->esi, sizeof(*esi))) continue; - for (ALL_LIST_ELEMENTS_RO(es->macip_path_list, node, es_info)) { + for (ALL_LIST_ELEMENTS_RO(es->macip_evi_path_list, node, + es_info)) { json_object *json_path = NULL; pi = es_info->pi; @@ -4658,12 +4659,12 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_all, } DEFPY_HIDDEN( - show_bgp_l2vpn_evpn_route_mac_ip_es, - show_bgp_l2vpn_evpn_route_mac_ip_es_cmd, - "show bgp l2vpn evpn route mac-ip-es [NAME$esi_str|detail$detail] [json$uj]", + show_bgp_l2vpn_evpn_route_mac_ip_evi_es, + show_bgp_l2vpn_evpn_route_mac_ip_evi_es_cmd, + "show bgp l2vpn evpn route mac-ip-evi-es [NAME$esi_str|detail$detail] [json$uj]", SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR "EVPN route information\n" - "MAC IP routes linked to the ES\n" + "MAC IP routes in the EVI tables linked to the ES\n" "ES ID\n" "Detailed information\n" JSON_STR) { @@ -4683,7 +4684,7 @@ DEFPY_HIDDEN( if (uj) json = json_object_new_object(); - bgp_evpn_show_routes_mac_ip_es(vty, esi_p, json, !!detail); + bgp_evpn_show_routes_mac_ip_evi_es(vty, esi_p, json, !!detail); if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( @@ -5968,7 +5969,8 @@ void bgp_ethernetvpn_init(void) &show_bgp_l2vpn_evpn_route_vni_multicast_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_vni_macip_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_vni_all_cmd); - install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_mac_ip_es_cmd); + install_element(VIEW_NODE, + &show_bgp_l2vpn_evpn_route_mac_ip_evi_es_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_import_rt_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vrf_import_rt_cmd); -- 2.39.5