Merge pull request #5780 from chiragshah6/evpn_dev1

zebra:remote vtep delete handling
This commit is contained in:
Sri Mohana Singamsetty 2020-03-02 09:39:37 -08:00 committed by GitHub
commit 331f2f8531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,8 +101,6 @@ static void *zvni_neigh_alloc(void *p);
static zebra_neigh_t *zvni_neigh_add(zebra_vni_t *zvni, struct ipaddr *ip, static zebra_neigh_t *zvni_neigh_add(zebra_vni_t *zvni, struct ipaddr *ip,
struct ethaddr *mac); struct ethaddr *mac);
static int zvni_neigh_del(zebra_vni_t *zvni, zebra_neigh_t *n); static int zvni_neigh_del(zebra_vni_t *zvni, zebra_neigh_t *n);
static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip);
static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
uint32_t flags); uint32_t flags);
static zebra_neigh_t *zvni_neigh_lookup(zebra_vni_t *zvni, struct ipaddr *ip); static zebra_neigh_t *zvni_neigh_lookup(zebra_vni_t *zvni, struct ipaddr *ip);
@ -156,8 +154,6 @@ static bool mac_cmp(const void *p1, const void *p2);
static void *zvni_mac_alloc(void *p); static void *zvni_mac_alloc(void *p);
static zebra_mac_t *zvni_mac_add(zebra_vni_t *zvni, struct ethaddr *macaddr); static zebra_mac_t *zvni_mac_add(zebra_vni_t *zvni, struct ethaddr *macaddr);
static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac); static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac);
static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip);
static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client, static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
uint32_t flags); uint32_t flags);
static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *macaddr); static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *macaddr);
@ -2301,26 +2297,6 @@ static void zvni_neigh_del_hash_entry(struct hash_bucket *bucket, void *arg)
return; return;
} }
/*
* Delete all neighbor entries from specific VTEP for a particular VNI.
*/
static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip)
{
struct neigh_walk_ctx wctx;
if (!zvni->neigh_table)
return;
memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
wctx.zvni = zvni;
wctx.uninstall = uninstall;
wctx.flags = DEL_REMOTE_NEIGH_FROM_VTEP;
wctx.r_vtep_ip = *r_vtep_ip;
hash_iterate(zvni->neigh_table, zvni_neigh_del_hash_entry, &wctx);
}
/* /*
* Delete all neighbor entries for this VNI. * Delete all neighbor entries for this VNI.
*/ */
@ -3486,26 +3462,6 @@ static void zvni_mac_del_hash_entry(struct hash_bucket *bucket, void *arg)
return; return;
} }
/*
* Delete all MAC entries from specific VTEP for a particular VNI.
*/
static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip)
{
struct mac_walk_ctx wctx;
if (!zvni->mac_table)
return;
memset(&wctx, 0, sizeof(struct mac_walk_ctx));
wctx.zvni = zvni;
wctx.uninstall = uninstall;
wctx.flags = DEL_REMOTE_MAC_FROM_VTEP;
wctx.r_vtep_ip = *r_vtep_ip;
hash_iterate(zvni->mac_table, zvni_mac_del_hash_entry, &wctx);
}
/* /*
* Delete all MAC entries for this VNI. * Delete all MAC entries for this VNI.
*/ */
@ -5875,14 +5831,11 @@ static void process_remote_macip_del(vni_t vni,
zns = zebra_ns_lookup(NS_DEFAULT); zns = zebra_ns_lookup(NS_DEFAULT);
vxl = &zif->l2info.vxl; vxl = &zif->l2info.vxl;
/* The remote VTEP specified is normally expected to exist, but /* It is possible remote vtep del request is processed prior to
* it is possible that the peer may delete the VTEP before deleting * remote macip route delete. remote_vtep_del does not clean up
* any MACs referring to the VTEP, in which case the handler (see * the macip route delete. Explicite withdraw of the macip route
* remote_vtep_del) would have already deleted the MACs. * is expected to recieve. This handler removes the remote route.
*/ */
if (!zvni_vtep_find(zvni, &vtep_ip))
return;
mac = zvni_mac_lookup(zvni, macaddr); mac = zvni_mac_lookup(zvni, macaddr);
if (ipa_len) if (ipa_len)
n = zvni_neigh_lookup(zvni, ipaddr); n = zvni_neigh_lookup(zvni, ipaddr);
@ -8284,8 +8237,6 @@ void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS)
if (!zvtep) if (!zvtep)
continue; continue;
zvni_neigh_del_from_vtep(zvni, 1, &vtep_ip);
zvni_mac_del_from_vtep(zvni, 1, &vtep_ip);
zvni_vtep_uninstall(zvni, &vtep_ip); zvni_vtep_uninstall(zvni, &vtep_ip);
zvni_vtep_del(zvni, zvtep); zvni_vtep_del(zvni, zvtep);
} }