zebra: send a local-mac del to bgpd on mac mod to remote

When events cross paths between bgp and zebra bgpd could end up with a
dangling local MAC entry. Consider the following sequence of events on
rack-1 -
1. MAC1 has MM sequence number 1 and points to rack-3
2. Now a packet is rxed locally on rack-1 and rack-2 (simultaneously) with
source-mac=MAC1.
3. This would cause rack-1 and rack-2 to set the MM seq to 2 and
simultaneously report the MAC as local.
4. Now let's say on rack-1 zebra's MACIP_ADD is in bgpd's queue. bgpd
accepts rack-3's update and sends a remote MACIP add to zebra with MM=2.
5. zebra updates the MAC entry from local=>remote.
6. bgpd now processes zebra's "stale local" making it the best path.
However zebra no longer has a local MAC entry.

At this point bgpd and zebra are effectively out of sync i.e. bgpd has a
local-MAC which is not present in the kernel or in zebra.

To handle this window zebra should send a local MAC delete to bgpd on
modifying its cache to remote.

Ticket: CM-22687
Reviewed By: CCR-7935

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
Anuradha Karuppiah 2018-10-11 08:48:42 -07:00 committed by Donald Sharp
parent 8029b21687
commit e98e4b8899

View File

@ -148,8 +148,7 @@ static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *macaddr);
static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr,
uint8_t flags, uint32_t seq);
static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr,
uint8_t flags);
static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr);
static zebra_vni_t *zvni_map_vlan(struct interface *ifp,
struct interface *br_if, vlanid_t vid);
static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac);
@ -2321,7 +2320,7 @@ static void zvni_mac_del_hash_entry(struct hash_backet *backet, void *arg)
&wctx->r_vtep_ip))) {
if (wctx->upd_client && (mac->flags & ZEBRA_MAC_LOCAL)) {
zvni_mac_send_del_to_client(wctx->zvni->vni,
&mac->macaddr, mac->flags);
&mac->macaddr);
}
if (wctx->uninstall)
@ -2408,18 +2407,10 @@ static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr,
/*
* Inform BGP about local MAC deletion.
*/
static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr,
uint8_t mac_flags)
static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr)
{
uint8_t flags = 0;
if (CHECK_FLAG(mac_flags, ZEBRA_MAC_STICKY))
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
if (CHECK_FLAG(mac_flags, ZEBRA_MAC_DEF_GW))
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
return zvni_macip_send_msg_to_client(vni, macaddr, NULL, flags,
0, ZEBRA_MACIP_DEL);
return zvni_macip_send_msg_to_client(vni, macaddr, NULL, 0 /* flags */,
0 /* seq */, ZEBRA_MACIP_DEL);
}
/*
@ -4218,6 +4209,10 @@ static void process_remote_macip_add(vni_t vni,
}
}
/* Remove local MAC from BGP. */
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL))
zvni_mac_send_del_to_client(zvni->vni, macaddr);
/* Set "auto" and "remote" forwarding info. */
UNSET_FLAG(mac->flags, ZEBRA_MAC_LOCAL);
memset(&mac->fwd_info, 0, sizeof(mac->fwd_info));
@ -4238,6 +4233,7 @@ static void process_remote_macip_add(vni_t vni,
/* Install the entry. */
zvni_mac_install(zvni, mac);
}
/* Update seq number. */
@ -5631,7 +5627,7 @@ int zebra_vxlan_check_del_local_mac(struct interface *ifp,
ifp->ifindex, vni);
/* Remove MAC from BGP. */
zvni_mac_send_del_to_client(zvni->vni, macaddr, mac->flags);
zvni_mac_send_del_to_client(zvni->vni, macaddr);
/*
* If there are no neigh associated with the mac delete the mac
@ -5742,7 +5738,7 @@ int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if,
zvni_process_neigh_on_local_mac_del(zvni, mac);
/* Remove MAC from BGP. */
zvni_mac_send_del_to_client(zvni->vni, macaddr, mac->flags);
zvni_mac_send_del_to_client(zvni->vni, macaddr);
/*
* If there are no neigh associated with the mac delete the mac