memset(pp, 0, sizeof(struct prefix));
if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
ip_prefix_from_type2_prefix(evp, pp);
- else if(evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
+ else if (evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE)
ip_prefix_from_type5_prefix(evp, pp);
if (bgp_debug_zebra(NULL)) {
zvni_del(zvni);
}
+/* cleanup L3VNI */
+static void zl3vni_cleanup_all(struct hash_backet *backet,
+ void *args)
+{
+ zebra_l3vni_t *zl3vni = NULL;
+
+ zl3vni = (zebra_l3vni_t *)backet->data;
+ if (!zl3vni)
+ return;
+
+ zebra_vxlan_process_l3vni_oper_down(zl3vni);
+}
+
static int is_host_present_in_host_list(struct list *list,
struct prefix *host)
{
static void zebra_vxlan_process_l3vni_oper_up(zebra_l3vni_t *zl3vni)
{
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("L3-VNI %u is UP - send add to BGP and update all neigh enries",
+ zlog_debug("L3-VNI %u is UP - send add to BGP",
zl3vni->vni);
/* send l3vni add to BGP */
static void zebra_vxlan_process_l3vni_oper_down(zebra_l3vni_t *zl3vni)
{
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("L3-VNI %u is Down - send del to BGP and update all neigh enries",
+ zlog_debug("L3-VNI %u is Down - Send del to BGP",
zl3vni->vni);
/* send l3-vni del to BGP*/
int zebra_vxlan_advertise_all_vni(struct zserv *client,
u_short length, struct zebra_vrf *zvrf)
{
- struct stream *s;
- int advertise;
+ struct stream *s = NULL;
+ int advertise = 0;
+ struct zebra_ns *zns = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
zlog_err("EVPN VNI Adv for non-default VRF %u",
* kernel and free entries.
*/
hash_iterate(zvrf->vni_table, zvni_cleanup_all, zvrf);
+
+ /* cleanup all l3vnis */
+ zns = zebra_ns_lookup(NS_DEFAULT);
+ if (!zns)
+ return -1;
+
+ hash_iterate(zns->l3vni_table, zl3vni_cleanup_all, NULL);
}
stream_failure:
#include "if.h"
#include "linklist.h"
+#include "zebra_vxlan.h"
#define ERR_STR_SZ 256
/*
* l3-vni is oper up when:
+ * 0. if EVPN is enabled (advertise-all-vni cfged)
* 1. it is associated to a vxlan-intf
* 2. Associated vxlan-intf is oper up
* 3. it is associated to an SVI
*/
static inline int is_l3vni_oper_up(zebra_l3vni_t *zl3vni)
{
- return (zl3vni &&
+ return (is_evpn_enabled() && zl3vni &&
(zl3vni->vrf_id != VRF_UNKNOWN) &&
zl3vni->vxlan_if && if_is_operative(zl3vni->vxlan_if) &&
zl3vni->svi_if && if_is_operative(zl3vni->svi_if));