Skip to content

Commit

Permalink
Merge pull request #13330 from chiragshah6/fdev1
Browse files Browse the repository at this point in the history
zebra: EVPN handle duplicate detected local mac delete event
  • Loading branch information
ton31337 authored Apr 24, 2023
2 parents ea4163c + 89844a9 commit 76cd90f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions zebra/zebra_evpn_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,12 +1038,11 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni,
char flag_buf[MACIP_BUF_SIZE];

zlog_debug(
"Send MACIP %s f %s MAC %pEA IP %pIA seq %u L2-VNI %u ESI %s to %s",
"Send MACIP %s f %s state %u MAC %pEA IP %pIA seq %u L2-VNI %u ESI %s to %s",
(cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del",
zclient_evpn_dump_macip_flags(flags, flag_buf,
sizeof(flag_buf)),
macaddr, ip, seq, vni,
es ? es->esi_str : "-",
state, macaddr, ip, seq, vni, es ? es->esi_str : "-",
zebra_route_string(client->proto));
}

Expand Down Expand Up @@ -1341,16 +1340,26 @@ int zebra_evpn_mac_send_add_to_client(vni_t vni, const struct ethaddr *macaddr,
int zebra_evpn_mac_send_del_to_client(vni_t vni, const struct ethaddr *macaddr,
uint32_t flags, bool force)
{
int state = ZEBRA_NEIGH_ACTIVE;

if (!force) {
if (CHECK_FLAG(flags, ZEBRA_MAC_LOCAL_INACTIVE)
&& !CHECK_FLAG(flags, ZEBRA_MAC_ES_PEER_ACTIVE))
/* the host was not advertised - nothing to delete */
return 0;

/* MAC is LOCAL and DUP_DETECTED, this local mobility event
* is not known to bgpd. Upon receiving local delete
* ask bgp to reinstall the best route (remote entry).
*/
if (CHECK_FLAG(flags, ZEBRA_MAC_LOCAL) &&
CHECK_FLAG(flags, ZEBRA_MAC_DUPLICATE))
state = ZEBRA_NEIGH_INACTIVE;
}

return zebra_evpn_macip_send_msg_to_client(
vni, macaddr, NULL, 0 /* flags */, 0 /* seq */,
ZEBRA_NEIGH_ACTIVE, NULL, ZEBRA_MACIP_DEL);
vni, macaddr, NULL, 0 /* flags */, 0 /* seq */, state, NULL,
ZEBRA_MACIP_DEL);
}

/*
Expand Down Expand Up @@ -2435,7 +2444,7 @@ int zebra_evpn_del_local_mac(struct zebra_evpn *zevpn, struct zebra_mac *mac,

/* Remove MAC from BGP. */
zebra_evpn_mac_send_del_to_client(zevpn->vni, &mac->macaddr, mac->flags,
false /* force */);
clear_static /* force */);

zebra_evpn_es_mac_deref_entry(mac);

Expand Down

0 comments on commit 76cd90f

Please sign in to comment.