summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2021-03-23 10:07:28 -0400
committerGitHub <noreply@github.com>2021-03-23 10:07:28 -0400
commit63d4a9708cad8dadd9ba0f1b104072862fc41c98 (patch)
treeec77133952bdb98e76fc15249dd2ca3eb63b848e
parent38981e4bbae90aa854b3c7487075e4a69c55ddc5 (diff)
parent224ccf29d9e9d08a6a177d8c994ab5a743b276cf (diff)
Merge pull request #8307 from opensourcerouting/mtypes-cleanup-20210322
isisd, eigrpd, pathd: clean up & drop *_memory.[ch] files, make a whole bunch static
-rw-r--r--eigrpd/eigrp_filter.c1
-rw-r--r--eigrpd/eigrp_interface.c4
-rw-r--r--eigrpd/eigrp_memory.c42
-rw-r--r--eigrpd/eigrp_memory.h43
-rw-r--r--eigrpd/eigrp_neighbor.c3
-rw-r--r--eigrpd/eigrp_packet.c8
-rw-r--r--eigrpd/eigrp_query.c1
-rw-r--r--eigrpd/eigrp_reply.c1
-rw-r--r--eigrpd/eigrp_siaquery.c1
-rw-r--r--eigrpd/eigrp_siareply.c1
-rw-r--r--eigrpd/eigrp_topology.c4
-rw-r--r--eigrpd/eigrp_topology.h4
-rw-r--r--eigrpd/eigrp_update.c1
-rw-r--r--eigrpd/eigrpd.c5
-rw-r--r--eigrpd/eigrpd.h3
-rw-r--r--eigrpd/subdir.am2
-rw-r--r--isisd/fabricd.c1
-rw-r--r--isisd/isis_adjacency.c3
-rw-r--r--isisd/isis_adjacency.h2
-rw-r--r--isisd/isis_circuit.c2
-rw-r--r--isisd/isis_dynhn.c2
-rw-r--r--isisd/isis_lfa.c1
-rw-r--r--isisd/isis_lfa.h3
-rw-r--r--isisd/isis_lsp.c2
-rw-r--r--isisd/isis_memory.c49
-rw-r--r--isisd/isis_memory.h50
-rw-r--r--isisd/isis_mt.c1
-rw-r--r--isisd/isis_nb_config.c4
-rw-r--r--isisd/isis_redist.c11
-rw-r--r--isisd/isis_route.c3
-rw-r--r--isisd/isis_spf.c20
-rw-r--r--isisd/isis_spf_private.h15
-rw-r--r--isisd/isis_tlvs.c1
-rw-r--r--isisd/isis_tx_queue.c1
-rw-r--r--isisd/isisd.c16
-rw-r--r--isisd/isisd.h7
-rw-r--r--isisd/subdir.am2
-rw-r--r--ospf6d/ospf6_area.c1
-rw-r--r--ospf6d/ospf6_asbr.c4
-rw-r--r--ospf6d/ospf6_interface.c1
-rw-r--r--ospf6d/ospf6_lsa.c39
-rw-r--r--ospf6d/ospf6_lsa.h1
-rw-r--r--ospf6d/ospf6_lsdb.c2
-rw-r--r--ospf6d/ospf6_memory.c47
-rw-r--r--ospf6d/ospf6_memory.h48
-rw-r--r--ospf6d/ospf6_message.c2
-rw-r--r--ospf6d/ospf6_neighbor.c2
-rw-r--r--ospf6d/ospf6_route.c4
-rw-r--r--ospf6d/ospf6_spf.c11
-rw-r--r--ospf6d/ospf6_top.c2
-rw-r--r--ospf6d/ospf6d.c2
-rw-r--r--ospf6d/ospf6d.h3
-rw-r--r--ospf6d/subdir.am2
-rw-r--r--pathd/path_cli.c2
-rw-r--r--pathd/path_memory.c25
-rw-r--r--pathd/path_memory.h26
-rw-r--r--pathd/path_pcep.c3
-rw-r--r--pathd/path_pcep.h4
-rw-r--r--pathd/path_pcep_cli.c1
-rw-r--r--pathd/path_pcep_lib.c7
-rw-r--r--pathd/path_pcep_memory.c27
-rw-r--r--pathd/path_pcep_memory.h28
-rw-r--r--pathd/path_pcep_pcc.c1
-rw-r--r--pathd/pathd.c3
-rw-r--r--pathd/pathd.h3
-rw-r--r--pathd/subdir.am4
-rw-r--r--staticd/static_memory.c28
-rw-r--r--staticd/static_memory.h30
-rw-r--r--staticd/static_routes.c65
-rw-r--r--staticd/static_routes.h6
-rw-r--r--staticd/static_vrf.c58
-rw-r--r--staticd/static_vty.c1
-rw-r--r--staticd/subdir.am2
-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
119 files changed, 260 insertions, 734 deletions
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c
index c77a6fc1b1..8f80b78d20 100644
--- a/eigrpd/eigrp_filter.c
+++ b/eigrpd/eigrp_filter.c
@@ -57,7 +57,6 @@
#include "eigrpd/eigrp_const.h"
#include "eigrpd/eigrp_filter.h"
#include "eigrpd/eigrp_packet.h"
-#include "eigrpd/eigrp_memory.h"
/*
* Distribute-list update functions.
diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c
index bb7a930e6d..02e943043f 100644
--- a/eigrpd/eigrp_interface.c
+++ b/eigrpd/eigrp_interface.c
@@ -52,12 +52,14 @@
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_types.h"
#include "eigrpd/eigrp_metric.h"
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_IF, "EIGRP interface");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_IF_INFO, "EIGRP Interface Information");
+
struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
struct prefix *p)
{
diff --git a/eigrpd/eigrp_memory.c b/eigrpd/eigrp_memory.c
deleted file mode 100644
index f2cb9a5c98..0000000000
--- a/eigrpd/eigrp_memory.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* eigrpd memory type definitions
- *
- * Copyright (C) 2017 Donald Sharp
- *
- * This file is part of FRR
- *
- * FRR 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.
- *
- * FRR 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 "eigrp_memory.h"
-
-DEFINE_MGROUP(EIGRPD, "eigrpd");
-DEFINE_MTYPE(EIGRPD, EIGRP_TOP, "EIGRP structure");
-DEFINE_MTYPE(EIGRPD, EIGRP_IF, "EIGRP interface");
-DEFINE_MTYPE(EIGRPD, EIGRP_NEIGHBOR, "EIGRP neighbor");
-DEFINE_MTYPE(EIGRPD, EIGRP_IF_PARAMS, "EIGRP Interface Parameters");
-DEFINE_MTYPE(EIGRPD, EIGRP_IF_INFO, "EIGRP Interface Information");
-DEFINE_MTYPE(EIGRPD, EIGRP_FIFO, "EIGRP FIFO");
-DEFINE_MTYPE(EIGRPD, EIGRP_PACKET, "EIGRP Packet");
-DEFINE_MTYPE(EIGRPD, EIGRP_IPV4_INT_TLV, "EIGRP IPv4 TLV");
-DEFINE_MTYPE(EIGRPD, EIGRP_SEQ_TLV, "EIGRP SEQ TLV");
-DEFINE_MTYPE(EIGRPD, EIGRP_AUTH_TLV, "EIGRP AUTH TLV");
-DEFINE_MTYPE(EIGRPD, EIGRP_AUTH_SHA256_TLV, "EIGRP SHA TLV");
-DEFINE_MTYPE(EIGRPD, EIGRP_PREFIX_DESCRIPTOR, "EIGRP Prefix");
-DEFINE_MTYPE(EIGRPD, EIGRP_ROUTE_DESCRIPTOR, "EIGRP Nexthop Entry");
-DEFINE_MTYPE(EIGRPD, EIGRP_FSM_MSG, "EIGRP FSM Message");
diff --git a/eigrpd/eigrp_memory.h b/eigrpd/eigrp_memory.h
deleted file mode 100644
index bf1eff8751..0000000000
--- a/eigrpd/eigrp_memory.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* eigrpd memory type declarations
- *
- * Copyright (C) 2017 Donald Sharp
- *
- * This file is part of FRR.
- *
- * FRR 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.
- *
- * FRR 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 _FRR_EIGRP_MEMORY_H
-#define _FRR_EIGRP_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(EIGRPD);
-DECLARE_MTYPE(EIGRP_TOP);
-DECLARE_MTYPE(EIGRP_IF);
-DECLARE_MTYPE(EIGRP_NEIGHBOR);
-DECLARE_MTYPE(EIGRP_IF_PARAMS);
-DECLARE_MTYPE(EIGRP_IF_INFO);
-DECLARE_MTYPE(EIGRP_FIFO);
-DECLARE_MTYPE(EIGRP_PACKET);
-DECLARE_MTYPE(EIGRP_IPV4_INT_TLV);
-DECLARE_MTYPE(EIGRP_SEQ_TLV);
-DECLARE_MTYPE(EIGRP_AUTH_TLV);
-DECLARE_MTYPE(EIGRP_AUTH_SHA256_TLV);
-DECLARE_MTYPE(EIGRP_PREFIX_DESCRIPTOR);
-DECLARE_MTYPE(EIGRP_ROUTE_DESCRIPTOR);
-DECLARE_MTYPE(EIGRP_FSM_MSG);
-
-#endif /* _FRR_EIGRP_MEMORY_H */
diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c
index 1da2f7a108..f2d5217eb0 100644
--- a/eigrpd/eigrp_neighbor.c
+++ b/eigrpd/eigrp_neighbor.c
@@ -52,9 +52,10 @@
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_errors.h"
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_NEIGHBOR, "EIGRP neighbor");
+
struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *ei)
{
struct eigrp_neighbor *nbr;
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 7eee254627..0b37733990 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -56,9 +56,15 @@
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_errors.h"
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_FIFO, "EIGRP FIFO");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_PACKET, "EIGRP Packet");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_IPV4_INT_TLV, "EIGRP IPv4 TLV");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_SEQ_TLV, "EIGRP SEQ TLV");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_AUTH_TLV, "EIGRP AUTH TLV");
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_AUTH_SHA256_TLV, "EIGRP SHA TLV");
+
/* Packet Type String. */
const struct message eigrp_packet_type_str[] = {
{EIGRP_OPC_UPDATE, "Update"},
diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c
index 0ab7b59dbb..c8769fb11f 100644
--- a/eigrpd/eigrp_query.c
+++ b/eigrpd/eigrp_query.c
@@ -52,7 +52,6 @@
#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
uint32_t eigrp_query_send_all(struct eigrp *eigrp)
{
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index d16482173c..015daa768f 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -58,7 +58,6 @@
#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_errors.h"
void eigrp_send_reply(struct eigrp_neighbor *nbr,
diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c
index 027700fe11..9c2a8c9d84 100644
--- a/eigrpd/eigrp_siaquery.c
+++ b/eigrpd/eigrp_siaquery.c
@@ -52,7 +52,6 @@
#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
/*EIGRP SIA-QUERY read function*/
void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph,
diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c
index 590b224d68..2d298c20bf 100644
--- a/eigrpd/eigrp_siareply.c
+++ b/eigrpd/eigrp_siareply.c
@@ -51,7 +51,6 @@
#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
/*EIGRP SIA-REPLY read function*/
void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 6da7756f84..846e211622 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -51,9 +51,11 @@
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_metric.h"
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_ROUTE_DESCRIPTOR, "EIGRP Nexthop Entry");
+DEFINE_MTYPE(EIGRPD, EIGRP_PREFIX_DESCRIPTOR, "EIGRP Prefix");
+
static int eigrp_route_descriptor_cmp(struct eigrp_route_descriptor *rd1,
struct eigrp_route_descriptor *rd2);
diff --git a/eigrpd/eigrp_topology.h b/eigrpd/eigrp_topology.h
index 26fa1a11b0..d7f79057ab 100644
--- a/eigrpd/eigrp_topology.h
+++ b/eigrpd/eigrp_topology.h
@@ -32,6 +32,10 @@
#ifndef _ZEBRA_EIGRP_TOPOLOGY_H
#define _ZEBRA_EIGRP_TOPOLOGY_H
+#include "memory.h"
+
+DECLARE_MTYPE(EIGRP_PREFIX_DESCRIPTOR);
+
/* EIGRP Topology table related functions. */
extern struct route_table *eigrp_topology_new(void);
extern void eigrp_topology_init(struct route_table *table);
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index 91f3b3218b..0dc509706c 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -62,7 +62,6 @@
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_network.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_metric.h"
bool eigrp_update_prefix_apply(struct eigrp *eigrp, struct eigrp_interface *ei,
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index 8c16cf3d58..1030154907 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -55,9 +55,12 @@
#include "eigrpd/eigrp_packet.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
-#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_filter.h"
+DEFINE_MGROUP(EIGRPD, "eigrpd");
+
+DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_TOP, "EIGRP structure");
+
DEFINE_QOBJ_TYPE(eigrp);
static struct eigrp_master eigrp_master;
diff --git a/eigrpd/eigrpd.h b/eigrpd/eigrpd.h
index 01173768ba..949fe682c7 100644
--- a/eigrpd/eigrpd.h
+++ b/eigrpd/eigrpd.h
@@ -32,6 +32,9 @@
#include "filter.h"
#include "log.h"
+#include "memory.h"
+
+DECLARE_MGROUP(EIGRPD);
/* Set EIGRP version is "classic" - wide metrics comes next */
#define EIGRP_MAJOR_VERSION 1
diff --git a/eigrpd/subdir.am b/eigrpd/subdir.am
index 13c9f7f8ae..ba9445acb9 100644
--- a/eigrpd/subdir.am
+++ b/eigrpd/subdir.am
@@ -24,7 +24,6 @@ eigrpd_libeigrp_a_SOURCES = \
eigrpd/eigrp_fsm.c \
eigrpd/eigrp_hello.c \
eigrpd/eigrp_interface.c \
- eigrpd/eigrp_memory.c \
eigrpd/eigrp_metric.c \
eigrpd/eigrp_neighbor.c \
eigrpd/eigrp_network.c \
@@ -63,7 +62,6 @@ noinst_HEADERS += \
eigrpd/eigrp_fsm.h \
eigrpd/eigrp_interface.h \
eigrpd/eigrp_macros.h \
- eigrpd/eigrp_memory.h \
eigrpd/eigrp_metric.h \
eigrpd/eigrp_neighbor.h \
eigrpd/eigrp_network.h \
diff --git a/isisd/fabricd.c b/isisd/fabricd.c
index 426b96e90c..20651706d3 100644
--- a/isisd/fabricd.c
+++ b/isisd/fabricd.c
@@ -22,7 +22,6 @@
#include <zebra.h>
#include "isisd/fabricd.h"
#include "isisd/isisd.h"
-#include "isisd/isis_memory.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_misc.h"
#include "isisd/isis_adjacency.h"
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index a5482635eb..c1f5e49eca 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -49,6 +49,9 @@
#include "isisd/fabricd.h"
#include "isisd/isis_nb.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_ADJACENCY, "ISIS adjacency");
+DEFINE_MTYPE(ISISD, ISIS_ADJACENCY_INFO, "ISIS adjacency info");
+
static struct isis_adjacency *adj_alloc(struct isis_circuit *circuit,
const uint8_t *id)
{
diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h
index 4daf7b5db2..754345c008 100644
--- a/isisd/isis_adjacency.h
+++ b/isisd/isis_adjacency.h
@@ -27,6 +27,8 @@
#include "isisd/isis_tlvs.h"
+DECLARE_MTYPE(ISIS_ADJACENCY_INFO);
+
enum isis_adj_usage {
ISIS_ADJ_NONE,
ISIS_ADJ_LEVEL1,
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 6fc76fce43..a637429e84 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -61,6 +61,8 @@
#include "isisd/isis_nb.h"
#include "isisd/isis_ldp_sync.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_CIRCUIT, "ISIS circuit");
+
DEFINE_QOBJ_TYPE(isis_circuit);
DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c
index d2c5d93e25..decd3e8922 100644
--- a/isisd/isis_dynhn.c
+++ b/isisd/isis_dynhn.c
@@ -40,6 +40,8 @@
#include "isisd/isis_misc.h"
#include "isisd/isis_constants.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_DYNHN, "ISIS dyn hostname");
+
extern struct host host;
struct list *dyn_cache = NULL;
diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c
index 3ebac8aaa9..085177b943 100644
--- a/isisd/isis_lfa.c
+++ b/isisd/isis_lfa.c
@@ -46,6 +46,7 @@ DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_NODE, "ISIS SPF Node");
DEFINE_MTYPE_STATIC(ISISD, ISIS_LFA_TIEBREAKER, "ISIS LFA Tiebreaker");
DEFINE_MTYPE_STATIC(ISISD, ISIS_LFA_EXCL_IFACE, "ISIS LFA Excluded Interface");
DEFINE_MTYPE_STATIC(ISISD, ISIS_RLFA, "ISIS Remote LFA");
+DEFINE_MTYPE(ISISD, ISIS_NEXTHOP_LABELS, "ISIS nexthop MPLS labels");
static inline int isis_spf_node_compare(const struct isis_spf_node *a,
const struct isis_spf_node *b)
diff --git a/isisd/isis_lfa.h b/isisd/isis_lfa.h
index d75632e2cd..9db03a3a19 100644
--- a/isisd/isis_lfa.h
+++ b/isisd/isis_lfa.h
@@ -22,6 +22,9 @@
#include "lib/typesafe.h"
#include "lib/zclient.h"
+#include "lib/memory.h"
+
+DECLARE_MTYPE(ISIS_NEXTHOP_LABELS);
PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree);
PREDECL_RBTREE_UNIQ(rlfa_tree);
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index faf16aa174..056e29e8de 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -60,6 +60,8 @@
#include "isisd/isis_tx_queue.h"
#include "isisd/isis_nb.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP");
+
static int lsp_refresh(struct thread *thread);
static int lsp_l1_refresh_pseudo(struct thread *thread);
static int lsp_l2_refresh_pseudo(struct thread *thread);
diff --git a/isisd/isis_memory.c b/isisd/isis_memory.c
deleted file mode 100644
index 34f6b6089a..0000000000
--- a/isisd/isis_memory.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* isisd 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 "isis_memory.h"
-
-DEFINE_MGROUP(ISISD, "isisd");
-DEFINE_MTYPE(ISISD, ISIS, "ISIS");
-DEFINE_MTYPE(ISISD, ISIS_TMP, "ISIS TMP");
-DEFINE_MTYPE(ISISD, ISIS_CIRCUIT, "ISIS circuit");
-DEFINE_MTYPE(ISISD, ISIS_LSP, "ISIS LSP");
-DEFINE_MTYPE(ISISD, ISIS_ADJACENCY, "ISIS adjacency");
-DEFINE_MTYPE(ISISD, ISIS_ADJACENCY_INFO, "ISIS adjacency info");
-DEFINE_MTYPE(ISISD, ISIS_AREA, "ISIS area");
-DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address");
-DEFINE_MTYPE(ISISD, ISIS_DYNHN, "ISIS dyn hostname");
-DEFINE_MTYPE(ISISD, ISIS_SPFTREE, "ISIS SPFtree");
-DEFINE_MTYPE(ISISD, ISIS_VERTEX, "ISIS vertex");
-DEFINE_MTYPE(ISISD, ISIS_ROUTE_INFO, "ISIS route info");
-DEFINE_MTYPE(ISISD, ISIS_NEXTHOP, "ISIS nexthop");
-DEFINE_MTYPE(ISISD, ISIS_NEXTHOP_LABELS, "ISIS nexthop MPLS labels");
-DEFINE_MTYPE(ISISD, ISIS_DICT, "ISIS dictionary");
-DEFINE_MTYPE(ISISD, ISIS_DICT_NODE, "ISIS dictionary node");
-DEFINE_MTYPE(ISISD, ISIS_EXT_ROUTE, "ISIS redistributed route");
-DEFINE_MTYPE(ISISD, ISIS_EXT_INFO, "ISIS redistributed route info");
-DEFINE_MTYPE(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters");
-DEFINE_MTYPE(ISISD, ISIS_ACL_NAME, "ISIS access-list name");
-DEFINE_MTYPE(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
diff --git a/isisd/isis_memory.h b/isisd/isis_memory.h
deleted file mode 100644
index 5fd881e42d..0000000000
--- a/isisd/isis_memory.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* isisd 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_ISIS_MEMORY_H
-#define _QUAGGA_ISIS_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(ISISD);
-DECLARE_MTYPE(ISIS);
-DECLARE_MTYPE(ISIS_TMP);
-DECLARE_MTYPE(ISIS_CIRCUIT);
-DECLARE_MTYPE(ISIS_LSP);
-DECLARE_MTYPE(ISIS_ADJACENCY);
-DECLARE_MTYPE(ISIS_ADJACENCY_INFO);
-DECLARE_MTYPE(ISIS_AREA);
-DECLARE_MTYPE(ISIS_AREA_ADDR);
-DECLARE_MTYPE(ISIS_DYNHN);
-DECLARE_MTYPE(ISIS_SPFTREE);
-DECLARE_MTYPE(ISIS_VERTEX);
-DECLARE_MTYPE(ISIS_ROUTE_INFO);
-DECLARE_MTYPE(ISIS_NEXTHOP);
-DECLARE_MTYPE(ISIS_NEXTHOP_LABELS);
-DECLARE_MTYPE(ISIS_DICT);
-DECLARE_MTYPE(ISIS_DICT_NODE);
-DECLARE_MTYPE(ISIS_EXT_ROUTE);
-DECLARE_MTYPE(ISIS_EXT_INFO);
-DECLARE_MTYPE(ISIS_MPLS_TE);
-DECLARE_MTYPE(ISIS_ACL_NAME);
-DECLARE_MTYPE(ISIS_PLIST_NAME);
-
-#endif /* _QUAGGA_ISIS_MEMORY_H */
diff --git a/isisd/isis_mt.c b/isisd/isis_mt.c
index a6e236c796..c024549fcc 100644
--- a/isisd/isis_mt.c
+++ b/isisd/isis_mt.c
@@ -21,7 +21,6 @@
*/
#include <zebra.h>
#include "isisd/isisd.h"
-#include "isisd/isis_memory.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_adjacency.h"
#include "isisd/isis_misc.h"
diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c
index f0663c691c..d47d966f71 100644
--- a/isisd/isis_nb_config.c
+++ b/isisd/isis_nb_config.c
@@ -48,12 +48,14 @@
#include "isisd/isis_spf.h"
#include "isisd/isis_spf_private.h"
#include "isisd/isis_te.h"
-#include "isisd/isis_memory.h"
#include "isisd/isis_mt.h"
#include "isisd/isis_redist.h"
#include "isisd/isis_ldp_sync.h"
#include "isisd/isis_dr.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
+
extern struct zclient *zclient;
/*
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index 856c47b9b7..c33d56e625 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -24,7 +24,6 @@
#include "if.h"
#include "linklist.h"
#include "memory.h"
-#include "isis_memory.h"
#include "prefix.h"
#include "routemap.h"
#include "stream.h"
@@ -42,6 +41,10 @@
#include "isisd/isis_route.h"
#include "isisd/isis_zebra.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_EXT_ROUTE, "ISIS redistributed route");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_EXT_INFO, "ISIS redistributed route info");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_RMAP_NAME, "ISIS redistribute route-map name");
+
static int redist_protocol(int family)
{
if (family == AF_INET)
@@ -327,13 +330,13 @@ static void isis_redist_routemap_set(struct isis_redist *redist,
const char *routemap)
{
if (redist->map_name) {
- XFREE(MTYPE_ISIS, redist->map_name);
+ XFREE(MTYPE_ISIS_RMAP_NAME, redist->map_name);
route_map_counter_decrement(redist->map);
redist->map = NULL;
}
if (routemap && strlen(routemap)) {
- redist->map_name = XSTRDUP(MTYPE_ISIS, routemap);
+ redist->map_name = XSTRDUP(MTYPE_ISIS_RMAP_NAME, routemap);
redist->map = route_map_lookup_by_name(routemap);
route_map_counter_increment(redist->map);
}
@@ -507,7 +510,7 @@ void isis_redist_area_finish(struct isis_area *area)
redist = &area->redist_settings[protocol][type]
[level];
redist->redist = 0;
- XFREE(MTYPE_ISIS, redist->map_name);
+ XFREE(MTYPE_ISIS_RMAP_NAME, redist->map_name);
}
route_table_finish(area->ext_reach[protocol][level]);
}
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index ed5fadde10..eb534a543a 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -50,6 +50,9 @@
#include "isis_route.h"
#include "isis_zebra.h"
+DEFINE_MTYPE_STATIC(ISISD, ISIS_NEXTHOP, "ISIS nexthop");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_ROUTE_INFO, "ISIS route info");
+
DEFINE_HOOK(isis_route_update_hook,
(struct isis_area * area, struct prefix *prefix,
struct isis_route_info *route_info),
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 7bcc6fea90..3e8ec8817e 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -60,8 +60,10 @@
#include "fabricd.h"
#include "isis_spf_private.h"
-DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_RUN, "ISIS SPF Run Info");
-DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_ADJ, "ISIS SPF Adjacency");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_SPFTREE, "ISIS SPFtree");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_RUN, "ISIS SPF Run Info");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_ADJ, "ISIS SPF Adjacency");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_VERTEX, "ISIS vertex");
DEFINE_MTYPE_STATIC(ISISD, ISIS_VERTEX_ADJ, "ISIS SPF Vertex Adjacency");
static void spf_adj_list_parse_lsp(struct isis_spftree *spftree,
@@ -248,6 +250,20 @@ static struct isis_vertex *isis_vertex_new(struct isis_spftree *spftree,
return vertex;
}
+void isis_vertex_del(struct isis_vertex *vertex)
+{
+ list_delete(&vertex->Adj_N);
+ list_delete(&vertex->parents);
+ if (vertex->firsthops) {
+ hash_clean(vertex->firsthops, NULL);
+ hash_free(vertex->firsthops);
+ vertex->firsthops = NULL;
+ }
+
+ memset(vertex, 0, sizeof(struct isis_vertex));
+ XFREE(MTYPE_ISIS_VERTEX, vertex);
+}
+
struct isis_vertex_adj *
isis_vertex_adj_add(struct isis_spftree *spftree, struct isis_vertex *vertex,
struct list *vadj_list, struct isis_spf_adj *sadj,
diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h
index 79dfa3e164..07d4ff5a0e 100644
--- a/isisd/isis_spf_private.h
+++ b/isisd/isis_spf_private.h
@@ -179,20 +179,7 @@ static void isis_vertex_queue_init(struct isis_vertex_queue *queue,
isis_vertex_queue_hash_cmp, name);
}
-__attribute__((__unused__))
-static void isis_vertex_del(struct isis_vertex *vertex)
-{
- list_delete(&vertex->Adj_N);
- list_delete(&vertex->parents);
- if (vertex->firsthops) {
- hash_clean(vertex->firsthops, NULL);
- hash_free(vertex->firsthops);
- vertex->firsthops = NULL;
- }
-
- memset(vertex, 0, sizeof(struct isis_vertex));
- XFREE(MTYPE_ISIS_VERTEX, vertex);
-}
+void isis_vertex_del(struct isis_vertex *vertex);
bool isis_vertex_adj_exists(const struct isis_spftree *spftree,
const struct isis_vertex *vertex,
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 6af9290467..47fd684eb3 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -33,7 +33,6 @@
#include "network.h"
#include "isisd/isisd.h"
-#include "isisd/isis_memory.h"
#include "isisd/isis_tlvs.h"
#include "isisd/isis_common.h"
#include "isisd/isis_mt.h"
diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c
index 7db76db0df..c7266152b7 100644
--- a/isisd/isis_tx_queue.c
+++ b/isisd/isis_tx_queue.c
@@ -25,7 +25,6 @@
#include "jhash.h"
#include "isisd/isisd.h"
-#include "isisd/isis_memory.h"
#include "isisd/isis_flags.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_lsp.h"
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 039a8db27e..714961c177 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -81,6 +81,14 @@ unsigned long debug_sr;
unsigned long debug_ldp_sync;
unsigned long debug_lfa;
+DEFINE_MGROUP(ISISD, "isisd");
+
+DEFINE_MTYPE_STATIC(ISISD, ISIS, "ISIS process");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_NAME, "ISIS process name");
+DEFINE_MTYPE_STATIC(ISISD, ISIS_AREA, "ISIS area");
+DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address");
+DEFINE_MTYPE(ISISD, ISIS_ACL_NAME, "ISIS access-list name");
+
DEFINE_QOBJ_TYPE(isis_area);
/* ISIS process wide configuration. */
@@ -198,10 +206,10 @@ struct isis *isis_new(const char *vrf_name)
if (vrf) {
isis->vrf_id = vrf->vrf_id;
isis_vrf_link(isis, vrf);
- isis->name = XSTRDUP(MTYPE_ISIS, vrf->name);
+ isis->name = XSTRDUP(MTYPE_ISIS_NAME, vrf->name);
} else {
isis->vrf_id = VRF_UNKNOWN;
- isis->name = XSTRDUP(MTYPE_ISIS, vrf_name);
+ isis->name = XSTRDUP(MTYPE_ISIS_NAME, vrf_name);
}
if (IS_DEBUG_EVENTS)
@@ -565,7 +573,7 @@ static int isis_vrf_enable(struct vrf *vrf)
isis = isis_lookup_by_vrfname(vrf->name);
if (isis) {
if (isis->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
- XFREE(MTYPE_ISIS, isis->name);
+ XFREE(MTYPE_ISIS_NAME, isis->name);
isis->name = NULL;
}
old_vrf_id = isis->vrf_id;
@@ -631,7 +639,7 @@ void isis_finish(struct isis *isis)
vrf = vrf_lookup_by_name(isis->name);
if (vrf)
isis_vrf_unlink(isis, vrf);
- XFREE(MTYPE_ISIS, isis->name);
+ XFREE(MTYPE_ISIS_NAME, isis->name);
} else {
vrf = vrf_lookup_by_id(VRF_DEFAULT);
if (vrf)
diff --git a/isisd/isisd.h b/isisd/isisd.h
index ea716f998e..a2e821ad2f 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -24,6 +24,7 @@
#define ISISD_H
#include "vty.h"
+#include "memory.h"
#include "isisd/isis_constants.h"
#include "isisd/isis_common.h"
@@ -34,10 +35,11 @@
#include "isis_flags.h"
#include "isis_lsp.h"
#include "isis_lfa.h"
-#include "isis_memory.h"
#include "qobj.h"
#include "ldp_sync.h"
+DECLARE_MGROUP(ISISD);
+
#ifdef FABRICD
static const bool fabricd = true;
#define PROTO_TYPE ZEBRA_ROUTE_OPENFABRIC
@@ -240,6 +242,9 @@ struct isis_area {
};
DECLARE_QOBJ_TYPE(isis_area);
+DECLARE_MTYPE(ISIS_ACL_NAME); /* isis_area->spf_prefix_prioritites */
+DECLARE_MTYPE(ISIS_AREA_ADDR); /* isis_area->area_addrs */
+
DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area));
void isis_terminate(void);
diff --git a/isisd/subdir.am b/isisd/subdir.am
index 61dc39bdae..4cefe6e10b 100644
--- a/isisd/subdir.am
+++ b/isisd/subdir.am
@@ -57,7 +57,6 @@ noinst_HEADERS += \
isisd/isis_ldp_sync.h \
isisd/isis_lfa.h \
isisd/isis_lsp.h \
- isisd/isis_memory.h \
isisd/isis_misc.h \
isisd/isis_mt.h \
isisd/isis_nb.h \
@@ -92,7 +91,6 @@ LIBISIS_SOURCES = \
isisd/isis_ldp_sync.c \
isisd/isis_lfa.c \
isisd/isis_lsp.c \
- isisd/isis_memory.c \
isisd/isis_misc.c \
isisd/isis_mt.c \
isisd/isis_pdu.c \
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 9223083aef..6bf61b4804 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -46,6 +46,7 @@
#include "ospf6d.h"
#include "lib/json.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_AREA, "OSPF6 area");
DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_PLISTNAME, "Prefix list name");
int ospf6_area_cmp(void *va, void *vb)
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 977d810be5..3497b26656 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -49,6 +49,10 @@
#include "ospf6d.h"
#include "lib/json.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_EXTERNAL_INFO, "OSPF6 ext. info");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DIST_ARGS, "OSPF6 Distribute arguments");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_REDISTRIBUTE, "OSPF6 Redistribute arguments");
+
static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id);
static void ospf6_asbr_redistribute_unset(struct ospf6 *ospf6,
struct ospf6_redist *red, int type);
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 6f6bbc2b67..158b8dc483 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -45,6 +45,7 @@
#include "ospf6_zebra.h"
#include "lib/json.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_IF, "OSPF6 interface");
DEFINE_MTYPE_STATIC(OSPF6D, CFG_PLIST_NAME, "configured prefix list names");
DEFINE_QOBJ_TYPE(ospf6_interface);
DEFINE_HOOK(ospf6_interface_change,
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index e1c3b4038c..f2a933d878 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -43,6 +43,10 @@
#include "ospf6_flood.h"
#include "ospf6d.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_LSA, "OSPF6 LSA");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_LSA_HEADER, "OSPF6 LSA header");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_LSA_SUMMARY, "OSPF6 LSA summary");
+
vector ospf6_lsa_handler_vector;
struct ospf6 *ospf6_get_by_lsdb(struct ospf6_lsa *lsa)
@@ -657,27 +661,29 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
vty_out(vty, "\n");
}
+struct ospf6_lsa *ospf6_lsa_alloc(size_t lsa_length)
+{
+ struct ospf6_lsa *lsa;
+
+ lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
+ lsa->header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, lsa_length);
+
+ return lsa;
+}
+
/* OSPFv3 LSA creation/deletion function */
struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
{
struct ospf6_lsa *lsa = NULL;
- struct ospf6_lsa_header *new_header = NULL;
uint16_t lsa_size = 0;
/* size of the entire LSA */
lsa_size = ntohs(header->length); /* XXX vulnerable */
- /* allocate memory for this LSA */
- new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, lsa_size);
+ lsa = ospf6_lsa_alloc(lsa_size);
/* copy LSA from original header */
- memcpy(new_header, header, lsa_size);
-
- /* LSA information structure */
- /* allocate memory */
- lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
-
- lsa->header = new_header;
+ memcpy(lsa->header, header, lsa_size);
/* dump string */
ospf6_lsa_printbuf(lsa, lsa->name, sizeof(lsa->name));
@@ -691,20 +697,11 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
struct ospf6_lsa *ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header)
{
struct ospf6_lsa *lsa = NULL;
- struct ospf6_lsa_header *new_header = NULL;
- /* allocate memory for this LSA */
- new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER,
- sizeof(struct ospf6_lsa_header));
+ lsa = ospf6_lsa_alloc(sizeof(struct ospf6_lsa_header));
- /* copy LSA from original header */
- memcpy(new_header, header, sizeof(struct ospf6_lsa_header));
-
- /* LSA information structure */
- /* allocate memory */
- lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
+ memcpy(lsa->header, header, sizeof(struct ospf6_lsa_header));
- lsa->header = new_header;
SET_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY);
/* dump string */
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index 7fa9c5fe40..c4d0290c0c 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -217,6 +217,7 @@ extern void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa,
extern void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
json_object *json, bool use_json);
+extern struct ospf6_lsa *ospf6_lsa_alloc(size_t lsa_length);
extern struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header);
extern struct ospf6_lsa *
ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header);
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 9636e1a230..18f121e3a2 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -34,6 +34,8 @@
#include "ospf6d.h"
#include "bitfield.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_LSDB, "OSPF6 LSA database");
+
struct ospf6_lsdb *ospf6_lsdb_create(void *data)
{
struct ospf6_lsdb *lsdb;
diff --git a/ospf6d/ospf6_memory.c b/ospf6d/ospf6_memory.c
deleted file mode 100644
index 05bad4936e..0000000000
--- a/ospf6d/ospf6_memory.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ospf6d 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 "ospf6_memory.h"
-
-DEFINE_MGROUP(OSPF6D, "ospf6d");
-DEFINE_MTYPE(OSPF6D, OSPF6_TOP, "OSPF6 top");
-DEFINE_MTYPE(OSPF6D, OSPF6_AREA, "OSPF6 area");
-DEFINE_MTYPE(OSPF6D, OSPF6_IF, "OSPF6 interface");
-DEFINE_MTYPE(OSPF6D, OSPF6_NEIGHBOR, "OSPF6 neighbor");
-DEFINE_MTYPE(OSPF6D, OSPF6_ROUTE, "OSPF6 route");
-DEFINE_MTYPE(OSPF6D, OSPF6_PREFIX, "OSPF6 prefix");
-DEFINE_MTYPE(OSPF6D, OSPF6_MESSAGE, "OSPF6 message");
-DEFINE_MTYPE(OSPF6D, OSPF6_LSA, "OSPF6 LSA");
-DEFINE_MTYPE(OSPF6D, OSPF6_LSA_HEADER, "OSPF6 LSA header");
-DEFINE_MTYPE(OSPF6D, OSPF6_LSA_SUMMARY, "OSPF6 LSA summary");
-DEFINE_MTYPE(OSPF6D, OSPF6_LSDB, "OSPF6 LSA database");
-DEFINE_MTYPE(OSPF6D, OSPF6_VERTEX, "OSPF6 vertex");
-DEFINE_MTYPE(OSPF6D, OSPF6_SPFTREE, "OSPF6 SPF tree");
-DEFINE_MTYPE(OSPF6D, OSPF6_NEXTHOP, "OSPF6 nexthop");
-DEFINE_MTYPE(OSPF6D, OSPF6_EXTERNAL_INFO, "OSPF6 ext. info");
-DEFINE_MTYPE(OSPF6D, OSPF6_PATH, "OSPF6 Path");
-DEFINE_MTYPE(OSPF6D, OSPF6_DIST_ARGS, "OSPF6 Distribute arguments");
-DEFINE_MTYPE(OSPF6D, OSPF6_OTHER, "OSPF6 other");
-DEFINE_MTYPE(OSPF6D, OSPF6_REDISTRIBUTE, "OSPF6 Redistribute arguments");
diff --git a/ospf6d/ospf6_memory.h b/ospf6d/ospf6_memory.h
deleted file mode 100644
index 68a0363a15..0000000000
--- a/ospf6d/ospf6_memory.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ospf6d 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_OSPF6_MEMORY_H
-#define _QUAGGA_OSPF6_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(OSPF6D);
-DECLARE_MTYPE(OSPF6_TOP);
-DECLARE_MTYPE(OSPF6_AREA);
-DECLARE_MTYPE(OSPF6_IF);
-DECLARE_MTYPE(OSPF6_NEIGHBOR);
-DECLARE_MTYPE(OSPF6_ROUTE);
-DECLARE_MTYPE(OSPF6_PREFIX);
-DECLARE_MTYPE(OSPF6_MESSAGE);
-DECLARE_MTYPE(OSPF6_LSA);
-DECLARE_MTYPE(OSPF6_LSA_HEADER);
-DECLARE_MTYPE(OSPF6_LSA_SUMMARY);
-DECLARE_MTYPE(OSPF6_LSDB);
-DECLARE_MTYPE(OSPF6_VERTEX);
-DECLARE_MTYPE(OSPF6_SPFTREE);
-DECLARE_MTYPE(OSPF6_NEXTHOP);
-DECLARE_MTYPE(OSPF6_EXTERNAL_INFO);
-DECLARE_MTYPE(OSPF6_PATH);
-DECLARE_MTYPE(OSPF6_DIST_ARGS);
-DECLARE_MTYPE(OSPF6_REDISTRIBUTE);
-DECLARE_MTYPE(OSPF6_OTHER);
-
-#endif /* _QUAGGA_OSPF6_MEMORY_H */
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index aebe43b9ec..7aedd3df45 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -49,6 +49,8 @@
#include <netinet/ip6.h>
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_MESSAGE, "OSPF6 message");
+
unsigned char conf_debug_ospf6_message[6] = {0x03, 0, 0, 0, 0, 0};
static const struct message ospf6_message_type_str[] = {
{OSPF6_MESSAGE_TYPE_HELLO, "Hello"},
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index 15065c98eb..485bde4b7b 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -46,6 +46,8 @@
#include "ospf6_zebra.h"
#include "lib/json.h"
+DEFINE_MTYPE(OSPF6D, OSPF6_NEIGHBOR, "OSPF6 neighbor");
+
DEFINE_HOOK(ospf6_neighbor_change,
(struct ospf6_neighbor * on, int state, int next_state),
(on, state, next_state));
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index b77f968179..9770dd0444 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -38,6 +38,10 @@
#include "ospf6d.h"
#include "ospf6_zebra.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_ROUTE, "OSPF6 route");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_NEXTHOP, "OSPF6 nexthop");
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_PATH, "OSPF6 Path");
+
unsigned char conf_debug_ospf6_route = 0;
static char *ospf6_route_table_name(struct ospf6_route_table *table)
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index d1931055a2..7652d71c59 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -43,6 +43,8 @@
#include "ospf6d.h"
#include "ospf6_abr.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_VERTEX, "OSPF6 vertex");
+
unsigned char conf_debug_ospf6_spf = 0;
static void ospf6_spf_copy_nexthops_to_route(struct ospf6_route *rt,
@@ -1021,13 +1023,8 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
return NULL;
}
- /* Allocate memory for this LSA */
- new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, total_lsa_length);
-
- /* LSA information structure */
- lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
-
- lsa->header = (struct ospf6_lsa_header *)new_header;
+ lsa = ospf6_lsa_alloc(total_lsa_length);
+ new_header = (uint8_t *)lsa->header;
lsa->lsdb = area->temp_router_lsa_lsdb;
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 2fed7c5d03..a38f1cbc45 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -53,6 +53,8 @@
#include "ospf6d.h"
#include "lib/json.h"
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_TOP, "OSPF6 top");
+
DEFINE_QOBJ_TYPE(ospf6);
FRR_CFG_DEFAULT_BOOL(OSPF6_LOG_ADJACENCY_CHANGES,
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index 8d9c85fd08..91d427c78c 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -46,6 +46,8 @@
#include "ospf6_bfd.h"
#include "lib/json.h"
+DEFINE_MGROUP(OSPF6D, "ospf6d");
+
struct route_node *route_prev(struct route_node *node)
{
struct route_node *end;
diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h
index d85ff40f32..3f9461c7f0 100644
--- a/ospf6d/ospf6d.h
+++ b/ospf6d/ospf6d.h
@@ -23,8 +23,9 @@
#include "libospf.h"
#include "thread.h"
+#include "memory.h"
-#include "ospf6_memory.h"
+DECLARE_MGROUP(OSPF6D);
/* global variables */
extern struct thread_master *master;
diff --git a/ospf6d/subdir.am b/ospf6d/subdir.am
index d9d4301df7..82d880cca8 100644
--- a/ospf6d/subdir.am
+++ b/ospf6d/subdir.am
@@ -40,7 +40,6 @@ ospf6d_libospf6_a_SOURCES = \
ospf6d/ospf6_intra.c \
ospf6d/ospf6_lsa.c \
ospf6d/ospf6_lsdb.c \
- ospf6d/ospf6_memory.c \
ospf6d/ospf6_message.c \
ospf6d/ospf6_neighbor.c \
ospf6d/ospf6_network.c \
@@ -62,7 +61,6 @@ noinst_HEADERS += \
ospf6d/ospf6_intra.h \
ospf6d/ospf6_lsa.h \
ospf6d/ospf6_lsdb.h \
- ospf6d/ospf6_memory.h \
ospf6d/ospf6_message.h \
ospf6d/ospf6_neighbor.h \
ospf6d/ospf6_network.h \
diff --git a/pathd/path_cli.c b/pathd/path_cli.c
index a46ec5fac4..cf14aa8c61 100644
--- a/pathd/path_cli.c
+++ b/pathd/path_cli.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <zebra.h>
+#include "memory.h"
#include "log.h"
#include "command.h"
#include "mpls.h"
@@ -28,7 +29,6 @@
#include "pathd/pathd.h"
#include "pathd/path_nb.h"
-#include "pathd/path_memory.h"
#ifndef VTYSH_EXTRACT_PL
#include "pathd/path_cli_clippy.c"
#endif
diff --git a/pathd/path_memory.c b/pathd/path_memory.c
deleted file mode 100644
index 7a78c09cf9..0000000000
--- a/pathd/path_memory.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * 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 "pathd/path_memory.h"
-
-DEFINE_MGROUP(PATHD, "pathd");
diff --git a/pathd/path_memory.h b/pathd/path_memory.h
deleted file mode 100644
index a0896cdad8..0000000000
--- a/pathd/path_memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * 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 _FRR_PATH_MEMORY_H_
-#define _FRR_PATH_MEMORY_H_
-
-#include "memory.h"
-
-DECLARE_MGROUP(PATHD);
-
-#endif /* _FRR_PATH_MEMORY_H_ */
diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c
index 5dcba965a2..d6cd48ecdb 100644
--- a/pathd/path_pcep.c
+++ b/pathd/path_pcep.c
@@ -19,6 +19,7 @@
#include <zebra.h>
#include "pceplib/pcep_utils_counters.h"
+#include "memory.h"
#include "log.h"
#include "command.h"
#include "libfrr.h"
@@ -31,13 +32,13 @@
#include "pathd/pathd.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_cli.h"
#include "pathd/path_pcep_controller.h"
#include "pathd/path_pcep_lib.h"
#include "pathd/path_pcep_config.h"
+DEFINE_MTYPE(PATHD, PCEP, "PCEP module");
/*
* Globals.
diff --git a/pathd/path_pcep.h b/pathd/path_pcep.h
index b131b31445..654d089cbc 100644
--- a/pathd/path_pcep.h
+++ b/pathd/path_pcep.h
@@ -22,11 +22,13 @@
#include <stdbool.h>
#include <debug.h>
#include <netinet/tcp.h>
+#include "memory.h"
#include "pceplib/pcep_utils_logging.h"
#include "pceplib/pcep_pcc_api.h"
#include "mpls.h"
#include "pathd/pathd.h"
-#include "pathd/path_pcep_memory.h"
+
+DECLARE_MTYPE(PCEP);
#define PCEP_DEFAULT_PORT 4189
#define MAX_PCC 32
diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c
index e2b33b8ff2..14404b1d08 100644
--- a/pathd/path_pcep_cli.c
+++ b/pathd/path_pcep_cli.c
@@ -33,7 +33,6 @@
#include "pathd/pathd.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_cli.h"
#include "pathd/path_pcep_controller.h"
diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c
index 1d2f25889e..e9d699de47 100644
--- a/pathd/path_pcep_lib.c
+++ b/pathd/path_pcep_lib.c
@@ -18,15 +18,18 @@
#include <zebra.h>
+#include "memory.h"
+
#include <debug.h>
#include "pceplib/pcep_utils_counters.h"
#include "pceplib/pcep_timers.h"
#include "pathd/path_errors.h"
-#include "pathd/path_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_lib.h"
#include "pathd/path_pcep_debug.h"
-#include "pathd/path_pcep_memory.h"
+
+DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure");
+DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages");
#define CLASS_TYPE(CLASS, TYPE) (((CLASS) << 16) | (TYPE))
#define DEFAULT_LSAP_SETUP_PRIO 4
diff --git a/pathd/path_pcep_memory.c b/pathd/path_pcep_memory.c
deleted file mode 100644
index 5cb5fb33ec..0000000000
--- a/pathd/path_pcep_memory.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * 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 "pathd/path_pcep_memory.h"
-
-DEFINE_MTYPE(PATHD, PCEP, "PCEP module");
-DEFINE_MTYPE(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure");
-DEFINE_MTYPE(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages");
diff --git a/pathd/path_pcep_memory.h b/pathd/path_pcep_memory.h
deleted file mode 100644
index a44d178b2b..0000000000
--- a/pathd/path_pcep_memory.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2020 NetDEF, Inc.
- *
- * 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 _FRR_PATH_PCEP_MEMORY_H_
-#define _FRR_PATH_PCEP_MEMORY_H_
-
-#include "pathd/path_memory.h"
-
-DECLARE_MTYPE(PCEP);
-DECLARE_MTYPE(PCEPLIB_INFRA);
-DECLARE_MTYPE(PCEPLIB_MESSAGES);
-
-#endif /* _FRR_PATH_PCEP_MEMORY_H_ */
diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c
index 986aa3c456..a2c1e7cd4c 100644
--- a/pathd/path_pcep_pcc.c
+++ b/pathd/path_pcep_pcc.c
@@ -41,7 +41,6 @@
#include "pathd/pathd.h"
#include "pathd/path_zebra.h"
#include "pathd/path_errors.h"
-#include "pathd/path_pcep_memory.h"
#include "pathd/path_pcep.h"
#include "pathd/path_pcep_controller.h"
#include "pathd/path_pcep_lib.h"
diff --git a/pathd/pathd.c b/pathd/pathd.c
index 4893da880a..ae82186315 100644
--- a/pathd/pathd.c
+++ b/pathd/pathd.c
@@ -24,12 +24,13 @@
#include "network.h"
#include "pathd/pathd.h"
-#include "pathd/path_memory.h"
#include "pathd/path_zebra.h"
#include "pathd/path_debug.h"
#define HOOK_DELAY 3
+DEFINE_MGROUP(PATHD, "pathd");
+
DEFINE_MTYPE_STATIC(PATHD, PATH_SEGMENT_LIST, "Segment List");
DEFINE_MTYPE_STATIC(PATHD, PATH_SR_POLICY, "SR Policy");
DEFINE_MTYPE_STATIC(PATHD, PATH_SR_CANDIDATE, "SR Policy candidate path");
diff --git a/pathd/pathd.h b/pathd/pathd.h
index e3d26a0ac5..9c4d256cef 100644
--- a/pathd/pathd.h
+++ b/pathd/pathd.h
@@ -19,11 +19,14 @@
#ifndef _FRR_PATHD_H_
#define _FRR_PATHD_H_
+#include "lib/memory.h"
#include "lib/mpls.h"
#include "lib/ipaddr.h"
#include "lib/srte.h"
#include "lib/hook.h"
+DECLARE_MGROUP(PATHD);
+
enum srte_protocol_origin {
SRTE_ORIGIN_UNDEFINED = 0,
SRTE_ORIGIN_PCEP = 1,
diff --git a/pathd/subdir.am b/pathd/subdir.am
index 452d824669..b4501214bf 100644
--- a/pathd/subdir.am
+++ b/pathd/subdir.am
@@ -23,7 +23,6 @@ pathd_libpath_a_SOURCES = \
pathd/path_debug.c \
pathd/path_errors.c \
pathd/path_main.c \
- pathd/path_memory.c \
pathd/path_nb.c \
pathd/path_nb_config.c \
pathd/path_nb_state.c \
@@ -39,14 +38,12 @@ clippy_scan += \
noinst_HEADERS += \
pathd/path_debug.h \
pathd/path_errors.h \
- pathd/path_memory.h \
pathd/path_nb.h \
pathd/path_pcep.h \
pathd/path_pcep_cli.h \
pathd/path_pcep_controller.h \
pathd/path_pcep_debug.h \
pathd/path_pcep_lib.h \
- pathd/path_pcep_memory.h \
pathd/path_pcep_config.h \
pathd/path_pcep_pcc.h \
pathd/path_zebra.h \
@@ -65,7 +62,6 @@ pathd_pathd_pcep_la_SOURCES = \
pathd/path_pcep_controller.c \
pathd/path_pcep_debug.c \
pathd/path_pcep_lib.c \
- pathd/path_pcep_memory.c \
pathd/path_pcep_config.c \
pathd/path_pcep_pcc.c \
# end
diff --git a/staticd/static_memory.c b/staticd/static_memory.c
deleted file mode 100644
index 9d8d7643e2..0000000000
--- a/staticd/static_memory.c
+++ /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
index 5348129ab2..0000000000
--- a/staticd/static_memory.h
+++ /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
diff --git a/staticd/static_routes.c b/staticd/static_routes.c
index 9f7e19660d..739c08b09e 100644
--- a/staticd/static_routes.c
+++ b/staticd/static_routes.c
@@ -31,12 +31,71 @@
#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,
diff --git a/staticd/static_routes.h b/staticd/static_routes.h
index 0fbf0674d7..f64a40329d 100644
--- a/staticd/static_routes.h
+++ b/staticd/static_routes.h
@@ -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
*/
diff --git a/staticd/static_vrf.c b/staticd/static_vrf.c
index 2133093bb3..ba1367b877 100644
--- a/staticd/static_vrf.c
+++ b/staticd/static_vrf.c
@@ -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"
@@ -32,63 +31,6 @@
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;
diff --git a/staticd/static_vty.c b/staticd/static_vty.c
index dd03f83778..33a2728cd0 100644
--- a/staticd/static_vty.c
+++ b/staticd/static_vty.c
@@ -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"
diff --git a/staticd/subdir.am b/staticd/subdir.am
index 9c630e8f5f..a0ae2569cb 100644
--- a/staticd/subdir.am
+++ b/staticd/subdir.am
@@ -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 \
diff --git a/zebra/connected.c b/zebra/connected.c
index dd8fab5e4e..6f405ca1bb 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 8bec256355..14d8ac442e 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 98bde4b3c0..af2c251607 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 695cef1995..38729c8d38 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 c679e090ca..3eeed9ac90 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 52f485dd17..28db2ad87d 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 6a943a2e2b..600fc3f2fc 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 6134df9c41..7d67c42a79 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 9e655ab266..e71e662458 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 adbdf54c1f..03884a9168 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 f2fde35f0e..09350f72c1 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 ac60d09ecc..9e675011ee 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 564e27497d..e7676a1324 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 ac21978ee8..3b556c92b5 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 fdeef2c88c..55e0775a8c 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 8a7a15e46d..8ffb3870fa 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 01a97db8b3..74c6825ba1 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 47b18b2c0c..b5c26d720f 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 9f5adfa409..63ba6cd8d9 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 023b9f74a8..ca471f8d98 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 6f3e5f0427..18fe0a7e85 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 27a5a07e48..80e06d913d 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 b36e8034b7..7bbe092d8c 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 5a28ee10c6..1c258a04f7 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 0e31617c4f..d1b93dbe8a 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 4882397dd3..5fe8934a82 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 3583c5fbf4..c3fbff2723 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 004da0129c..0000000000
--- 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 769a808cb7..0000000000
--- 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 2e65307ea3..3b0c75151b 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 a879513539..c0c064cbc7 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 5f11bbd600..3e89df68fd 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 9246283fdf..12ed024a66 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 ae7727ca17..27b8a3ea47 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 1d59e0ab34..244f16302b 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 4b87432ffc..c4004842e6 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 1e7b38086b..bea855d1af 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 eabc2e005e..537d69fbca 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 6b26192711..ffe4be8557 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 a6e3f8473f..3b0ef71987 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 17a9bf97f9..c9660c7309 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 11c1130c4f..5a00f3155d 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 e761cd7d04..98158ecc12 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 46398f3fb6..b42923640f 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 3349c18204..d5c9f7183d 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 d95967c55d..bc2eac7a0b 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"