mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-28 03:01:10 +00:00
Merge pull request #16912 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
This commit is contained in:
commit
a172bea84b
@ -1404,8 +1404,8 @@ bgp_zebra_send_remote_es_vtep(struct bgp *bgp, struct bgp_evpn_es_vtep *es_vtep,
|
||||
return ZCLIENT_SEND_SUCCESS;
|
||||
}
|
||||
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR)
|
||||
flags |= ZAPI_ES_VTEP_FLAG_ESR_RXED;
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
|
||||
SET_FLAG(flags, ZAPI_ES_VTEP_FLAG_ESR_RXED);
|
||||
|
||||
s = zclient->obuf;
|
||||
stream_reset(s);
|
||||
@ -1964,9 +1964,9 @@ 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_evi_path_list)
|
||||
|| listcount(es->macip_global_path_list))
|
||||
if (CHECK_FLAG(es->flags, (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) ||
|
||||
listcount(es->macip_evi_path_list) ||
|
||||
listcount(es->macip_global_path_list))
|
||||
return;
|
||||
|
||||
if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
|
||||
@ -1991,8 +1991,8 @@ static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller)
|
||||
|
||||
static inline bool bgp_evpn_is_es_local_and_non_bypass(struct bgp_evpn_es *es)
|
||||
{
|
||||
return (es->flags & BGP_EVPNES_LOCAL)
|
||||
&& !(es->flags & BGP_EVPNES_BYPASS);
|
||||
return CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL) &&
|
||||
!CHECK_FLAG(es->flags, BGP_EVPNES_BYPASS);
|
||||
}
|
||||
|
||||
/* init local info associated with the ES */
|
||||
@ -2074,8 +2074,8 @@ bool bgp_evpn_es_add_l3_ecomm_ok(esi_t *esi)
|
||||
|
||||
es = bgp_evpn_es_find(esi);
|
||||
|
||||
return (!es || !(es->flags & BGP_EVPNES_LOCAL)
|
||||
|| bgp_evpn_local_es_is_active(es));
|
||||
return (!es || !CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL) ||
|
||||
bgp_evpn_local_es_is_active(es));
|
||||
}
|
||||
|
||||
static bool bgp_evpn_is_valid_local_path(struct bgp_path_info *pi)
|
||||
@ -2175,9 +2175,9 @@ static void bgp_evpn_mac_update_on_es_local_chg(struct bgp_evpn_es *es,
|
||||
|
||||
attr_tmp = *pi->attr;
|
||||
if (is_local)
|
||||
attr_tmp.es_flags |= ATTR_ES_IS_LOCAL;
|
||||
SET_FLAG(attr_tmp.es_flags, ATTR_ES_IS_LOCAL);
|
||||
else
|
||||
attr_tmp.es_flags &= ~ATTR_ES_IS_LOCAL;
|
||||
UNSET_FLAG(attr_tmp.es_flags, ATTR_ES_IS_LOCAL);
|
||||
attr_new = bgp_attr_intern(&attr_tmp);
|
||||
bgp_attr_unintern(&pi->attr);
|
||||
pi->attr = attr_new;
|
||||
@ -2471,9 +2471,9 @@ static char *bgp_evpn_es_vteps_str(char *vtep_str, struct bgp_evpn_es *es,
|
||||
for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, es_vtep)) {
|
||||
vtep_flag_str[0] = '\0';
|
||||
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
|
||||
strlcat(vtep_flag_str, "E", sizeof(vtep_flag_str));
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ACTIVE)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE))
|
||||
strlcat(vtep_flag_str, "A", sizeof(vtep_flag_str));
|
||||
|
||||
if (!strlen(vtep_flag_str))
|
||||
@ -2505,15 +2505,15 @@ static void bgp_evpn_es_json_vtep_fill(json_object *json_vteps,
|
||||
|
||||
json_object_string_addf(json_vtep_entry, "vtep_ip", "%pI4",
|
||||
&es_vtep->vtep_ip);
|
||||
if (es_vtep->flags & (BGP_EVPNES_VTEP_ESR |
|
||||
BGP_EVPNES_VTEP_ACTIVE)) {
|
||||
if (CHECK_FLAG(es_vtep->flags,
|
||||
(BGP_EVPNES_VTEP_ESR | BGP_EVPNES_VTEP_ACTIVE))) {
|
||||
json_flags = json_object_new_array();
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
|
||||
json_array_string_add(json_flags, "esr");
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ACTIVE)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE))
|
||||
json_array_string_add(json_flags, "active");
|
||||
json_object_object_add(json_vtep_entry, "flags", json_flags);
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR) {
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR)) {
|
||||
json_object_int_add(json_vtep_entry, "dfPreference",
|
||||
es_vtep->df_pref);
|
||||
json_object_string_add(
|
||||
@ -2537,9 +2537,9 @@ static void bgp_evpn_es_vteps_show_detail(struct vty *vty,
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, es_vtep)) {
|
||||
vtep_flag_str[0] = '\0';
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
|
||||
strlcat(vtep_flag_str, "E", sizeof(vtep_flag_str));
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ACTIVE)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE))
|
||||
strlcat(vtep_flag_str, "A", sizeof(vtep_flag_str));
|
||||
|
||||
if (!strlen(vtep_flag_str))
|
||||
@ -2548,7 +2548,7 @@ static void bgp_evpn_es_vteps_show_detail(struct vty *vty,
|
||||
vty_out(vty, " %pI4 flags: %s", &es_vtep->vtep_ip,
|
||||
vtep_flag_str);
|
||||
|
||||
if (es_vtep->flags & BGP_EVPNES_VTEP_ESR)
|
||||
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
|
||||
vty_out(vty, " df_alg: %s df_pref: %u\n",
|
||||
evpn_es_df_alg2str(es_vtep->df_alg, alg_buf,
|
||||
sizeof(alg_buf)),
|
||||
@ -2573,11 +2573,12 @@ static void bgp_evpn_es_show_entry(struct vty *vty,
|
||||
json_object_string_addf(json, "rd", "%pRDP",
|
||||
&es->es_base_frag->prd);
|
||||
|
||||
if (es->flags & (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) {
|
||||
if (CHECK_FLAG(es->flags,
|
||||
(BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE))) {
|
||||
json_types = json_object_new_array();
|
||||
if (es->flags & BGP_EVPNES_LOCAL)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
|
||||
json_array_string_add(json_types, "local");
|
||||
if (es->flags & BGP_EVPNES_REMOTE)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_REMOTE))
|
||||
json_array_string_add(json_types, "remote");
|
||||
json_object_object_add(json, "type", json_types);
|
||||
}
|
||||
@ -2597,11 +2598,11 @@ static void bgp_evpn_es_show_entry(struct vty *vty,
|
||||
char vtep_str[ES_VTEP_LIST_STR_SZ + BGP_EVPN_VTEPS_FLAG_STR_SZ];
|
||||
|
||||
type_str[0] = '\0';
|
||||
if (es->flags & BGP_EVPNES_BYPASS)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_BYPASS))
|
||||
strlcat(type_str, "B", sizeof(type_str));
|
||||
if (es->flags & BGP_EVPNES_LOCAL)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
|
||||
strlcat(type_str, "L", sizeof(type_str));
|
||||
if (es->flags & BGP_EVPNES_REMOTE)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_REMOTE))
|
||||
strlcat(type_str, "R", sizeof(type_str));
|
||||
if (es->inconsistencies)
|
||||
strlcat(type_str, "I", sizeof(type_str));
|
||||
@ -2628,16 +2629,16 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
|
||||
/* Add the "brief" info first */
|
||||
bgp_evpn_es_show_entry(vty, es, json);
|
||||
if (es->flags
|
||||
& (BGP_EVPNES_OPER_UP | BGP_EVPNES_ADV_EVI
|
||||
| BGP_EVPNES_BYPASS)) {
|
||||
if (CHECK_FLAG(es->flags,
|
||||
(BGP_EVPNES_OPER_UP | BGP_EVPNES_ADV_EVI |
|
||||
BGP_EVPNES_BYPASS))) {
|
||||
json_flags = json_object_new_array();
|
||||
if (es->flags & BGP_EVPNES_OPER_UP)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_OPER_UP))
|
||||
json_array_string_add(json_flags, "up");
|
||||
if (es->flags & BGP_EVPNES_ADV_EVI)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_ADV_EVI))
|
||||
json_array_string_add(json_flags,
|
||||
"advertiseEVI");
|
||||
if (es->flags & BGP_EVPNES_BYPASS)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_BYPASS))
|
||||
json_array_string_add(json_flags, "bypass");
|
||||
json_object_object_add(json, "flags", json_flags);
|
||||
}
|
||||
@ -2653,7 +2654,7 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
listcount(es->macip_global_path_list));
|
||||
json_object_int_add(json, "inconsistentVniVtepCount",
|
||||
es->incons_evi_vtep_cnt);
|
||||
if (es->flags & BGP_EVPNES_LOCAL)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
|
||||
json_object_int_add(json, "localEsDfPreference",
|
||||
es->df_pref);
|
||||
if (listcount(es->es_vtep_list)) {
|
||||
@ -2671,7 +2672,8 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
}
|
||||
if (es->inconsistencies) {
|
||||
json_incons = json_object_new_array();
|
||||
if (es->inconsistencies & BGP_EVPNES_INCONS_VTEP_LIST)
|
||||
if (CHECK_FLAG(es->inconsistencies,
|
||||
BGP_EVPNES_INCONS_VTEP_LIST))
|
||||
json_array_string_add(json_incons,
|
||||
"vni-vtep-mismatch");
|
||||
json_object_object_add(json, "inconsistencies",
|
||||
@ -2682,9 +2684,9 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
char type_str[4];
|
||||
|
||||
type_str[0] = '\0';
|
||||
if (es->flags & BGP_EVPNES_LOCAL)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
|
||||
strlcat(type_str, "L", sizeof(type_str));
|
||||
if (es->flags & BGP_EVPNES_REMOTE)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_REMOTE))
|
||||
strlcat(type_str, "R", sizeof(type_str));
|
||||
|
||||
vty_out(vty, "ESI: %s\n", es->esi_str);
|
||||
@ -2692,10 +2694,10 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
vty_out(vty, " RD: %pRDP\n",
|
||||
es->es_base_frag ? &es->es_base_frag->prd : NULL);
|
||||
vty_out(vty, " Originator-IP: %pI4\n", &es->originator_ip);
|
||||
if (es->flags & BGP_EVPNES_LOCAL)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
|
||||
vty_out(vty, " Local ES DF preference: %u\n",
|
||||
es->df_pref);
|
||||
if (es->flags & BGP_EVPNES_BYPASS)
|
||||
if (CHECK_FLAG(es->flags, BGP_EVPNES_BYPASS))
|
||||
vty_out(vty, " LACP bypass: on\n");
|
||||
vty_out(vty, " VNI Count: %d\n", listcount(es->es_evi_list));
|
||||
vty_out(vty, " Remote VNI Count: %d\n",
|
||||
@ -2709,7 +2711,8 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
|
||||
es->incons_evi_vtep_cnt);
|
||||
if (es->inconsistencies) {
|
||||
incons_str[0] = '\0';
|
||||
if (es->inconsistencies & BGP_EVPNES_INCONS_VTEP_LIST)
|
||||
if (CHECK_FLAG(es->inconsistencies,
|
||||
BGP_EVPNES_INCONS_VTEP_LIST))
|
||||
strlcat(incons_str, "vni-vtep-mismatch",
|
||||
sizeof(incons_str));
|
||||
} else {
|
||||
@ -2933,7 +2936,7 @@ static void bgp_evpn_l3nhg_zebra_del(struct bgp_evpn_es_vrf *es_vrf)
|
||||
|
||||
static void bgp_evpn_l3nhg_deactivate(struct bgp_evpn_es_vrf *es_vrf)
|
||||
{
|
||||
if (!(es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE))
|
||||
if (!CHECK_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE))
|
||||
return;
|
||||
|
||||
if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
|
||||
@ -2941,7 +2944,7 @@ static void bgp_evpn_l3nhg_deactivate(struct bgp_evpn_es_vrf *es_vrf)
|
||||
es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id,
|
||||
es_vrf->nhg_id);
|
||||
bgp_evpn_l3nhg_zebra_del(es_vrf);
|
||||
es_vrf->flags &= ~BGP_EVPNES_VRF_NHG_ACTIVE;
|
||||
UNSET_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE);
|
||||
/* MAC-IPs can now be installed via the L3NHG */
|
||||
bgp_evpn_es_path_update_on_es_vrf_chg(es_vrf, "l3nhg-deactivate");
|
||||
}
|
||||
@ -2953,7 +2956,7 @@ static void bgp_evpn_l3nhg_activate(struct bgp_evpn_es_vrf *es_vrf, bool update)
|
||||
return;
|
||||
}
|
||||
|
||||
if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE) {
|
||||
if (CHECK_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE)) {
|
||||
if (!update)
|
||||
return;
|
||||
} else {
|
||||
@ -2961,7 +2964,7 @@ static void bgp_evpn_l3nhg_activate(struct bgp_evpn_es_vrf *es_vrf, bool update)
|
||||
zlog_debug("es %s vrf %u nhg %u activate",
|
||||
es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id,
|
||||
es_vrf->nhg_id);
|
||||
es_vrf->flags |= BGP_EVPNES_VRF_NHG_ACTIVE;
|
||||
SET_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE);
|
||||
/* MAC-IPs can now be installed via the L3NHG */
|
||||
bgp_evpn_es_path_update_on_es_vrf_chg(es_vrf, "l3nhg_activate");
|
||||
}
|
||||
@ -3182,7 +3185,7 @@ void bgp_evpn_es_vrf_use_nhg(struct bgp *bgp_vrf, esi_t *esi, bool *use_l3nhg,
|
||||
return;
|
||||
|
||||
*use_l3nhg = true;
|
||||
if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE)
|
||||
if (CHECK_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE))
|
||||
*is_l3nhg_active = true;
|
||||
if (es_vrf_p)
|
||||
*es_vrf_p = es_vrf;
|
||||
@ -3274,9 +3277,9 @@ static void bgp_evpn_es_vrf_show_entry(struct vty *vty,
|
||||
json_object_string_add(json, "esi", es->esi_str);
|
||||
json_object_string_add(json, "vrf", bgp_vrf->name_pretty);
|
||||
|
||||
if (es_vrf->flags & (BGP_EVPNES_VRF_NHG_ACTIVE)) {
|
||||
if (CHECK_FLAG(es_vrf->flags, (BGP_EVPNES_VRF_NHG_ACTIVE))) {
|
||||
json_types = json_object_new_array();
|
||||
if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE)
|
||||
if (CHECK_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE))
|
||||
json_array_string_add(json_types, "active");
|
||||
json_object_object_add(json, "flags", json_types);
|
||||
}
|
||||
@ -3288,7 +3291,7 @@ static void bgp_evpn_es_vrf_show_entry(struct vty *vty,
|
||||
char flags_str[4];
|
||||
|
||||
flags_str[0] = '\0';
|
||||
if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE)
|
||||
if (CHECK_FLAG(es_vrf->flags, BGP_EVPNES_VRF_NHG_ACTIVE))
|
||||
strlcat(flags_str, "A", sizeof(flags_str));
|
||||
|
||||
vty_out(vty, "%-30s %-15s %-5s %-8u %-8u %u\n", es->esi_str,
|
||||
@ -3398,7 +3401,7 @@ static void bgp_evpn_es_evi_vtep_free(struct bgp_evpn_es_evi_vtep *evi_vtep)
|
||||
{
|
||||
struct bgp_evpn_es_evi *es_evi = evi_vtep->es_evi;
|
||||
|
||||
if (evi_vtep->flags & (BGP_EVPN_EVI_VTEP_EAD))
|
||||
if (CHECK_FLAG(evi_vtep->flags, (BGP_EVPN_EVI_VTEP_EAD)))
|
||||
/* as long as there is some reference we can't free it */
|
||||
return;
|
||||
|
||||
@ -3443,7 +3446,8 @@ bgp_evpn_es_evi_vtep_re_eval_active(struct bgp *bgp,
|
||||
/* EAD-per-ES is sufficent to activate the PE */
|
||||
ead_activity_flags = BGP_EVPN_EVI_VTEP_EAD_PER_ES;
|
||||
|
||||
if ((evi_vtep->flags & ead_activity_flags) == ead_activity_flags)
|
||||
if (CHECK_FLAG(evi_vtep->flags, ead_activity_flags) ==
|
||||
ead_activity_flags)
|
||||
SET_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_ACTIVE);
|
||||
else
|
||||
UNSET_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_ACTIVE);
|
||||
@ -3600,7 +3604,8 @@ bgp_evpn_es_evi_free(struct bgp_evpn_es_evi *es_evi)
|
||||
/* cannot free the element as long as there is a local or remote
|
||||
* reference
|
||||
*/
|
||||
if (es_evi->flags & (BGP_EVPNES_EVI_LOCAL | BGP_EVPNES_EVI_REMOTE))
|
||||
if (CHECK_FLAG(es_evi->flags,
|
||||
(BGP_EVPNES_EVI_LOCAL | BGP_EVPNES_EVI_REMOTE)))
|
||||
return es_evi;
|
||||
bgp_evpn_es_frag_evi_del(es_evi, false);
|
||||
bgp_evpn_es_vrf_deref(es_evi);
|
||||
@ -3922,8 +3927,8 @@ static void bgp_evpn_remote_es_evi_flush(struct bgp_evpn_es_evi *es_evi)
|
||||
/* delete all VTEPs */
|
||||
for (ALL_LIST_ELEMENTS(es_evi->es_evi_vtep_list, node, nnode,
|
||||
evi_vtep)) {
|
||||
evi_vtep->flags &= ~(BGP_EVPN_EVI_VTEP_EAD_PER_ES
|
||||
| BGP_EVPN_EVI_VTEP_EAD_PER_EVI);
|
||||
UNSET_FLAG(evi_vtep->flags, (BGP_EVPN_EVI_VTEP_EAD_PER_ES |
|
||||
BGP_EVPN_EVI_VTEP_EAD_PER_EVI));
|
||||
bgp_evpn_es_evi_vtep_re_eval_active(bgp, evi_vtep);
|
||||
bgp_evpn_es_evi_vtep_free(evi_vtep);
|
||||
}
|
||||
@ -3971,9 +3976,9 @@ static char *bgp_evpn_es_evi_vteps_str(char *vtep_str,
|
||||
vtep_str[0] = '\0';
|
||||
for (ALL_LIST_ELEMENTS_RO(es_evi->es_evi_vtep_list, node, evi_vtep)) {
|
||||
vtep_flag_str[0] = '\0';
|
||||
if (evi_vtep->flags & BGP_EVPN_EVI_VTEP_EAD_PER_ES)
|
||||
if (CHECK_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_EAD_PER_ES))
|
||||
strlcat(vtep_flag_str, "E", sizeof(vtep_flag_str));
|
||||
if (evi_vtep->flags & BGP_EVPN_EVI_VTEP_EAD_PER_EVI)
|
||||
if (CHECK_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_EAD_PER_EVI))
|
||||
strlcat(vtep_flag_str, "V", sizeof(vtep_flag_str));
|
||||
|
||||
if (!strnlen(vtep_flag_str, sizeof(vtep_flag_str)))
|
||||
@ -4004,12 +4009,12 @@ static void bgp_evpn_es_evi_json_vtep_fill(json_object *json_vteps,
|
||||
|
||||
json_object_string_addf(json_vtep_entry, "vtep_ip", "%pI4",
|
||||
&evi_vtep->vtep_ip);
|
||||
if (evi_vtep->flags & (BGP_EVPN_EVI_VTEP_EAD_PER_ES |
|
||||
BGP_EVPN_EVI_VTEP_EAD_PER_EVI)) {
|
||||
if (CHECK_FLAG(evi_vtep->flags, (BGP_EVPN_EVI_VTEP_EAD_PER_ES |
|
||||
BGP_EVPN_EVI_VTEP_EAD_PER_EVI))) {
|
||||
json_flags = json_object_new_array();
|
||||
if (evi_vtep->flags & BGP_EVPN_EVI_VTEP_EAD_PER_ES)
|
||||
if (CHECK_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_EAD_PER_ES))
|
||||
json_array_string_add(json_flags, "ead-per-es");
|
||||
if (evi_vtep->flags & BGP_EVPN_EVI_VTEP_EAD_PER_EVI)
|
||||
if (CHECK_FLAG(evi_vtep->flags, BGP_EVPN_EVI_VTEP_EAD_PER_EVI))
|
||||
json_array_string_add(json_flags, "ead-per-evi");
|
||||
json_object_object_add(json_vtep_entry,
|
||||
"flags", json_flags);
|
||||
@ -4033,12 +4038,12 @@ static void bgp_evpn_es_evi_show_entry(struct vty *vty,
|
||||
if (es_evi->vpn)
|
||||
json_object_int_add(json, "vni", es_evi->vpn->vni);
|
||||
|
||||
if (es_evi->flags & (BGP_EVPNES_EVI_LOCAL |
|
||||
BGP_EVPNES_EVI_REMOTE)) {
|
||||
if (CHECK_FLAG(es_evi->flags, (BGP_EVPNES_EVI_LOCAL |
|
||||
BGP_EVPNES_EVI_REMOTE))) {
|
||||
json_types = json_object_new_array();
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_LOCAL)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_LOCAL))
|
||||
json_array_string_add(json_types, "local");
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_REMOTE)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_REMOTE))
|
||||
json_array_string_add(json_types, "remote");
|
||||
json_object_object_add(json, "type", json_types);
|
||||
}
|
||||
@ -4057,11 +4062,11 @@ static void bgp_evpn_es_evi_show_entry(struct vty *vty,
|
||||
char vtep_str[ES_VTEP_LIST_STR_SZ + BGP_EVPN_VTEPS_FLAG_STR_SZ];
|
||||
|
||||
type_str[0] = '\0';
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_LOCAL)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_LOCAL))
|
||||
strlcat(type_str, "L", sizeof(type_str));
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_REMOTE)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_REMOTE))
|
||||
strlcat(type_str, "R", sizeof(type_str));
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_INCONS_VTEP_LIST)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_INCONS_VTEP_LIST))
|
||||
strlcat(type_str, "I", sizeof(type_str));
|
||||
|
||||
bgp_evpn_es_evi_vteps_str(vtep_str, es_evi, sizeof(vtep_str));
|
||||
@ -4088,7 +4093,7 @@ static void bgp_evpn_es_evi_show_entry_detail(struct vty *vty,
|
||||
json_object_string_addf(json, "esFragmentRd",
|
||||
BGP_RD_AS_FORMAT(mode),
|
||||
&es_evi->es_frag->prd);
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_INCONS_VTEP_LIST) {
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_INCONS_VTEP_LIST)) {
|
||||
json_flags = json_object_new_array();
|
||||
json_array_string_add(json_flags, "es-vtep-mismatch");
|
||||
json_object_object_add(json, "flags", json_flags);
|
||||
@ -4098,9 +4103,9 @@ static void bgp_evpn_es_evi_show_entry_detail(struct vty *vty,
|
||||
char type_str[4];
|
||||
|
||||
type_str[0] = '\0';
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_LOCAL)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_LOCAL))
|
||||
strlcat(type_str, "L", sizeof(type_str));
|
||||
if (es_evi->flags & BGP_EVPNES_EVI_REMOTE)
|
||||
if (CHECK_FLAG(es_evi->flags, BGP_EVPNES_EVI_REMOTE))
|
||||
strlcat(type_str, "R", sizeof(type_str));
|
||||
|
||||
bgp_evpn_es_evi_vteps_str(vtep_str, es_evi, sizeof(vtep_str));
|
||||
@ -4117,8 +4122,10 @@ static void bgp_evpn_es_evi_show_entry_detail(struct vty *vty,
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
vty_out(vty, " Inconsistencies: %s\n",
|
||||
(es_evi->flags & BGP_EVPNES_EVI_INCONS_VTEP_LIST) ?
|
||||
"es-vtep-mismatch":"-");
|
||||
CHECK_FLAG(es_evi->flags,
|
||||
BGP_EVPNES_EVI_INCONS_VTEP_LIST)
|
||||
? "es-vtep-mismatch"
|
||||
: "-");
|
||||
vty_out(vty, " VTEPs: %s\n", vtep_str);
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
@ -4512,12 +4519,12 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add)
|
||||
static void bgp_evpn_nh_zebra_update(struct bgp_evpn_nh *nh, bool add)
|
||||
{
|
||||
if (add && !is_zero_mac(&nh->rmac)) {
|
||||
nh->flags |= BGP_EVPN_NH_READY_FOR_ZEBRA;
|
||||
SET_FLAG(nh->flags, BGP_EVPN_NH_READY_FOR_ZEBRA);
|
||||
bgp_evpn_nh_zebra_update_send(nh, true);
|
||||
} else {
|
||||
if (!(nh->flags & BGP_EVPN_NH_READY_FOR_ZEBRA))
|
||||
if (!CHECK_FLAG(nh->flags, BGP_EVPN_NH_READY_FOR_ZEBRA))
|
||||
return;
|
||||
nh->flags &= ~BGP_EVPN_NH_READY_FOR_ZEBRA;
|
||||
UNSET_FLAG(nh->flags, BGP_EVPN_NH_READY_FOR_ZEBRA);
|
||||
bgp_evpn_nh_zebra_update_send(nh, false);
|
||||
}
|
||||
}
|
||||
@ -4809,7 +4816,7 @@ static void bgp_evpn_path_nh_link(struct bgp *bgp_vrf, struct bgp_path_info *pi)
|
||||
/* if NHG is not being used for this path we don't need to manage the
|
||||
* nexthops in bgp (they are managed by zebra instead)
|
||||
*/
|
||||
if (!(pi->attr->es_flags & ATTR_ES_L3_NHG_USE)) {
|
||||
if (!CHECK_FLAG(pi->attr->es_flags, ATTR_ES_L3_NHG_USE)) {
|
||||
if (nh_info)
|
||||
bgp_evpn_path_nh_unlink(nh_info);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user