]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_evpn_mh.c
Merge pull request #10978 from anlancs/bgpd-cleanup-6
[mirror_frr.git] / bgpd / bgp_evpn_mh.c
index de22b24c524650f4692338185bb118cb063a3b27..b9e3577f5c559997d3bf9e9bb2a229111ee8244a 100644 (file)
@@ -622,8 +622,6 @@ static void bgp_evpn_type4_route_extcomm_build(struct bgp_evpn_es *es,
        bgp_attr_set_ecommunity(
                attr,
                ecommunity_merge(bgp_attr_get_ecommunity(attr), &ecom_df));
-
-       attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
 }
 
 /* Create or update local type-4 route */
@@ -904,8 +902,6 @@ bgp_evpn_type1_es_route_extcomm_build(struct bgp_evpn_es_frag *es_frag,
                                                               ecom));
                }
        }
-
-       attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
 }
 
 /* Extended communities associated with EAD-per-EVI */
@@ -932,8 +928,6 @@ static void bgp_evpn_type1_evi_route_extcomm_build(struct bgp_evpn_es *es,
                bgp_attr_set_ecommunity(
                        attr,
                        ecommunity_merge(bgp_attr_get_ecommunity(attr), ecom));
-
-       attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
 }
 
 /* Update EVPN EAD (type-1) route -
@@ -1273,9 +1267,9 @@ void bgp_evpn_mh_config_ead_export_rt(struct bgp *bgp,
                                }
                        }
 
-                       if (node_to_del)
-                               list_delete_node(bgp_mh_info->ead_es_export_rtl,
-                                                node_to_del);
+                       assert(node_to_del);
+                       list_delete_node(bgp_mh_info->ead_es_export_rtl,
+                                        node_to_del);
                }
        } else {
                listnode_add_sort(bgp_mh_info->ead_es_export_rtl, ecomcfg);
@@ -1688,7 +1682,7 @@ static bool bgp_evpn_is_macip_path(struct bgp_path_info *pi)
  * This is done indirectly by re-attempting an install of the
  * route in the associated VRFs. As a part of the VRF install use
  * of l3 NHG is evaluated and this results in the
- * attr.es_flag ATTR_ES_USE_L3_NHG being set or cleared.
+ * attr.es_flag ATTR_ES_L3_NHG_USE being set or cleared.
  */
 static void
 bgp_evpn_es_path_update_on_es_vrf_chg(struct bgp_evpn_es_vrf *es_vrf,
@@ -1902,9 +1896,6 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi)
 {
        struct bgp_evpn_es *es;
 
-       if (!bgp)
-               return NULL;
-
        es = XCALLOC(MTYPE_BGP_EVPN_ES, sizeof(struct bgp_evpn_es));
 
        /* set the ESI */
@@ -2364,7 +2355,6 @@ int bgp_evpn_local_es_add(struct bgp *bgp, esi_t *esi,
                          struct in_addr originator_ip, bool oper_up,
                          uint16_t df_pref, bool bypass)
 {
-       char buf[ESI_STR_LEN];
        struct bgp_evpn_es *es;
        bool new_es = true;
        bool regen_esr = false;
@@ -2374,15 +2364,8 @@ int bgp_evpn_local_es_add(struct bgp *bgp, esi_t *esi,
        if (es) {
                if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
                        new_es = false;
-       } else {
+       } else
                es = bgp_evpn_es_new(bgp, esi);
-               if (!es) {
-                       flog_err(EC_BGP_ES_CREATE,
-                               "%u: Failed to allocate ES entry for ESI %s - at Local ES Add",
-                               bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
-                       return -1;
-               }
-       }
 
        if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
                zlog_debug("add local es %s orig-ip %pI4 df_pref %u %s",
@@ -2886,7 +2869,7 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf,
 
 static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf)
 {
-       if (!bgp_mh_info->host_routes_use_l3nhg && !bgp_mh_info->install_l3nhg)
+       if (!bgp_mh_info->host_routes_use_l3nhg)
                return false;
 
        /* Check socket. */
@@ -3818,15 +3801,8 @@ int bgp_evpn_remote_es_evi_add(struct bgp *bgp, struct bgpevpn *vpn,
                           &p->prefix.ead_addr.ip.ipaddr_v4);
 
        es = bgp_evpn_es_find(esi);
-       if (!es) {
+       if (!es)
                es = bgp_evpn_es_new(bgp, esi);
-               if (!es) {
-                       flog_err(EC_BGP_ES_CREATE,
-                               "%u: Failed to allocate ES entry for ESI %s - at remote ES Add",
-                               bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
-                       return -1;
-               }
-       }
 
        es_evi = bgp_evpn_es_evi_find(es, vpn);
        if (!es_evi)
@@ -4961,7 +4937,6 @@ void bgp_evpn_mh_init(void)
        /* config knobs - XXX add cli to control it */
        bgp_mh_info->ead_evi_adv_for_down_links = true;
        bgp_mh_info->consistency_checking = true;
-       bgp_mh_info->install_l3nhg = false;
        bgp_mh_info->host_routes_use_l3nhg = BGP_EVPN_MH_USE_ES_L3NHG_DEF;
        bgp_mh_info->suppress_l3_ecomm_on_inactive_es = true;
        bgp_mh_info->bgp_evpn_nh_setup = true;