struct zebra_vrf *zvrf;
zvrf = zebra_vrf_get_evpn();
- if (zvrf && zvrf->advertise_gw_macip)
+ if (zvrf->advertise_gw_macip)
return 1;
if (zevpn && zevpn->advertise_gw_macip)
struct zebra_vrf *zvrf;
zvrf = zebra_vrf_get_evpn();
- if (zvrf && zvrf->advertise_svi_macip)
+ if (zvrf->advertise_svi_macip)
return 1;
if (zevpn && zevpn->advertise_svi_macip)
vxl = &zif->l2info.vxl;
- if (zebra_evpn_mac_gw_macip_add(ifp, zevpn, ip, &mac, macaddr,
- vxl->access_vlan, true)
- != 0)
- return -1;
+ zebra_evpn_mac_gw_macip_add(ifp, zevpn, ip, &mac, macaddr,
+ vxl->access_vlan, true);
return zebra_evpn_neigh_gw_macip_add(ifp, zevpn, ip, mac);
}
struct zebra_l2info_vxlan *vxl = NULL;
struct zebra_from_svi_param *in_param =
(struct zebra_from_svi_param *)_in_param;
- int found = 0;
- if (!in_param)
- return NS_WALK_STOP;
+ assert(p_zevpn && in_param);
+
br_if = in_param->br_if;
zif = in_param->zif;
assert(zif);
if (!in_param->bridge_vlan_aware
|| vxl->access_vlan == in_param->vid) {
- found = 1;
- break;
+ zevpn = zebra_evpn_lookup(vxl->vni);
+ *p_zevpn = zevpn;
+ return NS_WALK_STOP;
}
}
- if (!found)
- return NS_WALK_CONTINUE;
- zevpn = zebra_evpn_lookup(vxl->vni);
- if (p_zevpn)
- *p_zevpn = zevpn;
- return NS_WALK_STOP;
+ return NS_WALK_CONTINUE;
}
/*
struct interface *tmp_if = NULL;
struct zebra_if *zif;
- if (!in_param)
- return NS_WALK_STOP;
+ assert(in_param && p_ifp);
/* Identify corresponding VLAN interface. */
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
continue;
if (zif->link == in_param->svi_if) {
- if (p_ifp)
- *p_ifp = tmp_if;
+ *p_ifp = tmp_if;
return NS_WALK_STOP;
}
}
struct zebra_evpn *zevpn = NULL;
zvrf = zebra_vrf_get_evpn();
- assert(zvrf);
- memset(&tmp_vni, 0, sizeof(struct zebra_evpn));
+ memset(&tmp_vni, 0, sizeof(tmp_vni));
tmp_vni.vni = vni;
zevpn = hash_lookup(zvrf->evpn_table, &tmp_vni);
struct zebra_evpn *zevpn = NULL;
zvrf = zebra_vrf_get_evpn();
- assert(zvrf);
- memset(&tmp_zevpn, 0, sizeof(struct zebra_evpn));
+ memset(&tmp_zevpn, 0, sizeof(tmp_zevpn));
tmp_zevpn.vni = vni;
zevpn = hash_get(zvrf->evpn_table, &tmp_zevpn, zebra_evpn_alloc);
- assert(zevpn);
zebra_evpn_es_evi_init(zevpn);
struct zebra_evpn *tmp_zevpn;
zvrf = zebra_vrf_get_evpn();
- assert(zvrf);
zevpn->svi_if = NULL;
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;
}
if (!zvrf)
return;
+ 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 (zebra_evpn_mac_remote_macip_add(zevpn, zvrf, macaddr, ipa_len,
- ipaddr, &mac, vtep_ip, flags, seq,
- esi)
- != 0)
- return;
+ 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);
+ 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;