+++ /dev/null
-/*
- * 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");
+++ /dev/null
-/*
- * 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
#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,
#include "lib/mpls.h"
#include "table.h"
+#include "memory.h"
+
+DECLARE_MGROUP(STATIC);
/* Static route label information */
struct static_nh_label {
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
*/
#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;
#include "northbound_cli.h"
#include "static_vrf.h"
-#include "static_memory.h"
#include "static_vty.h"
#include "static_routes.h"
#include "static_debug.h"
staticd_libstatic_a_SOURCES = \
staticd/static_debug.c \
- staticd/static_memory.c \
staticd/static_nht.c \
staticd/static_routes.c \
staticd/static_zebra.c \
noinst_HEADERS += \
staticd/static_debug.h \
- staticd/static_memory.h \
staticd/static_nht.h \
staticd/static_zebra.h \
staticd/static_routes.h \