]> git.proxmox.com Git - mirror_frr.git/commitdiff
staticd: kill static_memory.h, use MTYPE_STATIC
authorDavid Lamparter <equinox@diac24.net>
Mon, 22 Mar 2021 18:41:54 +0000 (19:41 +0100)
committerDavid Lamparter <equinox@diac24.net>
Mon, 22 Mar 2021 18:41:54 +0000 (19:41 +0100)
This one needed a move of zebra_stable_node_cleanup() from static_vrf.c
to static_routes.c.  But it seems to actually make sense there.

Signed-off-by: David Lamparter <equinox@diac24.net>
staticd/static_memory.c [deleted file]
staticd/static_memory.h [deleted file]
staticd/static_routes.c
staticd/static_routes.h
staticd/static_vrf.c
staticd/static_vty.c
staticd/subdir.am

diff --git a/staticd/static_memory.c b/staticd/static_memory.c
deleted file mode 100644 (file)
index 9d8d764..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * static memory code.
- * Copyright (C) 2018 Cumulus Networks, Inc.
- *               Donald Sharp
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <zebra.h>
-
-#include <memory.h>
-
-#include "staticd/static_memory.h"
-
-DEFINE_MGROUP(STATIC, "staticd");
-
-DEFINE_MTYPE(STATIC, STATIC_NEXTHOP, "Static Nexthop");
diff --git a/staticd/static_memory.h b/staticd/static_memory.h
deleted file mode 100644 (file)
index 5348129..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * static memory code.
- * Copyright (C) 2018 Cumulus Networks, Inc.
- *               Donald Sharp
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __STATIC_MEMORY_H__
-
-#include "memory.h"
-
-DECLARE_MGROUP(STATIC);
-
-DECLARE_MTYPE(STATIC_ROUTE);
-DECLARE_MTYPE(STATIC_NEXTHOP);
-DECLARE_MTYPE(STATIC_PATH);
-
-#endif
index 9f7e19660d675216ad2ffb2b99eabd7578c0541e..739c08b09ebcac108046d6b3b8e375a3ddd3017c 100644 (file)
 
 #include "static_vrf.h"
 #include "static_routes.h"
-#include "static_memory.h"
 #include "static_zebra.h"
 #include "static_debug.h"
 
-DEFINE_MTYPE(STATIC, STATIC_ROUTE, "Static Route Info");
-DEFINE_MTYPE(STATIC, STATIC_PATH, "Static Path");
+DEFINE_MGROUP(STATIC, "staticd");
+
+DEFINE_MTYPE_STATIC(STATIC, STATIC_ROUTE,   "Static Route Info");
+DEFINE_MTYPE_STATIC(STATIC, STATIC_PATH,    "Static Path");
+DEFINE_MTYPE_STATIC(STATIC, STATIC_NEXTHOP, "Static Nexthop");
+
+void zebra_stable_node_cleanup(struct route_table *table,
+                              struct route_node *node)
+{
+       struct static_nexthop *nh;
+       struct static_path *pn;
+       struct static_route_info *si;
+       struct route_table *src_table;
+       struct route_node *src_node;
+       struct static_path *src_pn;
+       struct static_route_info *src_si;
+
+       si = node->info;
+
+       if (si) {
+               frr_each_safe(static_path_list, &si->path_list, pn) {
+                       frr_each_safe(static_nexthop_list, &pn->nexthop_list,
+                                      nh) {
+                               static_nexthop_list_del(&pn->nexthop_list, nh);
+                               XFREE(MTYPE_STATIC_NEXTHOP, nh);
+                       }
+                       static_path_list_del(&si->path_list, pn);
+                       XFREE(MTYPE_STATIC_PATH, pn);
+               }
+
+               /* clean up for dst table */
+               src_table = srcdest_srcnode_table(node);
+               if (src_table) {
+                       /* This means the route_node is part of the top
+                        * hierarchy and refers to a destination prefix.
+                        */
+                       for (src_node = route_top(src_table); src_node;
+                            src_node = route_next(src_node)) {
+                               src_si = src_node->info;
+
+                               frr_each_safe(static_path_list,
+                                             &src_si->path_list, src_pn) {
+                                       frr_each_safe(static_nexthop_list,
+                                                     &src_pn->nexthop_list,
+                                                     nh) {
+                                               static_nexthop_list_del(
+                                                       &src_pn->nexthop_list,
+                                                       nh);
+                                               XFREE(MTYPE_STATIC_NEXTHOP, nh);
+                                       }
+                                       static_path_list_del(&src_si->path_list,
+                                                            src_pn);
+                                       XFREE(MTYPE_STATIC_PATH, src_pn);
+                               }
+
+                               XFREE(MTYPE_STATIC_ROUTE, src_node->info);
+                       }
+               }
+
+               XFREE(MTYPE_STATIC_ROUTE, node->info);
+       }
+}
 
 /* Install static path into rib. */
 void static_install_path(struct route_node *rn, struct static_path *pn,
index 0fbf0674d72fe306c1da4ff04fb5c4b81bca86a6..f64a40329d466c8424fd0503a729e9976f49ca4d 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "lib/mpls.h"
 #include "table.h"
+#include "memory.h"
+
+DECLARE_MGROUP(STATIC);
 
 /* Static route label information */
 struct static_nh_label {
@@ -198,6 +201,9 @@ extern bool static_add_nexthop_validate(const char *nh_vrf_name,
 extern struct stable_info *static_get_stable_info(struct route_node *rn);
 extern void static_route_info_init(struct static_route_info *si);
 
+extern void zebra_stable_node_cleanup(struct route_table *table,
+                                     struct route_node *node);
+
 /*
  * Max string return via API static_get_nh_str in size_t
  */
index 2133093bb302b3fa3f980085f35f96e312c9c9a4..ba1367b877f4175dc553e61ffc64f08b4693de23 100644 (file)
@@ -24,7 +24,6 @@
 #include "table.h"
 #include "srcdest_table.h"
 
-#include "static_memory.h"
 #include "static_vrf.h"
 #include "static_routes.h"
 #include "static_zebra.h"
 
 DEFINE_MTYPE_STATIC(STATIC, STATIC_RTABLE_INFO, "Static Route Table Info");
 
-static void zebra_stable_node_cleanup(struct route_table *table,
-                                     struct route_node *node)
-{
-       struct static_nexthop *nh;
-       struct static_path *pn;
-       struct static_route_info *si;
-       struct route_table *src_table;
-       struct route_node *src_node;
-       struct static_path *src_pn;
-       struct static_route_info *src_si;
-
-       si = node->info;
-
-       if (si) {
-               frr_each_safe(static_path_list, &si->path_list, pn) {
-                       frr_each_safe(static_nexthop_list, &pn->nexthop_list,
-                                      nh) {
-                               static_nexthop_list_del(&pn->nexthop_list, nh);
-                               XFREE(MTYPE_STATIC_NEXTHOP, nh);
-                       }
-                       static_path_list_del(&si->path_list, pn);
-                       XFREE(MTYPE_STATIC_PATH, pn);
-               }
-
-               /* clean up for dst table */
-               src_table = srcdest_srcnode_table(node);
-               if (src_table) {
-                       /* This means the route_node is part of the top
-                        * hierarchy and refers to a destination prefix.
-                        */
-                       for (src_node = route_top(src_table); src_node;
-                            src_node = route_next(src_node)) {
-                               src_si = src_node->info;
-
-                               frr_each_safe(static_path_list,
-                                             &src_si->path_list, src_pn) {
-                                       frr_each_safe(static_nexthop_list,
-                                                     &src_pn->nexthop_list,
-                                                     nh) {
-                                               static_nexthop_list_del(
-                                                       &src_pn->nexthop_list,
-                                                       nh);
-                                               XFREE(MTYPE_STATIC_NEXTHOP, nh);
-                                       }
-                                       static_path_list_del(&src_si->path_list,
-                                                            src_pn);
-                                       XFREE(MTYPE_STATIC_PATH, src_pn);
-                               }
-
-                               XFREE(MTYPE_STATIC_ROUTE, src_node->info);
-                       }
-               }
-
-               XFREE(MTYPE_STATIC_ROUTE, node->info);
-       }
-}
-
 static struct static_vrf *static_vrf_alloc(void)
 {
        struct route_table *table;
index dd03f8377885be8a8a257dc8257e798c27d5c0ef..33a2728cd0044c9b73d1b95e45bed1d73f7254dd 100644 (file)
@@ -33,7 +33,6 @@
 #include "northbound_cli.h"
 
 #include "static_vrf.h"
-#include "static_memory.h"
 #include "static_vty.h"
 #include "static_routes.h"
 #include "static_debug.h"
index 9c630e8f5ff6db4e0eb874759a88e29a192abd38..a0ae2569cbf65e30ba4dca30e239306d78a0615c 100644 (file)
@@ -13,7 +13,6 @@ endif
 
 staticd_libstatic_a_SOURCES = \
        staticd/static_debug.c \
-       staticd/static_memory.c \
        staticd/static_nht.c \
        staticd/static_routes.c \
        staticd/static_zebra.c \
@@ -25,7 +24,6 @@ staticd_libstatic_a_SOURCES = \
 
 noinst_HEADERS += \
        staticd/static_debug.h \
-       staticd/static_memory.h \
        staticd/static_nht.h \
        staticd/static_zebra.h \
        staticd/static_routes.h \