summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-03-22 20:02:17 +0100
committerDavid Lamparter <equinox@diac24.net>2021-03-22 20:02:17 +0100
commit224ccf29d9e9d08a6a177d8c994ab5a743b276cf (patch)
treee7133cf5297c133b905547fde3e35fce2df17ea3
parentstaticd: kill static_memory.h, use MTYPE_STATIC (diff)
downloadfrr-224ccf29d9e9d08a6a177d8c994ab5a743b276cf.tar.xz
frr-224ccf29d9e9d08a6a177d8c994ab5a743b276cf.zip
zebra: kill zebra_memory.h, use MTYPE_STATIC
This one also needed a bit of shuffling around, but MTYPE_RE is the only one left used across file boundaries now. Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r--zebra/connected.c1
-rw-r--r--zebra/if_ioctl.c1
-rw-r--r--zebra/if_netlink.c1
-rw-r--r--zebra/if_sysctl.c1
-rw-r--r--zebra/interface.c1
-rw-r--r--zebra/irdp_interface.c1
-rw-r--r--zebra/irdp_main.c1
-rw-r--r--zebra/irdp_packet.c1
-rw-r--r--zebra/kernel_netlink.c1
-rw-r--r--zebra/kernel_socket.c1
-rw-r--r--zebra/main.c1
-rw-r--r--zebra/redistribute.c1
-rw-r--r--zebra/rib.h5
-rw-r--r--zebra/router-id.c1
-rw-r--r--zebra/rt_netlink.c1
-rw-r--r--zebra/rtadv.c1
-rw-r--r--zebra/rtread_sysctl.c1
-rw-r--r--zebra/subdir.am2
-rw-r--r--zebra/zapi_msg.c8
-rw-r--r--zebra/zapi_msg.h2
-rw-r--r--zebra/zebra_dplane.c1
-rw-r--r--zebra/zebra_evpn.c1
-rw-r--r--zebra/zebra_evpn_mac.c1
-rw-r--r--zebra/zebra_evpn_mh.c1
-rw-r--r--zebra/zebra_evpn_neigh.c1
-rw-r--r--zebra/zebra_fpm.c1
-rw-r--r--zebra/zebra_l2.c1
-rw-r--r--zebra/zebra_memory.c33
-rw-r--r--zebra/zebra_memory.h41
-rw-r--r--zebra/zebra_mlag.c1
-rw-r--r--zebra/zebra_mpls.c1
-rw-r--r--zebra/zebra_netns_notify.c1
-rw-r--r--zebra/zebra_nhg.c1
-rw-r--r--zebra/zebra_ns.c3
-rw-r--r--zebra/zebra_opaque.c1
-rw-r--r--zebra/zebra_pbr.c1
-rw-r--r--zebra/zebra_ptm.c2
-rw-r--r--zebra/zebra_ptm_redistribute.c1
-rw-r--r--zebra/zebra_rib.c24
-rw-r--r--zebra/zebra_rnh.c1
-rw-r--r--zebra/zebra_routemap.c1
-rw-r--r--zebra/zebra_router.c6
-rw-r--r--zebra/zebra_srte.c1
-rw-r--r--zebra/zebra_vrf.c18
-rw-r--r--zebra/zebra_vty.c1
-rw-r--r--zebra/zebra_vxlan.c1
46 files changed, 40 insertions, 139 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index dd8fab5e4..6f405ca1b 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -29,7 +29,6 @@
#include "table.h"
#include "log.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "vty.h"
#include "zebra/debug.h"
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 8bec25635..14d8ac442 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -29,7 +29,6 @@
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
#include "vty.h"
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 98bde4b3c..af2c25160 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -44,7 +44,6 @@
#include "connected.h"
#include "table.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "rib.h"
#include "thread.h"
#include "privs.h"
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index 695cef199..38729c8d3 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -28,7 +28,6 @@
#include "prefix.h"
#include "connected.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "ioctl.h"
#include "log.h"
#include "interface.h"
diff --git a/zebra/interface.c b/zebra/interface.c
index c679e090c..3eeed9ac9 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -28,7 +28,6 @@
#include "prefix.h"
#include "command.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "ioctl.h"
#include "connected.h"
#include "log.h"
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index 52f485dd1..28db2ad87 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -34,7 +34,6 @@
#include "prefix.h"
#include "command.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 6a943a2e2..600fc3f2f 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -42,7 +42,6 @@
#include "prefix.h"
#include "command.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 6134df9c4..7d67c42a7 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -54,7 +54,6 @@
#include "zclient.h"
#include "lib_errors.h"
-#include "zebra_memory.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
#include "zebra/rib.h"
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 9e655ab26..e71e66245 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -29,7 +29,6 @@
#include "connected.h"
#include "table.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "rib.h"
#include "thread.h"
#include "privs.h"
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index adbdf54c1..03884a916 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -32,7 +32,6 @@
#include "sockunion.h"
#include "connected.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "ioctl.h"
#include "log.h"
#include "table.h"
diff --git a/zebra/main.c b/zebra/main.c
index f2fde35f0..09350f72c 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -26,7 +26,6 @@
#include "thread.h"
#include "filter.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "prefix.h"
#include "log.h"
#include "plist.h"
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index ac60d09ec..9e675011e 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -41,7 +41,6 @@
#include "zebra/debug.h"
#include "zebra/router-id.h"
#include "zebra/zapi_msg.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_errors.h"
diff --git a/zebra/rib.h b/zebra/rib.h
index 564e27497..e7676a132 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -23,6 +23,7 @@
#define _ZEBRA_RIB_H
#include "zebra.h"
+#include "memory.h"
#include "hook.h"
#include "typesafe.h"
#include "linklist.h"
@@ -41,6 +42,10 @@
extern "C" {
#endif
+DECLARE_MGROUP(ZEBRA);
+
+DECLARE_MTYPE(RE);
+
enum rnh_type { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE };
PREDECL_LIST(rnh_list);
diff --git a/zebra/router-id.c b/zebra/router-id.c
index ac21978ee..3b556c92b 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -29,7 +29,6 @@
#include "stream.h"
#include "command.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "ioctl.h"
#include "connected.h"
#include "network.h"
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index fdeef2c88..55e0775a8 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -41,7 +41,6 @@
#include "connected.h"
#include "table.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "rib.h"
#include "thread.h"
#include "privs.h"
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 8a7a15e46..8ffb3870f 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -23,7 +23,6 @@
#include <zebra.h>
#include "memory.h"
-#include "zebra_memory.h"
#include "sockopt.h"
#include "thread.h"
#include "if.h"
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index 01a97db8b..74c6825ba 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -24,7 +24,6 @@
#if !defined(GNU_LINUX)
#include "memory.h"
-#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
diff --git a/zebra/subdir.am b/zebra/subdir.am
index 47b18b2c0..b5c26d720 100644
--- a/zebra/subdir.am
+++ b/zebra/subdir.am
@@ -88,7 +88,6 @@ zebra_zebra_SOURCES = \
zebra/zebra_evpn_neigh.c \
zebra/zebra_mlag.c \
zebra/zebra_mlag_vty.c \
- zebra/zebra_memory.c \
zebra/zebra_mpls.c \
zebra/zebra_mpls_netlink.c \
zebra/zebra_mpls_openbsd.c \
@@ -158,7 +157,6 @@ noinst_HEADERS += \
zebra/zebra_evpn_vxlan.h \
zebra/zebra_fpm_private.h \
zebra/zebra_l2.h \
- zebra/zebra_memory.h \
zebra/zebra_mlag.h \
zebra/zebra_mlag_vty.h \
zebra/zebra_mpls.h \
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index 9f5adfa40..63ba6cd8d 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -38,7 +38,6 @@
#include "zebra/zebra_router.h"
#include "zebra/rib.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
#include "zebra/router-id.h"
@@ -62,6 +61,8 @@
#include "zebra/zebra_opaque.h"
#include "zebra/zebra_srte.h"
+DEFINE_MTYPE_STATIC(ZEBRA, OPAQUE, "Opaque Data");
+
static int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg);
/* Encoding helpers -------------------------------------------------------- */
@@ -2076,6 +2077,11 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
}
}
+void zapi_opaque_free(struct opaque *opaque)
+{
+ XFREE(MTYPE_OPAQUE, opaque);
+}
+
static void zread_route_del(ZAPI_HANDLER_ARGS)
{
struct stream *s;
diff --git a/zebra/zapi_msg.h b/zebra/zapi_msg.h
index 023b9f74a..ca471f8d9 100644
--- a/zebra/zapi_msg.h
+++ b/zebra/zapi_msg.h
@@ -111,6 +111,8 @@ extern int zsend_client_close_notify(struct zserv *client,
int zsend_nhg_notify(uint16_t type, uint16_t instance, uint32_t session_id,
uint32_t id, enum zapi_nhg_notify_owner note);
+extern void zapi_opaque_free(struct opaque *opaque);
+
#ifdef __cplusplus
}
#endif
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 6f3e5f042..18fe0a7e8 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -28,7 +28,6 @@
#include "lib/memory.h"
#include "lib/queue.h"
#include "lib/zebra.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_router.h"
#include "zebra/zebra_dplane.h"
#include "zebra/zebra_vxlan_private.h"
diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c
index 27a5a07e4..80e06d913 100644
--- a/zebra/zebra_evpn.c
+++ b/zebra/zebra_evpn.c
@@ -44,7 +44,6 @@
#include "zebra/rt_netlink.h"
#include "zebra/zebra_errors.h"
#include "zebra/zebra_l2.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_vxlan.h"
diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c
index b36e8034b..7bbe092d8 100644
--- a/zebra/zebra_evpn_mac.c
+++ b/zebra/zebra_evpn_mac.c
@@ -34,7 +34,6 @@
#include "zebra/zserv.h"
#include "zebra/debug.h"
#include "zebra/zebra_router.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_errors.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_evpn.h"
diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c
index 5a28ee10c..1c258a04f 100644
--- a/zebra/zebra_evpn_mh.c
+++ b/zebra/zebra_evpn_mh.c
@@ -41,7 +41,6 @@
#include "zebra/if_netlink.h"
#include "zebra/zebra_errors.h"
#include "zebra/zebra_l2.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_vxlan.h"
diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c
index 0e31617c4..d1b93dbe8 100644
--- a/zebra/zebra_evpn_neigh.c
+++ b/zebra/zebra_evpn_neigh.c
@@ -34,7 +34,6 @@
#include "zebra/debug.h"
#include "zebra/zebra_router.h"
#include "zebra/rt.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_errors.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_evpn.h"
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 4882397dd..5fe8934a8 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -37,7 +37,6 @@
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_errors.h"
-#include "zebra/zebra_memory.h"
#include "fpm/fpm.h"
#include "zebra_fpm_private.h"
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index 3583c5fbf..c3fbff272 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -38,7 +38,6 @@
#include "zebra/zserv.h"
#include "zebra/debug.h"
#include "zebra/interface.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_vrf.h"
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
diff --git a/zebra/zebra_memory.c b/zebra/zebra_memory.c
deleted file mode 100644
index 004da0129..000000000
--- a/zebra/zebra_memory.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* zebra memory type definitions
- *
- * Copyright (C) 2015 David Lamparter
- *
- * This file is part of Quagga.
- *
- * Quagga 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, or (at your option) any
- * later version.
- *
- * Quagga 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
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "zebra_memory.h"
-
-DEFINE_MGROUP(ZEBRA, "zebra");
-DEFINE_MTYPE(ZEBRA, RE, "Route Entry");
-DEFINE_MTYPE(ZEBRA, RIB_DEST, "RIB destination");
-DEFINE_MTYPE(ZEBRA, ZVLAN, "VLAN");
-DEFINE_MTYPE(ZEBRA, ZVLAN_BITMAP, "VLAN bitmap");
-DEFINE_MTYPE(ZEBRA, OPAQUE, "Opaque Data");
diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h
deleted file mode 100644
index 769a808cb..000000000
--- a/zebra/zebra_memory.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* zebra memory type declarations
- *
- * Copyright (C) 2015 David Lamparter
- *
- * This file is part of Quagga.
- *
- * Quagga 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, or (at your option) any
- * later version.
- *
- * Quagga 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 _QUAGGA_ZEBRA_MEMORY_H
-#define _QUAGGA_ZEBRA_MEMORY_H
-
-#include "memory.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-DECLARE_MGROUP(ZEBRA);
-DECLARE_MTYPE(ZEBRA_NS);
-DECLARE_MTYPE(RE);
-DECLARE_MTYPE(RIB_DEST);
-DECLARE_MTYPE(OPAQUE);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _QUAGGA_ZEBRA_MEMORY_H */
diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c
index 2e65307ea..3b0c75151 100644
--- a/zebra/zebra_mlag.c
+++ b/zebra/zebra_mlag.c
@@ -29,7 +29,6 @@
#include "zebra/zebra_mlag.h"
#include "zebra/zebra_mlag_vty.h"
#include "zebra/zebra_router.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zapi_msg.h"
#include "zebra/debug.h"
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index a87951353..c0c064cbc 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -44,7 +44,6 @@
#include "zebra/zebra_router.h"
#include "zebra/redistribute.h"
#include "zebra/debug.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_srte.h"
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index 5f11bbd60..3e89df68f 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -37,7 +37,6 @@
#include "lib_errors.h"
#include "zebra_router.h"
-#include "zebra_memory.h"
#endif /* defined(HAVE_NETLINK) */
#include "zebra_netns_notify.h"
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 9246283fd..12ed024a6 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -36,7 +36,6 @@
#include "zebra/zebra_nhg_private.h"
#include "zebra/zebra_rnh.h"
#include "zebra/zebra_routemap.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_srte.h"
#include "zebra/zserv.h"
#include "zebra/rt.h"
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index ae7727ca1..27b8a3ea4 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -28,7 +28,6 @@
#include "zebra_ns.h"
#include "zebra_vrf.h"
-#include "zebra_memory.h"
#include "rt.h"
#include "zebra_vxlan.h"
#include "debug.h"
@@ -41,7 +40,7 @@
extern struct zebra_privs_t zserv_privs;
-DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space");
+DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_NS, "Zebra Name Space");
static struct zebra_ns *dzns;
diff --git a/zebra/zebra_opaque.c b/zebra/zebra_opaque.c
index 1d59e0ab3..244f16302 100644
--- a/zebra/zebra_opaque.c
+++ b/zebra/zebra_opaque.c
@@ -24,7 +24,6 @@
#include "lib/stream.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_opaque.h"
/* Mem type */
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 4b87432ff..c4004842e 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -30,7 +30,6 @@
#include "zebra/zebra_pbr.h"
#include "zebra/rt.h"
#include "zebra/zapi_msg.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zserv.h"
#include "zebra/debug.h"
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 1e7b38086..bea855d1a 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -1167,8 +1167,6 @@ void zebra_ptm_if_write(struct vty *vty, struct zebra_if *zebra_ifp)
#else /* HAVE_BFDD */
-#include "zebra/zebra_memory.h"
-
/*
* Data structures.
*/
diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c
index eabc2e005..537d69fbc 100644
--- a/zebra/zebra_ptm_redistribute.c
+++ b/zebra/zebra_ptm_redistribute.c
@@ -26,7 +26,6 @@
#include "zebra/zapi_msg.h"
#include "zebra/zebra_ptm.h"
#include "zebra/zebra_ptm_redistribute.h"
-#include "zebra/zebra_memory.h"
static int zsend_interface_bfd_update(int cmd, struct zserv *client,
struct interface *ifp, struct prefix *dp,
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 6b2619271..ffe4be855 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -49,7 +49,6 @@
#include "zebra/rt.h"
#include "zebra/zapi_msg.h"
#include "zebra/zebra_errors.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_rnh.h"
#include "zebra/zebra_routemap.h"
@@ -58,6 +57,10 @@
#include "zebra/zapi_msg.h"
#include "zebra/zebra_dplane.h"
+DEFINE_MGROUP(ZEBRA, "zebra");
+
+DEFINE_MTYPE(ZEBRA, RE, "Route Entry");
+DEFINE_MTYPE_STATIC(ZEBRA, RIB_DEST, "RIB destination");
DEFINE_MTYPE_STATIC(ZEBRA, RIB_UPDATE_CTX, "Rib update context object");
/*
@@ -800,6 +803,23 @@ int rib_gc_dest(struct route_node *rn)
return 1;
}
+void zebra_rtable_node_cleanup(struct route_table *table,
+ struct route_node *node)
+{
+ struct route_entry *re, *next;
+
+ RNODE_FOREACH_RE_SAFE (node, re, next) {
+ rib_unlink(node, re);
+ }
+
+ if (node->info) {
+ rib_dest_t *dest = node->info;
+
+ rnh_list_fini(&dest->nht);
+ XFREE(MTYPE_RIB_DEST, node->info);
+ }
+}
+
static void rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,
struct route_entry *new)
{
@@ -2698,7 +2718,7 @@ void rib_unlink(struct route_node *rn, struct route_entry *re)
nexthops_free(re->fib_ng.nexthop);
- XFREE(MTYPE_OPAQUE, re->opaque);
+ zapi_opaque_free(re->opaque);
XFREE(MTYPE_RE, re);
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index a6e3f8473..3b0ef7198 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -48,7 +48,6 @@
#include "zebra/zebra_routemap.h"
#include "zebra/zebra_srte.h"
#include "zebra/interface.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_errors.h"
DEFINE_MTYPE_STATIC(ZEBRA, RNH, "Nexthop tracking object");
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 17a9bf97f..c9660c730 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -21,7 +21,6 @@
#include <zebra.h>
#include "memory.h"
-#include "zebra_memory.h"
#include "prefix.h"
#include "rib.h"
#include "vty.h"
diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c
index 11c1130c4..5a00f3155 100644
--- a/zebra/zebra_router.c
+++ b/zebra/zebra_router.c
@@ -25,7 +25,6 @@
#include "lib/frratomic.h"
#include "zebra_router.h"
-#include "zebra_memory.h"
#include "zebra_pbr.h"
#include "zebra_vxlan.h"
#include "zebra_mlag.h"
@@ -33,6 +32,7 @@
#include "debug.h"
DEFINE_MTYPE_STATIC(ZEBRA, RIB_TABLE_INFO, "RIB table info");
+DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_RT_TABLE, "Zebra VRF table");
struct zebra_router zrouter = {
.multipath_num = MULTIPATH_NUM,
@@ -121,7 +121,7 @@ struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
if (zrt)
return zrt->table;
- zrt = XCALLOC(MTYPE_ZEBRA_NS, sizeof(*zrt));
+ zrt = XCALLOC(MTYPE_ZEBRA_RT_TABLE, sizeof(*zrt));
zrt->tableid = tableid;
zrt->afi = afi;
zrt->safi = safi;
@@ -185,7 +185,7 @@ static void zebra_router_free_table(struct zebra_router_table *zrt)
RB_REMOVE(zebra_router_table_head, &zrouter.tables, zrt);
XFREE(MTYPE_RIB_TABLE_INFO, table_info);
- XFREE(MTYPE_ZEBRA_NS, zrt);
+ XFREE(MTYPE_ZEBRA_RT_TABLE, zrt);
}
void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid,
diff --git a/zebra/zebra_srte.c b/zebra/zebra_srte.c
index e761cd7d0..98158ecc1 100644
--- a/zebra/zebra_srte.c
+++ b/zebra/zebra_srte.c
@@ -24,7 +24,6 @@
#include "lib/lib_errors.h"
#include "zebra/zebra_srte.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_rnh.h"
#include "zebra/zapi_msg.h"
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 46398f3fb..b42923640 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -36,7 +36,6 @@
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_rnh.h"
#include "zebra/router-id.h"
-#include "zebra/zebra_memory.h"
#include "zebra/interface.h"
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_vxlan.h"
@@ -413,23 +412,6 @@ done:
return table;
}
-void zebra_rtable_node_cleanup(struct route_table *table,
- struct route_node *node)
-{
- struct route_entry *re, *next;
-
- RNODE_FOREACH_RE_SAFE (node, re, next) {
- rib_unlink(node, re);
- }
-
- if (node->info) {
- rib_dest_t *dest = node->info;
-
- rnh_list_fini(&dest->nht);
- XFREE(MTYPE_RIB_DEST, node->info);
- }
-}
-
static void zebra_rnhtable_node_cleanup(struct route_table *table,
struct route_node *node)
{
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 3349c1820..d5c9f7183 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -21,7 +21,6 @@
#include <zebra.h>
#include "memory.h"
-#include "zebra_memory.h"
#include "if.h"
#include "prefix.h"
#include "command.h"
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index d95967c55..bc2eac7a0 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -46,7 +46,6 @@
#include "zebra/rt_netlink.h"
#include "zebra/zebra_errors.h"
#include "zebra/zebra_l2.h"
-#include "zebra/zebra_memory.h"
#include "zebra/zebra_ns.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_vxlan.h"