Merge pull request #11012 from anlancs/bgpd-mh-simplify-condition

zebra: simplify one check for evpn-mh
This commit is contained in:
Donatas Abraitis 2022-04-19 13:04:43 +03:00 committed by GitHub
commit f5327fc339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 22 deletions

View File

@ -3366,7 +3366,9 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi,
assert(attr); assert(attr);
/* Only type-2, type-3, type-4 and type-5 are supported currently */ /* Only type-1, type-2, type-3, type-4 and type-5
* are supported currently
*/
if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
|| evp->prefix.route_type == BGP_EVPN_IMET_ROUTE || evp->prefix.route_type == BGP_EVPN_IMET_ROUTE
|| evp->prefix.route_type == BGP_EVPN_ES_ROUTE || evp->prefix.route_type == BGP_EVPN_ES_ROUTE
@ -3471,7 +3473,7 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi,
if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE) { if (evp->prefix.route_type == BGP_EVPN_ES_ROUTE) {
/* we will match based on the entire esi to avoid /* we will match based on the entire esi to avoid
* imoort of an es route for esi2 into esi1 * import of an es route for esi2 into esi1
*/ */
es = bgp_evpn_es_find(&evp->prefix.es_addr.esi); es = bgp_evpn_es_find(&evp->prefix.es_addr.esi);
if (es && bgp_evpn_is_es_local(es)) if (es && bgp_evpn_is_es_local(es))
@ -6097,8 +6099,9 @@ bool bgp_evpn_is_prefix_nht_supported(const struct prefix *pfx)
* EVPN routes should be marked as valid only if the nexthop is * EVPN routes should be marked as valid only if the nexthop is
* reachable. Only if this happens, the route should be imported * reachable. Only if this happens, the route should be imported
* (into VNI or VRF routing tables) and/or advertised. * (into VNI or VRF routing tables) and/or advertised.
* Note: This is currently applied for EVPN type-2, type-3 and * Note: This is currently applied for EVPN type-1, type-2,
* type-5 routes. It may be tweaked later on for other routes, or * type-3, type-4 and type-5 routes.
* It may be tweaked later on for other routes, or
* even removed completely when all routes are handled. * even removed completely when all routes are handled.
*/ */
if (pfx && pfx->family == AF_EVPN if (pfx && pfx->family == AF_EVPN

View File

@ -287,7 +287,7 @@ static int bgp_evpn_es_route_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
return ret; return ret;
} }
/* Install or unistall a Tyoe-4 route in the per-ES routing table */ /* Install or unistall a Type-4 route in the per-ES routing table */
int bgp_evpn_es_route_install_uninstall(struct bgp *bgp, struct bgp_evpn_es *es, int bgp_evpn_es_route_install_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
afi_t afi, safi_t safi, struct prefix_evpn *evp, afi_t afi, safi_t safi, struct prefix_evpn *evp,
struct bgp_path_info *pi, int install) struct bgp_path_info *pi, int install)
@ -378,7 +378,7 @@ int bgp_evpn_mh_route_update(struct bgp *bgp, struct bgp_evpn_es *es,
remote_pi = tmp_pi; remote_pi = tmp_pi;
} }
/* we don't expect to see a remote_ri at this point as /* we don't expect to see a remote_pi at this point as
* an ES route has {esi, vtep_ip} as the key in the ES-rt-table * an ES route has {esi, vtep_ip} as the key in the ES-rt-table
* in the VNI-rt-table. * in the VNI-rt-table.
*/ */

View File

@ -50,7 +50,9 @@ struct bgp_evpn_es_frag {
/* RD for this ES fragment */ /* RD for this ES fragment */
struct prefix_rd prd; struct prefix_rd prd;
/* Memory used for linking bgp_evpn_es_rd to bgp_evpn_es->rd_list */ /* Memory used for linking bgp_evpn_es_frag to
* bgp_evpn_es->es_frag_list
*/
struct listnode es_listnode; struct listnode es_listnode;
/* List of ES-EVIs associated with this fragment */ /* List of ES-EVIs associated with this fragment */
@ -63,7 +65,7 @@ struct bgp_evpn_es_frag {
* - Local ESs are received from zebra (BGP_EVPNES_LOCAL) * - Local ESs are received from zebra (BGP_EVPNES_LOCAL)
* - Remotes ESs are implicitly created (by reference) by a remote ES-EVI * - Remotes ESs are implicitly created (by reference) by a remote ES-EVI
* (BGP_EVPNES_REMOTE) * (BGP_EVPNES_REMOTE)
* - An ES can be simulatenously LOCAL and REMOTE; infact all LOCAL ESs are * - An ES can be simultaneously LOCAL and REMOTE; infact all LOCAL ESs are
* expected to have REMOTE ES peers. * expected to have REMOTE ES peers.
*/ */
struct bgp_evpn_es { struct bgp_evpn_es {
@ -101,7 +103,7 @@ struct bgp_evpn_es {
*/ */
struct listnode pend_es_listnode; struct listnode pend_es_listnode;
/* [EVPNES_LOCAL] List of RDs for this ES (bgp_evpn_es_rd) */ /* [EVPNES_LOCAL] List of RDs for this ES (bgp_evpn_es_frag) */
struct list *es_frag_list; struct list *es_frag_list;
struct bgp_evpn_es_frag *es_base_frag; struct bgp_evpn_es_frag *es_base_frag;

View File

@ -3761,8 +3761,7 @@ static inline bool zebra_evpn_mh_is_all_uplinks_down(void)
static void zebra_evpn_mh_uplink_oper_flags_update(struct zebra_if *zif, static void zebra_evpn_mh_uplink_oper_flags_update(struct zebra_if *zif,
bool set) bool set)
{ {
if (set) { if (set && if_is_operative(zif->ifp)) {
if (if_is_operative(zif->ifp)) {
if (!(zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP)) { if (!(zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP)) {
zif->flags |= ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP; zif->flags |= ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP;
++zmh_info->uplink_oper_up_cnt; ++zmh_info->uplink_oper_up_cnt;
@ -3774,13 +3773,6 @@ static void zebra_evpn_mh_uplink_oper_flags_update(struct zebra_if *zif,
--zmh_info->uplink_oper_up_cnt; --zmh_info->uplink_oper_up_cnt;
} }
} }
} else {
if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP) {
zif->flags &= ~ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP;
if (zmh_info->uplink_oper_up_cnt)
--zmh_info->uplink_oper_up_cnt;
}
}
} }
static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set) static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set)