s = zclient->obuf;
stream_reset(s);
- zclient_create_header(
- s, add ? ZEBRA_REMOTE_MACIP_ADD : ZEBRA_REMOTE_MACIP_DEL,
- bgp->vrf_id);
+ zclient_create_header(s, add ? ZEBRA_REMOTE_MACIP_ADD
+ : ZEBRA_REMOTE_MACIP_DEL,
+ bgp->vrf_id);
stream_putl(s, vpn->vni);
stream_put(s, &p->prefix.mac.octet, ETH_ALEN); /* Mac Addr */
/* IP address length and IP address, if any. */
s = zclient->obuf;
stream_reset(s);
- zclient_create_header(
- s, add ? ZEBRA_REMOTE_VTEP_ADD : ZEBRA_REMOTE_VTEP_DEL,
- bgp->vrf_id);
+ zclient_create_header(s, add ? ZEBRA_REMOTE_VTEP_ADD
+ : ZEBRA_REMOTE_VTEP_DEL,
+ bgp->vrf_id);
stream_putl(s, vpn->vni);
if (IS_EVPN_PREFIX_IPADDR_V4(p))
stream_put_in_addr(s, &p->prefix.ip.ipaddr_v4);
{
struct ecommunity ecom_tmp;
struct ecommunity_val eval;
- struct ecommunity *ecom_mm;
+ u_int8_t *ecom_val_ptr;
int i;
u_int8_t *pnt;
int type = 0;
encode_mac_mobility_extcomm(0, seq_num, &eval);
/* Find current MM ecommunity */
- ecom_mm = NULL;
+ ecom_val_ptr = NULL;
if (attr->ecommunity) {
for (i = 0; i < attr->ecommunity->size; i++) {
if (type == ECOMMUNITY_ENCODE_EVPN
&& sub_type
== ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) {
- ecom_mm = (struct ecommunity *)
- attr->ecommunity->val
- + (i * 8);
+ ecom_val_ptr =
+ (u_int8_t *)(attr->ecommunity->val
+ + (i * 8));
break;
}
}
}
/* Update the existing MM ecommunity */
- if (ecom_mm) {
- memcpy(ecom_mm->val, eval.val, sizeof(char) * ECOMMUNITY_SIZE);
+ if (ecom_val_ptr) {
+ memcpy(ecom_val_ptr, eval.val, sizeof(char) * ECOMMUNITY_SIZE);
}
/* Add MM to existing */
else {
}
add = 0; /* This is an update of local interface. */
+ } else if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) {
+ /*
+ * If we have already learned the MAC as a remote sticky
+ * MAC,
+ * this is a operator error and we must log a warning
+ */
+ if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY))
+ zlog_warn(
+ "MAC %s is already learnt as a remote sticky mac behind VTEP %s VNI %d",
+ prefix_mac2str(macaddr, buf,
+ sizeof(buf)),
+ inet_ntoa(mac->fwd_info.r_vtep_ip),
+ zvni->vni);
+ return 0;
}
}