]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra/bgpd: cleanup l3vni on no advertise-all-vni
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Tue, 14 Nov 2017 07:12:15 +0000 (23:12 -0800)
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Thu, 14 Dec 2017 18:57:08 +0000 (10:57 -0800)
EVPN is only enabled when user configures advertise-all-vni.
All VNIs (L2 and L3) should be cleared upon removal of this config.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_evpn.c
zebra/zebra_vxlan.c
zebra/zebra_vxlan_private.h

index 6d898afdd0a932839245d7929ee1c069c973b1ec..cb74515b9106f806503ed8f5c904b16e0be75264 100644 (file)
@@ -1856,7 +1856,7 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
        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)) {
index 767fc030814c9233c12d3b5c7ddcf195db963a5c..8c06298ec51b78f609844ef92089d316ae4cc6e4 100644 (file)
@@ -2818,6 +2818,19 @@ static void zvni_cleanup_all(struct hash_backet *backet, void *zvrf)
        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)
 {
@@ -3588,7 +3601,7 @@ static int zl3vni_send_del_to_client(zebra_l3vni_t *zl3vni)
 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 */
@@ -3598,7 +3611,7 @@ static void zebra_vxlan_process_l3vni_oper_up(zebra_l3vni_t *zl3vni)
 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*/
@@ -6499,8 +6512,9 @@ stream_failure:
 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",
@@ -6538,6 +6552,13 @@ int zebra_vxlan_advertise_all_vni(struct zserv *client,
                 * 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:
index 8aeb46c945538bd45d6c4317619f0236d0098d70..ef6f9b99cb765c7e1ef6b33158609e4af38a6a67 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "if.h"
 #include "linklist.h"
+#include "zebra_vxlan.h"
 
 #define ERR_STR_SZ 256
 
@@ -165,6 +166,7 @@ static inline const char *zl3vni_rmac2str(zebra_l3vni_t *zl3vni, char *buf,
 
 /*
  * 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
@@ -172,7 +174,7 @@ static inline const char *zl3vni_rmac2str(zebra_l3vni_t *zl3vni, char *buf,
  */
 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));