summaryrefslogtreecommitdiff
path: root/zebra/zebra_evpn_mac.c
diff options
context:
space:
mode:
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>2020-05-08 18:47:52 -0700
committerAnuradha Karuppiah <anuradhak@nvidia.com>2020-12-01 09:46:26 -0800
commit15400f95b77f95012e7676f14105ab9280e52c3d (patch)
tree64602fcf60b24e95f8e9f30cf206a60220d74fb9 /zebra/zebra_evpn_mac.c
parent69711b3f8364d3bcf5d170649eef4c0ed536d851 (diff)
zebra: support for slow-failover of local MACs on an ES
When a local ES flaps there are two modes in which the local MACs are failed over - 1. Fast failover - A backup NHG (ES-peer group) is programmed in the dataplane per-access port. When a local ES flaps the MAC entries are left unaltered i.e. pointing to the down access port. And the dataplane redirects traffic destined to the oper-down access port via the backup NHG. 2. Slow failover - This mode needs to be turned on to allow dataplanes not capable of re-directing traffic. In this mode local MAC entries on a down local ES are re-programmed to point to the ES-peers' NHG. And vice-versa i.e. when the ES comes up the MAC entries are re-programmed with the access port as dest. Fast failover is on by default. Slow failover can be enabled via the following config - evpn mh redirect-off Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_evpn_mac.c')
-rw-r--r--zebra/zebra_evpn_mac.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c
index f1e289ec60..0b0670f079 100644
--- a/zebra/zebra_evpn_mac.c
+++ b/zebra/zebra_evpn_mac.c
@@ -108,9 +108,6 @@ int zebra_evpn_rem_mac_install(zebra_evpn_t *zevpn, zebra_mac_t *mac,
uint32_t nhg_id;
struct in_addr vtep_ip;
- if (!(mac->flags & ZEBRA_MAC_REMOTE))
- return 0;
-
zif = zevpn->vxlan_if->info;
if (!zif)
return -1;
@@ -165,9 +162,6 @@ int zebra_evpn_rem_mac_uninstall(zebra_evpn_t *zevpn, zebra_mac_t *mac,
vlanid_t vid;
enum zebra_dplane_result res;
- if (!(mac->flags & ZEBRA_MAC_REMOTE))
- return 0;
-
/* If the MAC was not installed there is no need to uninstall it */
if (!force && mac->es && !(mac->es->flags & ZEBRA_EVPNES_NHG_ACTIVE))
return -1;
@@ -1187,10 +1181,9 @@ struct hash *zebra_mac_db_create(const char *desc)
}
/* program sync mac flags in the dataplane */
-void zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
- bool force_clear_static, const char *caller)
+int zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
+ bool force_clear_static, const char *caller)
{
- char macbuf[ETHER_ADDR_STRLEN];
struct interface *ifp;
bool sticky;
bool set_static;
@@ -1205,13 +1198,11 @@ void zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
if (!ifp) {
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
zlog_debug(
- "%s: dp-install sync-mac vni %u mac %s es %s 0x%x %sskipped, no access-port",
- caller, zevpn->vni,
- prefix_mac2str(&mac->macaddr, macbuf,
- sizeof(macbuf)),
+ "%s: dp-install sync-mac vni %u mac %pEA es %s 0x%x %sskipped, no access-port",
+ caller, zevpn->vni, &mac->macaddr,
mac->es ? mac->es->esi_str : "-", mac->flags,
set_inactive ? "inactive " : "");
- return;
+ return -1;
}
zif = ifp->info;
@@ -1219,13 +1210,11 @@ void zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
if (!br_ifp) {
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
zlog_debug(
- "%s: dp-install sync-mac vni %u mac %s es %s 0x%x %sskipped, no br",
- caller, zevpn->vni,
- prefix_mac2str(&mac->macaddr, macbuf,
- sizeof(macbuf)),
+ "%s: dp-install sync-mac vni %u mac %pEA es %s 0x%x %sskipped, no br",
+ caller, zevpn->vni, &mac->macaddr,
mac->es ? mac->es->esi_str : "-", mac->flags,
set_inactive ? "inactive " : "");
- return;
+ return -1;
}
sticky = !!CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY);
@@ -1234,17 +1223,42 @@ void zebra_evpn_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
else
set_static = zebra_evpn_mac_is_static(mac);
+ /* We can install a local mac that has been synced from the peer
+ * over the VxLAN-overlay/network-port if fast failover is not
+ * supported and if the local ES is oper-down.
+ */
+ if (mac->es && zebra_evpn_es_local_mac_via_network_port(mac->es)) {
+ if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
+ zlog_debug(
+ "dp-%s sync-nw-mac vni %u mac %pEA es %s 0x%x %s",
+ set_static ? "install" : "uninstall",
+ zevpn->vni, &mac->macaddr,
+ mac->es ? mac->es->esi_str : "-", mac->flags,
+ set_inactive ? "inactive " : "");
+ if (set_static)
+ /* XXX - old_static needs to be computed more
+ * accurately
+ */
+ zebra_evpn_rem_mac_install(zevpn, mac,
+ true /* old_static */);
+ else
+ zebra_evpn_rem_mac_uninstall(zevpn, mac,
+ false /* force */);
+
+ return 0;
+ }
+
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
zlog_debug(
- "dp-install sync-mac vni %u mac %s es %s 0x%x %s%s",
- zevpn->vni,
- prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)),
+ "dp-install sync-mac vni %u mac %pEA es %s 0x%x %s%s",
+ zevpn->vni, &mac->macaddr,
mac->es ? mac->es->esi_str : "-", mac->flags,
set_static ? "static " : "",
set_inactive ? "inactive " : "");
dplane_local_mac_add(ifp, br_ifp, vid, &mac->macaddr, sticky,
set_static, set_inactive);
+ return 0;
}
void zebra_evpn_mac_send_add_del_to_client(zebra_mac_t *mac, bool old_bgp_ready,