]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Cleanup svd_nh_table on shutdown
authorDonald Sharp <sharpd@nvidia.com>
Mon, 20 Nov 2023 18:57:59 +0000 (13:57 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 21 Nov 2023 17:41:18 +0000 (12:41 -0500)
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/zebra_router.c
zebra/zebra_vxlan.c
zebra/zebra_vxlan.h

index 52997160918b17b3517849e275aad58dd2f50062..d75f57f16f0a7daef779cceaa1efdc31e2b773ec 100644 (file)
@@ -246,6 +246,7 @@ void zebra_router_terminate(void)
        zebra_script_destroy();
 #endif
 
+       zebra_vxlan_terminate();
        /* OS-specific deinit */
        kernel_router_terminate();
 }
index 5480a94d27c52c2c772c6561255a192cb969f89b..91a5bc4d425296019471e503da2405ff602d5ec2 100644 (file)
@@ -82,7 +82,7 @@ static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni,
                               struct zebra_neigh *n);
 static struct zebra_neigh *svd_nh_add(const struct ipaddr *vtep_ip,
                                      const struct ethaddr *rmac);
-static int svd_nh_del(struct zebra_neigh *n);
+static void svd_nh_del(struct zebra_neigh *n);
 static int svd_nh_install(struct zebra_l3vni *zl3vni, struct zebra_neigh *n);
 static int svd_nh_uninstall(struct zebra_l3vni *zl3vni, struct zebra_neigh *n);
 
@@ -1590,17 +1590,24 @@ static struct zebra_neigh *svd_nh_add(const struct ipaddr *ip,
 /*
  * Del Single VXlan Device neighbor entry.
  */
-static int svd_nh_del(struct zebra_neigh *n)
+static void svd_nh_del(struct zebra_neigh *n)
 {
        if (n->refcnt > 0)
-               return -1;
+               return;
 
        hash_release(svd_nh_table, n);
        XFREE(MTYPE_L3NEIGH, n);
+}
 
-       return 0;
+static void svd_nh_del_terminate(void *ptr)
+{
+       struct zebra_neigh *n = ptr;
+
+       n->refcnt = 0;
+       svd_nh_del(n);
 }
 
+
 /*
  * Common code to install remote nh as neigh into the kernel.
  */
@@ -5813,6 +5820,11 @@ void zebra_vxlan_init(void)
        zebra_evpn_mh_init();
 }
 
+void zebra_vxlan_terminate(void)
+{
+       hash_clean_and_free(&svd_nh_table, svd_nh_del_terminate);
+}
+
 /* free l3vni table */
 void zebra_vxlan_disable(void)
 {
index 98c2767eb2bb5733a9a7a5f11e0d8986687d1c77..5785e0b3c3a5290401872fabc7d29785be2ccb84 100644 (file)
@@ -185,6 +185,7 @@ extern void zebra_vxlan_init_tables(struct zebra_vrf *zvrf);
 extern void zebra_vxlan_close_tables(struct zebra_vrf *);
 extern void zebra_vxlan_cleanup_tables(struct zebra_vrf *);
 extern void zebra_vxlan_init(void);
+extern void zebra_vxlan_terminate(void);
 extern void zebra_vxlan_disable(void);
 extern void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
                                           const struct ethaddr *rmac,