uint8_t flags, uint32_t seq,
const esi_t *esi)
{
- struct sync_mac_ip_ctx ctx;
char ipbuf[INET6_ADDRSTRLEN];
bool sticky;
bool remote_gw;
struct zebra_neigh *n = NULL;
+ struct zebra_mac *mac = NULL;
sticky = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
remote_gw = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
return;
}
- if (ipa_len) {
+ if (!ipa_len) {
+ /* MAC update */
+ (void)zebra_evpn_proc_sync_mac_update(zevpn, macaddr, ipa_len,
+ ipaddr, flags, seq, esi);
+ } else {
+ /* MAC-IP update */
+ mac = zebra_evpn_mac_lookup(zevpn, macaddr);
+ if (!mac) {
+ mac = zebra_evpn_proc_sync_mac_update(zevpn, macaddr,
+ ipa_len, ipaddr,
+ flags, seq, esi);
+ }
+ if (!mac)
+ return;
+
n = zebra_evpn_neigh_lookup(zevpn, ipaddr);
if (n
&& !zebra_evpn_neigh_is_bgp_seq_ok(zevpn, n, macaddr, seq,
true))
return;
- }
- memset(&ctx, 0, sizeof(ctx));
- ctx.mac = zebra_evpn_proc_sync_mac_update(
- zevpn, macaddr, ipa_len, ipaddr, flags, seq, esi, &ctx);
- if (ctx.ignore_macip || !ctx.mac || !ipa_len)
- return;
-
- zebra_evpn_proc_sync_neigh_update(zevpn, n, ipa_len, ipaddr, flags, seq,
- esi, &ctx);
+ zebra_evpn_proc_sync_neigh_update(zevpn, n, ipa_len, ipaddr,
+ flags, seq, esi, mac);
+ }
}
/************************** remote mac-ip handling **************************/
if (ifp)
zif = ifp->info;
if (!ifp || !if_is_operative(ifp) || !zif || !zif->brslave_info.br_if) {
- zlog_warn(
- "Ignoring remote MACIP ADD VNI %u, invalid interface state or info",
- vni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "Ignoring remote MACIP ADD VNI %u, invalid interface state or info",
+ vni);
return;
}
}
zvrf = zebra_vrf_get_evpn();
- if (zebra_evpn_mac_remote_macip_add(zevpn, zvrf, macaddr, ipa_len,
- ipaddr, &mac, vtep_ip, flags, seq,
- esi)
- != 0)
+ if (!zvrf)
return;
- zebra_evpn_neigh_remote_macip_add(zevpn, zvrf, ipaddr, mac, vtep_ip,
- flags, seq);
+ if (!ipa_len) {
+ /* MAC update */
+ zebra_evpn_mac_remote_macip_add(zevpn, zvrf, macaddr, vtep_ip,
+ flags, seq, esi);
+ } else {
+ /* MAC-IP update
+ * Add auto MAC if it doesn't exist.
+ */
+ mac = zebra_evpn_mac_lookup(zevpn, macaddr);
+ if (!mac) {
+ mac = zebra_evpn_mac_add_auto(zevpn, macaddr);
+
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "Neigh %pIA: MAC %pEA not found, Auto MAC created",
+ ipaddr, macaddr);
+ }
+
+ zebra_evpn_neigh_remote_macip_add(zevpn, zvrf, ipaddr, mac,
+ vtep_ip, flags, seq);
+ }
}
/* Process a remote MACIP delete from BGP. */
if (n && !mac) {
zlog_warn(
- "Failed to locate MAC %pEA for neigh %pIA VNI %u upon remote MACIP DEL",
+ "Failed to locate MAC %pEA for Neigh %pIA VNI %u upon remote MACIP DEL",
macaddr, ipaddr, vni);
return;
}
/* If the remote mac or neighbor doesn't exist there is nothing
* more to do. Otherwise, uninstall the entry and then remove it.
*/
- if (!mac && !n)
+ if (!mac && !n) {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "Failed to locate MAC %pEA & Neigh %pIA VNI %u upon remote MACIP DEL",
+ macaddr, ipaddr, vni);
return;
+ }
zvrf = zevpn->vxlan_if->vrf->info;