diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 5ba075e297f4..6d5cd66143d3 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -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)); } @@ -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); } /* @@ -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);