zebra: defer local MAC dataplane install on an ES till the ES-EVI is created

When an ES is deleted and re-added bgpd can start sending MAC-IP sync updates
before the dataplane and zebra have setup the VLAN membership for the ES. Such
MAC entries are not installed in the dataplane till the ES-EVI is created.

Ticket: #2668488

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
This commit is contained in:
Anuradha Karuppiah 2021-08-10 14:31:34 -07:00
parent 38f681e1ca
commit 09de6e4550
3 changed files with 53 additions and 2 deletions

View File

@ -1342,6 +1342,25 @@ int zebra_evpn_sync_mac_dp_install(struct zebra_mac *mac, bool set_inactive,
struct zebra_if *zif;
struct interface *br_ifp;
/* If the ES-EVI doesn't exist defer install. When the ES-EVI is
* created we will attempt to install the mac entry again
*/
if (mac->es) {
struct zebra_evpn_es_evi *es_evi;
es_evi = zebra_evpn_es_evi_find(mac->es, mac->zevpn);
if (!es_evi) {
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
zlog_debug(
"%s: dp-install sync-mac vni %u mac %pEA es %s 0x%x %sskipped, no es-evi",
caller, zevpn->vni, &mac->macaddr,
mac->es ? mac->es->esi_str : "-",
mac->flags,
set_inactive ? "inactive " : "");
return -1;
}
}
/* get the access vlan from the vxlan_device */
zebra_evpn_mac_get_access_info(mac, &ifp, &vid);

View File

@ -186,8 +186,8 @@ static void zebra_evpn_es_evi_free(struct zebra_evpn_es_evi *es_evi)
}
/* find the ES-EVI in the per-L2-VNI RB tree */
static struct zebra_evpn_es_evi *
zebra_evpn_es_evi_find(struct zebra_evpn_es *es, struct zebra_evpn *zevpn)
struct zebra_evpn_es_evi *zebra_evpn_es_evi_find(struct zebra_evpn_es *es,
struct zebra_evpn *zevpn)
{
struct zebra_evpn_es_evi es_evi;
@ -229,6 +229,34 @@ static void zebra_evpn_local_es_evi_del(struct zebra_evpn_es *es,
zebra_evpn_local_es_evi_do_del(es_evi);
}
/* If there are any existing MAC entries for this es/zevpn we need
* to install it in the dataplane.
*
* Note: primary purpose of this is to handle es del/re-add windows where
* sync MAC entries may be added by bgpd before the es-evi membership is
* created in the dataplane and in zebra
*/
static void zebra_evpn_es_evi_mac_install(struct zebra_evpn_es_evi *es_evi)
{
struct zebra_mac *mac;
struct listnode *node;
struct zebra_evpn_es *es = es_evi->es;
if (listcount(es->mac_list) && IS_ZEBRA_DEBUG_EVPN_MH_ES)
zlog_debug("dp-mac install on es %s evi %d add", es->esi_str,
es_evi->zevpn->vni);
for (ALL_LIST_ELEMENTS_RO(es->mac_list, node, mac)) {
if (mac->zevpn != es_evi->zevpn)
continue;
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL))
continue;
zebra_evpn_sync_mac_dp_install(mac, false, false, __func__);
}
}
/* Create an ES-EVI if it doesn't already exist and tell BGP */
static void zebra_evpn_local_es_evi_add(struct zebra_evpn_es *es,
struct zebra_evpn *zevpn)
@ -250,6 +278,8 @@ static void zebra_evpn_local_es_evi_add(struct zebra_evpn_es *es,
listnode_add(zevpn->local_es_evi_list, &es_evi->l2vni_listnode);
zebra_evpn_es_evi_re_eval_send_to_client(es_evi);
zebra_evpn_es_evi_mac_install(es_evi);
}
}

View File

@ -387,5 +387,7 @@ extern void zebra_evpn_acc_bd_svi_mac_add(struct interface *vlan_if);
extern void zebra_evpn_es_bypass_update(struct zebra_evpn_es *es,
struct interface *ifp, bool bypass);
extern void zebra_evpn_proc_remote_nh(ZAPI_HANDLER_ARGS);
extern struct zebra_evpn_es_evi *
zebra_evpn_es_evi_find(struct zebra_evpn_es *es, struct zebra_evpn *zevpn);
#endif /* _ZEBRA_EVPN_MH_H */