summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/Makefile.am2
-rw-r--r--bgpd/bgp_community.c1
-rw-r--r--bgpd/bgp_fsm.c13
-rw-r--r--bgpd/bgp_memory.c110
-rw-r--r--bgpd/bgp_memory.h108
-rw-r--r--bgpd/bgp_nexthop.c11
-rw-r--r--bgpd/bgp_open.c9
-rw-r--r--bgpd/bgp_vty.c2
-rw-r--r--bgpd/bgpd.c13
-rw-r--r--bgpd/bgpd.h1
-rw-r--r--isisd/Makefile.am2
-rw-r--r--isisd/dict.c1
-rw-r--r--isisd/isis_memory.c48
-rw-r--r--isisd/isis_memory.h49
-rw-r--r--isisd/isis_redist.c13
-rw-r--r--isisd/isisd.h1
-rw-r--r--lib/.gitignore1
-rw-r--r--lib/Makefile.am10
-rw-r--r--lib/bfd.c2
-rw-r--r--lib/buffer.c3
-rw-r--r--lib/command.c4
-rw-r--r--lib/command.h6
-rw-r--r--lib/distribute.c4
-rw-r--r--lib/filter.c4
-rw-r--r--lib/hash.c4
-rw-r--r--lib/hash.h5
-rw-r--r--lib/if.c6
-rw-r--r--lib/if.h4
-rw-r--r--lib/if_rmap.c3
-rw-r--r--lib/keychain.c3
-rw-r--r--lib/linklist.c3
-rw-r--r--lib/log.c2
-rw-r--r--lib/memory.c3
-rw-r--r--lib/memory.h5
-rw-r--r--lib/memtypes.c292
-rwxr-xr-xlib/memtypes.pl6
-rw-r--r--lib/nexthop.c2
-rw-r--r--lib/ns.c3
-rw-r--r--lib/plist.c9
-rw-r--r--lib/pqueue.c3
-rw-r--r--lib/prefix.c2
-rw-r--r--lib/privs.c3
-rw-r--r--lib/routemap.c8
-rw-r--r--lib/routemap.h4
-rw-r--r--lib/sockunion.c2
-rw-r--r--lib/stream.c4
-rw-r--r--lib/table.c3
-rw-r--r--lib/table.h3
-rw-r--r--lib/thread.c4
-rw-r--r--lib/vector.c3
-rw-r--r--lib/vector.h3
-rw-r--r--lib/vrf.c3
-rw-r--r--lib/vty.c4
-rw-r--r--lib/workqueue.c4
-rw-r--r--lib/workqueue.h3
-rw-r--r--lib/zclient.c2
-rw-r--r--ospf6d/Makefile.am2
-rw-r--r--ospf6d/ospf6_interface.c10
-rw-r--r--ospf6d/ospf6_memory.c44
-rw-r--r--ospf6d/ospf6_memory.h45
-rw-r--r--ospf6d/ospf6d.h2
-rw-r--r--ospfd/Makefile.am4
-rw-r--r--ospfd/ospf_memory.c56
-rw-r--r--ospfd/ospf_memory.h57
-rw-r--r--ospfd/ospf_te.c2
-rw-r--r--ospfd/ospfd.h2
-rw-r--r--pimd/Makefile.am2
-rw-r--r--pimd/pim_memory.c41
-rw-r--r--pimd/pim_memory.h42
-rw-r--r--pimd/pimd.h1
-rw-r--r--ripd/Makefile.am2
-rw-r--r--ripd/rip_memory.c35
-rw-r--r--ripd/rip_memory.h36
-rw-r--r--ripd/ripd.h2
-rw-r--r--ripngd/Makefile.am2
-rw-r--r--ripngd/ripng_memory.c35
-rw-r--r--ripngd/ripng_memory.h36
-rw-r--r--ripngd/ripngd.h2
-rw-r--r--tests/heavy-wq.c14
-rw-r--r--tests/test-memory.c49
-rw-r--r--vtysh/vtysh.c14
-rw-r--r--vtysh/vtysh.h3
-rw-r--r--vtysh/vtysh_config.c4
-rw-r--r--zebra/Makefile.am5
-rw-r--r--zebra/connected.c1
-rw-r--r--zebra/if_ioctl.c1
-rw-r--r--zebra/if_ioctl_solaris.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_socket.c1
-rw-r--r--zebra/main.c1
-rw-r--r--zebra/redistribute.c1
-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/test_main.c1
-rw-r--r--zebra/zebra_memory.c37
-rw-r--r--zebra/zebra_memory.h40
-rw-r--r--zebra/zebra_ns.c4
-rw-r--r--zebra/zebra_ptm_redistribute.c1
-rw-r--r--zebra/zebra_rib.c11
-rw-r--r--zebra/zebra_rnh.c1
-rw-r--r--zebra/zebra_routemap.c1
-rw-r--r--zebra/zebra_static.c1
-rw-r--r--zebra/zebra_vrf.c2
-rw-r--r--zebra/zebra_vty.c2
-rw-r--r--zebra/zserv.c1
111 files changed, 1100 insertions, 392 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 5176a8e04..fb5b2375d 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -11,6 +11,7 @@ sbin_PROGRAMS = bgpd
bin_PROGRAMS = bgp_btoa
libbgp_a_SOURCES = \
+ bgp_memory.c \
bgpd.c bgp_fsm.c bgp_aspath.c bgp_community.c bgp_attr.c \
bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \
bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \
@@ -20,6 +21,7 @@ libbgp_a_SOURCES = \
bgp_encap.c bgp_encap_tlv.c
noinst_HEADERS = \
+ bgp_memory.h \
bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \
bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \
bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index d7aa4c1e3..450cbddcf 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "hash.h"
#include "memory.h"
+#include "bgpd/bgp_memory.h"
#include "bgpd/bgp_community.h"
/* Hash of community attribute. */
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 046767177..f63c9aa71 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -51,6 +51,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_nht.h"
#include "bgpd/bgp_bfd.h"
+#include "bgpd/bgp_memory.h"
/* Definition of display strings corresponding to FSM events. This should be
* kept consistent with the events defined in bgpd.h
@@ -166,12 +167,12 @@ peer_xfer_conn(struct peer *from_peer)
{
if (peer->hostname)
{
- XFREE(MTYPE_HOST, peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL;
}
- peer->hostname = XSTRDUP(MTYPE_HOST, from_peer->hostname);
- XFREE(MTYPE_HOST, from_peer->hostname);
+ peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, from_peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, from_peer->hostname);
from_peer->hostname = NULL;
}
@@ -179,12 +180,12 @@ peer_xfer_conn(struct peer *from_peer)
{
if (peer->domainname)
{
- XFREE(MTYPE_HOST, peer->domainname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname= NULL;
}
- peer->domainname = XSTRDUP(MTYPE_HOST, from_peer->domainname);
- XFREE(MTYPE_HOST, from_peer->domainname);
+ peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, from_peer->domainname);
+ XFREE(MTYPE_BGP_PEER_HOST, from_peer->domainname);
from_peer->domainname = NULL;
}
diff --git a/bgpd/bgp_memory.c b/bgpd/bgp_memory.c
new file mode 100644
index 000000000..166400b74
--- /dev/null
+++ b/bgpd/bgp_memory.c
@@ -0,0 +1,110 @@
+/* bgpd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "bgp_memory.h"
+
+/* this file is temporary in nature; definitions should be moved to the
+ * files they're used in */
+
+DEFINE_MGROUP(BGPD, "bgpd")
+DEFINE_MTYPE(BGPD, BGP, "BGP instance")
+DEFINE_MTYPE(BGPD, BGP_LISTENER, "BGP listen socket details")
+DEFINE_MTYPE(BGPD, BGP_PEER, "BGP peer")
+DEFINE_MTYPE(BGPD, BGP_PEER_HOST, "BGP peer hostname")
+DEFINE_MTYPE(BGPD, BGP_PEER_IFNAME, "BGP peer ifname")
+DEFINE_MTYPE(BGPD, PEER_GROUP, "Peer group")
+DEFINE_MTYPE(BGPD, PEER_GROUP_HOST, "BGP Peer group hostname")
+DEFINE_MTYPE(BGPD, PEER_DESC, "Peer description")
+DEFINE_MTYPE(BGPD, PEER_PASSWORD, "Peer password string")
+DEFINE_MTYPE(BGPD, BGP_PEER_AF, "BGP peer af")
+DEFINE_MTYPE(BGPD, BGP_UPDGRP, "BGP update group")
+DEFINE_MTYPE(BGPD, BGP_UPD_SUBGRP, "BGP update subgroup")
+DEFINE_MTYPE(BGPD, BGP_PACKET, "BGP packet")
+DEFINE_MTYPE(BGPD, ATTR, "BGP attribute")
+DEFINE_MTYPE(BGPD, ATTR_EXTRA, "BGP extra attributes")
+DEFINE_MTYPE(BGPD, AS_PATH, "BGP aspath")
+DEFINE_MTYPE(BGPD, AS_SEG, "BGP aspath seg")
+DEFINE_MTYPE(BGPD, AS_SEG_DATA, "BGP aspath segment data")
+DEFINE_MTYPE(BGPD, AS_STR, "BGP aspath str")
+
+DEFINE_MTYPE(BGPD, BGP_TABLE, "BGP table")
+DEFINE_MTYPE(BGPD, BGP_NODE, "BGP node")
+DEFINE_MTYPE(BGPD, BGP_ROUTE, "BGP route")
+DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA, "BGP ancillary route info")
+DEFINE_MTYPE(BGPD, BGP_CONN, "BGP connected")
+DEFINE_MTYPE(BGPD, BGP_STATIC, "BGP static")
+DEFINE_MTYPE(BGPD, BGP_ADVERTISE_ATTR, "BGP adv attr")
+DEFINE_MTYPE(BGPD, BGP_ADVERTISE, "BGP adv")
+DEFINE_MTYPE(BGPD, BGP_SYNCHRONISE, "BGP synchronise")
+DEFINE_MTYPE(BGPD, BGP_ADJ_IN, "BGP adj in")
+DEFINE_MTYPE(BGPD, BGP_ADJ_OUT, "BGP adj out")
+DEFINE_MTYPE(BGPD, BGP_MPATH_INFO, "BGP multipath info")
+
+DEFINE_MTYPE(BGPD, AS_LIST, "BGP AS list")
+DEFINE_MTYPE(BGPD, AS_FILTER, "BGP AS filter")
+DEFINE_MTYPE(BGPD, AS_FILTER_STR, "BGP AS filter str")
+
+DEFINE_MTYPE(BGPD, COMMUNITY, "community")
+DEFINE_MTYPE(BGPD, COMMUNITY_VAL, "community val")
+DEFINE_MTYPE(BGPD, COMMUNITY_STR, "community str")
+
+DEFINE_MTYPE(BGPD, ECOMMUNITY, "extcommunity")
+DEFINE_MTYPE(BGPD, ECOMMUNITY_VAL, "extcommunity val")
+DEFINE_MTYPE(BGPD, ECOMMUNITY_STR, "extcommunity str")
+
+DEFINE_MTYPE(BGPD, COMMUNITY_LIST, "community-list")
+DEFINE_MTYPE(BGPD, COMMUNITY_LIST_NAME, "community-list name")
+DEFINE_MTYPE(BGPD, COMMUNITY_LIST_ENTRY, "community-list entry")
+DEFINE_MTYPE(BGPD, COMMUNITY_LIST_CONFIG, "community-list config")
+DEFINE_MTYPE(BGPD, COMMUNITY_LIST_HANDLER, "community-list handler")
+
+DEFINE_MTYPE(BGPD, CLUSTER, "Cluster list")
+DEFINE_MTYPE(BGPD, CLUSTER_VAL, "Cluster list val")
+
+DEFINE_MTYPE(BGPD, BGP_PROCESS_QUEUE, "BGP Process queue")
+DEFINE_MTYPE(BGPD, BGP_CLEAR_NODE_QUEUE, "BGP node clear queue")
+
+DEFINE_MTYPE(BGPD, TRANSIT, "BGP transit attr")
+DEFINE_MTYPE(BGPD, TRANSIT_VAL, "BGP transit val")
+
+DEFINE_MTYPE(BGPD, BGP_DEBUG_FILTER, "BGP debug filter")
+DEFINE_MTYPE(BGPD, BGP_DEBUG_STR, "BGP debug filter string")
+
+DEFINE_MTYPE(BGPD, BGP_DISTANCE, "BGP distance")
+DEFINE_MTYPE(BGPD, BGP_NEXTHOP_CACHE, "BGP nexthop")
+DEFINE_MTYPE(BGPD, BGP_CONFED_LIST, "BGP confed list")
+DEFINE_MTYPE(BGPD, PEER_UPDATE_SOURCE, "BGP peer update interface")
+DEFINE_MTYPE(BGPD, PEER_CONF_IF, "BGP peer config interface")
+DEFINE_MTYPE(BGPD, BGP_DAMP_INFO, "Dampening info")
+DEFINE_MTYPE(BGPD, BGP_DAMP_ARRAY, "BGP Dampening array")
+DEFINE_MTYPE(BGPD, BGP_REGEXP, "BGP regexp")
+DEFINE_MTYPE(BGPD, BGP_AGGREGATE, "BGP aggregate")
+DEFINE_MTYPE(BGPD, BGP_ADDR, "BGP own address")
+
+DEFINE_MTYPE(BGPD, BGP_REDIST, "BGP redistribution")
+DEFINE_MTYPE(BGPD, BGP_FILTER_NAME, "BGP Filter Information")
+DEFINE_MTYPE(BGPD, BGP_DUMP_STR, "BGP Dump String Information")
+DEFINE_MTYPE(BGPD, ENCAP_TLV, "ENCAP TLV")
diff --git a/bgpd/bgp_memory.h b/bgpd/bgp_memory.h
new file mode 100644
index 000000000..b2956f07e
--- /dev/null
+++ b/bgpd/bgp_memory.h
@@ -0,0 +1,108 @@
+/* bgpd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_BGP_MEMORY_H
+#define _QUAGGA_BGP_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(BGPD)
+DECLARE_MTYPE(BGP)
+DECLARE_MTYPE(BGP_LISTENER)
+DECLARE_MTYPE(BGP_PEER)
+DECLARE_MTYPE(BGP_PEER_HOST)
+DECLARE_MTYPE(BGP_PEER_IFNAME)
+DECLARE_MTYPE(PEER_GROUP)
+DECLARE_MTYPE(PEER_GROUP_HOST)
+DECLARE_MTYPE(PEER_DESC)
+DECLARE_MTYPE(PEER_PASSWORD)
+DECLARE_MTYPE(BGP_PEER_AF)
+DECLARE_MTYPE(BGP_UPDGRP)
+DECLARE_MTYPE(BGP_UPD_SUBGRP)
+DECLARE_MTYPE(BGP_PACKET)
+DECLARE_MTYPE(ATTR)
+DECLARE_MTYPE(ATTR_EXTRA)
+DECLARE_MTYPE(AS_PATH)
+DECLARE_MTYPE(AS_SEG)
+DECLARE_MTYPE(AS_SEG_DATA)
+DECLARE_MTYPE(AS_STR)
+
+DECLARE_MTYPE(BGP_TABLE)
+DECLARE_MTYPE(BGP_NODE)
+DECLARE_MTYPE(BGP_ROUTE)
+DECLARE_MTYPE(BGP_ROUTE_EXTRA)
+DECLARE_MTYPE(BGP_CONN)
+DECLARE_MTYPE(BGP_STATIC)
+DECLARE_MTYPE(BGP_ADVERTISE_ATTR)
+DECLARE_MTYPE(BGP_ADVERTISE)
+DECLARE_MTYPE(BGP_SYNCHRONISE)
+DECLARE_MTYPE(BGP_ADJ_IN)
+DECLARE_MTYPE(BGP_ADJ_OUT)
+DECLARE_MTYPE(BGP_MPATH_INFO)
+
+DECLARE_MTYPE(AS_LIST)
+DECLARE_MTYPE(AS_FILTER)
+DECLARE_MTYPE(AS_FILTER_STR)
+
+DECLARE_MTYPE(COMMUNITY)
+DECLARE_MTYPE(COMMUNITY_VAL)
+DECLARE_MTYPE(COMMUNITY_STR)
+
+DECLARE_MTYPE(ECOMMUNITY)
+DECLARE_MTYPE(ECOMMUNITY_VAL)
+DECLARE_MTYPE(ECOMMUNITY_STR)
+
+DECLARE_MTYPE(COMMUNITY_LIST)
+DECLARE_MTYPE(COMMUNITY_LIST_NAME)
+DECLARE_MTYPE(COMMUNITY_LIST_ENTRY)
+DECLARE_MTYPE(COMMUNITY_LIST_CONFIG)
+DECLARE_MTYPE(COMMUNITY_LIST_HANDLER)
+
+DECLARE_MTYPE(CLUSTER)
+DECLARE_MTYPE(CLUSTER_VAL)
+
+DECLARE_MTYPE(BGP_PROCESS_QUEUE)
+DECLARE_MTYPE(BGP_CLEAR_NODE_QUEUE)
+
+DECLARE_MTYPE(TRANSIT)
+DECLARE_MTYPE(TRANSIT_VAL)
+
+DECLARE_MTYPE(BGP_DEBUG_FILTER)
+DECLARE_MTYPE(BGP_DEBUG_STR)
+
+DECLARE_MTYPE(BGP_DISTANCE)
+DECLARE_MTYPE(BGP_NEXTHOP_CACHE)
+DECLARE_MTYPE(BGP_CONFED_LIST)
+DECLARE_MTYPE(PEER_UPDATE_SOURCE)
+DECLARE_MTYPE(PEER_CONF_IF)
+DECLARE_MTYPE(BGP_DAMP_INFO)
+DECLARE_MTYPE(BGP_DAMP_ARRAY)
+DECLARE_MTYPE(BGP_REGEXP)
+DECLARE_MTYPE(BGP_AGGREGATE)
+DECLARE_MTYPE(BGP_ADDR)
+
+DECLARE_MTYPE(BGP_REDIST)
+DECLARE_MTYPE(BGP_FILTER_NAME)
+DECLARE_MTYPE(BGP_DUMP_STR)
+DECLARE_MTYPE(ENCAP_TLV)
+
+#endif /* _QUAGGA_BGP_MEMORY_H */
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 1e5c4cf8b..19f5428d8 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -47,8 +47,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "zebra/rib.h"
#include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */
-
-
char *
bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
{
@@ -59,14 +57,7 @@ bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
void
bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
{
- struct nexthop *nexthop;
- struct nexthop *next = NULL;
-
- for (nexthop = bnc->nexthop; nexthop; nexthop = next)
- {
- next = nexthop->next;
- XFREE (MTYPE_NEXTHOP, nexthop);
- }
+ nexthops_free(bnc->nexthop);
}
struct bgp_nexthop_cache *
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 6001092ce..02026a004 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -39,6 +39,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_open.h"
#include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_vty.h"
+#include "bgpd/bgp_memory.h"
/* BGP-4 Multiprotocol Extentions lead us to the complex world. We can
negotiate remote peer supports extentions or not. But if
@@ -638,17 +639,17 @@ bgp_capability_hostname (struct peer *peer, struct capability_header *hdr)
if (peer->hostname != NULL)
{
- XFREE(MTYPE_HOST, peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL;
}
if (peer->domainname != NULL)
{
- XFREE(MTYPE_HOST, peer->domainname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
}
- peer->hostname = XSTRDUP(MTYPE_HOST, str);
+ peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
}
if (stream_get_getp(s) +1 > end)
@@ -678,7 +679,7 @@ bgp_capability_hostname (struct peer *peer, struct capability_header *hdr)
if (len)
{
str[len] = '\0';
- peer->domainname = XSTRDUP(MTYPE_HOST, str);
+ peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
}
if (bgp_debug_neighbor_events(peer))
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 56db69750..96dcf9044 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -10247,7 +10247,7 @@ DEFUN (show_bgp_memory,
count * sizeof (struct peer)),
VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP)))
+ if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
vty_out (vty, "%ld peer groups, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct peer_group)),
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index bfde53d3e..f4a16d6ba 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -73,6 +73,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#endif /* HAVE_SNMP */
#include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_bfd.h"
+#include "bgpd/bgp_memory.h"
/* BGP process wide configuration. */
static struct bgp_master bgp_master;
@@ -2083,13 +2084,13 @@ peer_delete (struct peer *peer)
if (peer->hostname)
{
- XFREE(MTYPE_HOST, peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL;
}
if (peer->domainname)
{
- XFREE(MTYPE_HOST, peer->domainname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
}
@@ -2108,14 +2109,14 @@ peer_group_cmp (struct peer_group *g1, struct peer_group *g2)
static struct peer_group *
peer_group_new (void)
{
- return (struct peer_group *) XCALLOC (MTYPE_BGP_PEER_GROUP,
+ return (struct peer_group *) XCALLOC (MTYPE_PEER_GROUP,
sizeof (struct peer_group));
}
static void
peer_group_free (struct peer_group *group)
{
- XFREE (MTYPE_BGP_PEER_GROUP, group);
+ XFREE (MTYPE_PEER_GROUP, group);
}
struct peer_group *
@@ -2145,8 +2146,8 @@ peer_group_get (struct bgp *bgp, const char *name)
group = peer_group_new ();
group->bgp = bgp;
if (group->name)
- XFREE(MTYPE_BGP_PEER_GROUP_HOST, group->name);
- group->name = XSTRDUP(MTYPE_BGP_PEER_GROUP_HOST, name);
+ XFREE(MTYPE_PEER_GROUP_HOST, group->name);
+ group->name = XSTRDUP(MTYPE_PEER_GROUP_HOST, name);
group->peer = list_new ();
for (afi = AFI_IP; afi < AFI_MAX; afi++)
group->listen_range[afi] = list_new ();
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index e8827ca91..a6d3b61e5 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -29,6 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "sockunion.h"
#include "routemap.h"
#include "linklist.h"
+#include "bgp_memory.h"
#define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */
diff --git a/isisd/Makefile.am b/isisd/Makefile.am
index bfe2e9477..c14351ca3 100644
--- a/isisd/Makefile.am
+++ b/isisd/Makefile.am
@@ -13,6 +13,7 @@ sbin_PROGRAMS = isisd
SUBDIRS = topology
libisis_a_SOURCES = \
+ isis_memory.c \
isis_adjacency.c isis_lsp.c dict.c isis_circuit.c isis_pdu.c \
isis_tlv.c isisd.c isis_misc.c isis_zebra.c isis_dr.c \
isis_flags.c isis_dynhn.c iso_checksum.c isis_csm.c isis_events.c \
@@ -21,6 +22,7 @@ libisis_a_SOURCES = \
noinst_HEADERS = \
+ isis_memory.h \
isisd.h isis_pdu.h isis_tlv.h isis_adjacency.h isis_constants.h \
isis_lsp.h dict.h isis_circuit.h isis_misc.h isis_network.h \
isis_zebra.h isis_dr.h isis_flags.h isis_dynhn.h isis_common.h \
diff --git a/isisd/dict.c b/isisd/dict.c
index bbcb42134..a038028d2 100644
--- a/isisd/dict.c
+++ b/isisd/dict.c
@@ -18,6 +18,7 @@
#include "zebra.h"
#include "zassert.h"
#include "memory.h"
+#include "isis_memory.h"
#include "dict.h"
/*
diff --git a/isisd/isis_memory.c b/isisd/isis_memory.c
new file mode 100644
index 000000000..f3ecc6cd7
--- /dev/null
+++ b/isisd/isis_memory.c
@@ -0,0 +1,48 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, 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_AREA, "ISIS area")
+DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address")
+DEFINE_MTYPE(ISISD, ISIS_TLV, "ISIS TLV")
+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_NEXTHOP6, "ISIS nexthop6")
+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")
diff --git a/isisd/isis_memory.h b/isisd/isis_memory.h
new file mode 100644
index 000000000..9345229da
--- /dev/null
+++ b/isisd/isis_memory.h
@@ -0,0 +1,49 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, 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_AREA)
+DECLARE_MTYPE(ISIS_AREA_ADDR)
+DECLARE_MTYPE(ISIS_TLV)
+DECLARE_MTYPE(ISIS_DYNHN)
+DECLARE_MTYPE(ISIS_SPFTREE)
+DECLARE_MTYPE(ISIS_VERTEX)
+DECLARE_MTYPE(ISIS_ROUTE_INFO)
+DECLARE_MTYPE(ISIS_NEXTHOP)
+DECLARE_MTYPE(ISIS_NEXTHOP6)
+DECLARE_MTYPE(ISIS_DICT)
+DECLARE_MTYPE(ISIS_DICT_NODE)
+DECLARE_MTYPE(ISIS_EXT_ROUTE)
+DECLARE_MTYPE(ISIS_EXT_INFO)
+DECLARE_MTYPE(ISIS_MPLS_TE)
+
+#endif /* _QUAGGA_ISIS_MEMORY_H */
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index cc77785ce..5311b5c69 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -24,6 +24,7 @@
#include "if.h"
#include "linklist.h"
#include "memory.h"
+#include "isis_memory.h"
#include "prefix.h"
#include "routemap.h"
#include "stream.h"
@@ -94,7 +95,7 @@ isis_redist_route_node_create(route_table_delegate_t *delegate,
struct route_table *table)
{
struct route_node *node;
- node = XCALLOC(MTYPE_ROUTE_NODE, sizeof(*node));
+ node = XCALLOC(MTYPE_ISIS_EXT_ROUTE, sizeof(*node));
return node;
}
@@ -104,8 +105,8 @@ isis_redist_route_node_destroy(route_table_delegate_t *delegate,
struct route_node *node)
{
if (node->info)
- XFREE(MTYPE_ISIS, node->info);
- XFREE (MTYPE_ROUTE_NODE, node);
+ XFREE(MTYPE_ISIS_EXT_INFO, node->info);
+ XFREE (MTYPE_ISIS_EXT_ROUTE, node);
}
static route_table_delegate_t isis_redist_rt_delegate = {
@@ -142,7 +143,7 @@ isis_redist_install(struct isis_area *area, int level,
}
else
{
- er_node->info = XMALLOC(MTYPE_ISIS, sizeof(*info));
+ er_node->info = XMALLOC(MTYPE_ISIS_EXT_INFO, sizeof(*info));
}
memcpy(er_node->info, info, sizeof(*info));
@@ -242,7 +243,7 @@ isis_redist_ensure_default(struct isis *isis, int family)
return;
}
- ei_node->info = XCALLOC(MTYPE_ISIS, sizeof(struct isis_ext_info));
+ ei_node->info = XCALLOC(MTYPE_ISIS_EXT_INFO, sizeof(struct isis_ext_info));
info = ei_node->info;
info->origin = DEFAULT_ROUTE;
@@ -280,7 +281,7 @@ isis_redist_add(int type, struct prefix *p, u_char distance, uint32_t metric)
if (ei_node->info)
route_unlock_node(ei_node);
else
- ei_node->info = XCALLOC(MTYPE_ISIS, sizeof(struct isis_ext_info));
+ ei_node->info = XCALLOC(MTYPE_ISIS_EXT_INFO, sizeof(struct isis_ext_info));
info = ei_node->info;
info->origin = type;
diff --git a/isisd/isisd.h b/isisd/isisd.h
index 9a4f360a2..ca3e57006 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -32,6 +32,7 @@
#include "isisd/isis_redist.h"
#include "isis_flags.h"
#include "dict.h"
+#include "isis_memory.h"
/* uncomment if you are a developer in bug hunt */
/* #define EXTREME_DEBUG */
diff --git a/lib/.gitignore b/lib/.gitignore
index a25bae5aa..fe75137bc 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -14,6 +14,5 @@ gitversion.h.tmp
.arch-ids
*~
*.loT
-memtypes.h
route_types.h
refix
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7a2151151..dbb80076c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -13,10 +13,10 @@ libzebra_la_SOURCES = \
sockunion.c prefix.c thread.c if.c buffer.c table.c hash.c \
filter.c routemap.c distribute.c stream.c str.c log.c plist.c \
zclient.c sockopt.c smux.c agentx.c snmp.c md5.c if_rmap.c keychain.c privs.c \
- sigevent.c pqueue.c jhash.c memtypes.c workqueue.c nexthop.c json.c \
+ sigevent.c pqueue.c jhash.c workqueue.c nexthop.c json.c \
ptm_lib.c csv.c bfd.c vrf.c systemd.c ns.c memory.c memory_vty.c
-BUILT_SOURCES = memtypes.h route_types.h gitversion.h
+BUILT_SOURCES = route_types.h gitversion.h
libzebra_la_DEPENDENCIES = @LIB_REGEX@
@@ -28,7 +28,7 @@ pkginclude_HEADERS = \
memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \
plist.h zclient.h sockopt.h smux.h md5.h if_rmap.h keychain.h \
- privs.h sigevent.h pqueue.h jhash.h zassert.h memtypes.h \
+ privs.h sigevent.h pqueue.h jhash.h zassert.h \
workqueue.h route_types.h libospf.h nexthop.h json.h \
ptm_lib.h csv.h bfd.h vrf.h ns.h systemd.h bitfield.h \
fifo.h memory_vty.h
@@ -39,13 +39,9 @@ noinst_HEADERS = \
EXTRA_DIST = \
regex.c regex-gnu.h \
queue.h \
- memtypes.pl \
route_types.pl route_types.txt \
gitversion.pl
-memtypes.h: $(srcdir)/memtypes.c $(srcdir)/memtypes.pl
- @PERL@ $(srcdir)/memtypes.pl < $(srcdir)/memtypes.c > $@
-
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl
@PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@
diff --git a/lib/bfd.c b/lib/bfd.c
index 67a84c95f..a498daf76 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -33,6 +33,8 @@
#include "vty.h"
#include "bfd.h"
+DEFINE_MTYPE_STATIC(LIB, BFD_INFO, "BFD info")
+
int bfd_debug = 0;
struct bfd_gbl bfd_gbl;
diff --git a/lib/buffer.c b/lib/buffer.c
index ee9310100..1dfcdb473 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -28,7 +28,8 @@
#include "network.h"
#include <stddef.h>
-
+DEFINE_MTYPE_STATIC(LIB, BUFFER, "Buffer")
+DEFINE_MTYPE_STATIC(LIB, BUFFER_DATA, "Buffer data")
/* Buffer master. */
struct buffer
diff --git a/lib/command.c b/lib/command.c
index e67007ae2..cfdb91a5b 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -34,6 +34,10 @@ Boston, MA 02111-1307, USA. */
#include "workqueue.h"
#include "vrf.h"
+DEFINE_MTYPE( LIB, HOST, "Host config")
+DEFINE_MTYPE( LIB, STRVEC, "String vector")
+DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
+
/* Command vector which includes some level of command lists. Normally
each daemon maintains each own cmdvec. */
vector cmdvec = NULL;
diff --git a/lib/command.h b/lib/command.h
index 0415834b0..9ee4f2db3 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -26,6 +26,12 @@
#include "vector.h"
#include "vty.h"
#include "lib/route_types.h"
+#include "memory.h"
+
+DECLARE_MTYPE(HOST)
+
+/* for test-commands.c */
+DECLARE_MTYPE(STRVEC)
/* Host configuration variable */
struct host
diff --git a/lib/distribute.c b/lib/distribute.c
index 757525fd7..d0d637fbb 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -28,6 +28,10 @@
#include "distribute.h"
#include "memory.h"
+DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE, "Distribute list")
+DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
+DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_NAME, "Dist-list name")
+
/* Hash of distribute list. */
struct hash *disthash;
diff --git a/lib/filter.c b/lib/filter.c
index 0eeb8f187..e9ba715c9 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -30,6 +30,10 @@
#include "log.h"
#include "routemap.h"
+DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST, "Access List")
+DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST_STR, "Access List Str")
+DEFINE_MTYPE_STATIC(LIB, ACCESS_FILTER, "Access Filter")
+
struct filter_cisco
{
/* Cisco access-list */
diff --git a/lib/hash.c b/lib/hash.c
index a20093cd6..cb8531fcc 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -24,6 +24,10 @@
#include "hash.h"
#include "memory.h"
+DEFINE_MTYPE( LIB, HASH, "Hash")
+DEFINE_MTYPE( LIB, HASH_BACKET, "Hash Bucket")
+DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
+
/* Allocate a new hash. */
struct hash *
hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),
diff --git a/lib/hash.h b/lib/hash.h
index 0bc3089f3..11ecf75ec 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -21,6 +21,11 @@ Boston, MA 02111-1307, USA. */
#ifndef _ZEBRA_HASH_H
#define _ZEBRA_HASH_H
+#include "memory.h"
+
+DECLARE_MTYPE(HASH)
+DECLARE_MTYPE(HASH_BACKET)
+
/* Default hash table size. */
#define HASH_INITIAL_SIZE 256 /* initial number of backets. */
#define HASH_THRESHOLD 10 /* expand when backet. */
diff --git a/lib/if.c b/lib/if.c
index e44882a43..bd6079c0f 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -37,6 +37,12 @@
#include "str.h"
#include "log.h"
+DEFINE_MTYPE( LIB, IF, "Interface")
+DEFINE_MTYPE_STATIC(LIB, CONNECTED, "Connected")
+DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
+DEFINE_MTYPE( LIB, CONNECTED_LABEL, "Connected interface label")
+DEFINE_MTYPE_STATIC(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
+
/* List of interfaces in only the default VRF */
int ptm_enable = 0;
diff --git a/lib/if.h b/lib/if.h
index 17f856559..d1875e695 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -23,6 +23,10 @@ Boston, MA 02111-1307, USA. */
#include "zebra.h"
#include "linklist.h"
+#include "memory.h"
+
+DECLARE_MTYPE(IF)
+DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from:
*
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index f2d76c69d..736f2e237 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -27,6 +27,9 @@
#include "if.h"
#include "if_rmap.h"
+DEFINE_MTYPE_STATIC(LIB, IF_RMAP, "Interface route map")
+DEFINE_MTYPE_STATIC(LIB, IF_RMAP_NAME, "I.f. route map name")
+
struct hash *ifrmaphash;
/* Hook functions. */
diff --git a/lib/keychain.c b/lib/keychain.c
index c4a007edd..ac2083cf4 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */
#include "linklist.h"
#include "keychain.h"
+DEFINE_MTYPE_STATIC(LIB, KEY, "Key")
+DEFINE_MTYPE_STATIC(LIB, KEYCHAIN, "Key chain")
+
/* Master list of key chain. */
struct list *keychain_list;
diff --git a/lib/linklist.c b/lib/linklist.c
index d27a2da84..6fe91c75f 100644
--- a/lib/linklist.c
+++ b/lib/linklist.c
@@ -24,6 +24,9 @@
#include "linklist.h"
#include "memory.h"
+DEFINE_MTYPE_STATIC(LIB, LINK_LIST, "Link List")
+DEFINE_MTYPE_STATIC(LIB, LINK_NODE, "Link Node")
+
/* Allocate new list. */
struct list *
list_new (void)
diff --git a/lib/log.c b/lib/log.c
index 1ecc5b6df..b9edb12fb 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -35,6 +35,8 @@
#include <ucontext.h>
#endif
+DEFINE_MTYPE_STATIC(LIB, ZLOG, "Logging")
+
static int logfile_fd = -1; /* Used in signal handler. */
struct zlog *zlog_default = NULL;
diff --git a/lib/memory.c b/lib/memory.c
index 60008d4b5..562b0f589 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -29,6 +29,9 @@
static struct memgroup *mg_first = NULL;
struct memgroup **mg_insert = &mg_first;
+DEFINE_MGROUP(LIB, "libzebra")
+DEFINE_MTYPE(LIB, TMP, "Temporary memory")
+
static inline void
mt_count_alloc (struct memtype *mt, size_t size)
{
diff --git a/lib/memory.h b/lib/memory.h
index e8243f173..2680253d9 100644
--- a/lib/memory.h
+++ b/lib/memory.h
@@ -138,6 +138,9 @@ struct memgroup
DEFINE_MTYPE_ATTR(group, name, static, desc) \
static struct memtype * const MTYPE_ ## name = &_mt_##name;
+DECLARE_MGROUP(LIB)
+DECLARE_MTYPE(TMP)
+
extern void *qmalloc (struct memtype *mt, size_t size)
__attribute__ ((malloc, _ALLOC_SIZE(2), nonnull (1) _RET_NONNULL));
@@ -172,6 +175,4 @@ extern int qmem_walk (qmem_walk_fn *func, void *arg);
extern void memory_oom (size_t size, const char *name);
-#include "memtypes.h"
-
#endif /* _QUAGGA_MEMORY_H */
diff --git a/lib/memtypes.c b/lib/memtypes.c
deleted file mode 100644
index 4fa64a8cb..000000000
--- a/lib/memtypes.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Memory type definitions. This file is parsed by memtypes.awk to extract
- * MTYPE_ and memory_list_.. information in order to autogenerate
- * memtypes.h.
- *
- * The script is sensitive to the format (though not whitespace), see
- * the top of memtypes.awk for more details.
- */
-
-#include "zebra.h"
-#include "memory.h"
-
-DEFINE_MGROUP(LIB, "libzebra")
-DEFINE_MTYPE(LIB, TMP, "Temporary memory")
-DEFINE_MTYPE(LIB, STRVEC, "String vector")
-DEFINE_MTYPE(LIB, VECTOR, "Vector")
-DEFINE_MTYPE(LIB, VECTOR_INDEX, "Vector index")
-DEFINE_MTYPE(LIB, LINK_LIST, "Link List")
-DEFINE_MTYPE(LIB, LINK_NODE, "Link Node")
-DEFINE_MTYPE(LIB, THREAD, "Thread")
-DEFINE_MTYPE(LIB, THREAD_MASTER, "Thread master")
-DEFINE_MTYPE(LIB, THREAD_STATS, "Thread stats")
-DEFINE_MTYPE(LIB, VTY, "VTY")
-DEFINE_MTYPE(LIB, VTY_OUT_BUF, "VTY output buffer")
-DEFINE_MTYPE(LIB, VTY_HIST, "VTY history")
-DEFINE_MTYPE(LIB, IF, "Interface")
-DEFINE_MTYPE(LIB, CONNECTED, "Connected")
-DEFINE_MTYPE(LIB, NBR_CONNECTED, "Neighbor Connected")
-DEFINE_MTYPE(LIB, CONNECTED_LABEL, "Connected interface label")
-DEFINE_MTYPE(LIB, BUFFER, "Buffer")
-DEFINE_MTYPE(LIB, BUFFER_DATA, "Buffer data")
-DEFINE_MTYPE(LIB, STREAM, "Stream")
-DEFINE_MTYPE(LIB, STREAM_DATA, "Stream data")
-DEFINE_MTYPE(LIB, STREAM_FIFO, "Stream FIFO")
-DEFINE_MTYPE(LIB, PREFIX, "Prefix")
-DEFINE_MTYPE(LIB, PREFIX_IPV4, "Prefix IPv4")
-DEFINE_MTYPE(LIB, PREFIX_IPV6, "Prefix IPv6")
-DEFINE_MTYPE(LIB, HASH, "Hash")
-DEFINE_MTYPE(LIB, HASH_BACKET, "Hash Bucket")
-DEFINE_MTYPE(LIB, HASH_INDEX, "Hash Index")
-DEFINE_MTYPE(LIB, ROUTE_TABLE, "Route table")
-DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node")
-DEFINE_MTYPE(LIB, DISTRIBUTE, "Distribute list")
-DEFINE_MTYPE(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
-DEFINE_MTYPE(LIB, DISTRIBUTE_NAME, "Dist-list name")
-DEFINE_MTYPE(LIB, ACCESS_LIST, "Access List")
-DEFINE_MTYPE(LIB, ACCESS_LIST_STR, "Access List Str")
-DEFINE_MTYPE(LIB, ACCESS_FILTER, "Access Filter")
-DEFINE_MTYPE(LIB, PREFIX_LIST, "Prefix List")
-DEFINE_MTYPE(LIB, PREFIX_LIST_ENTRY, "Prefix List Entry")
-DEFINE_MTYPE(LIB, PREFIX_LIST_STR, "Prefix List Str")
-DEFINE_MTYPE(LIB, PREFIX_LIST_TRIE, "Prefix List Trie Table")
-DEFINE_MTYPE(LIB, ROUTE_MAP, "Route map")
-DEFINE_MTYPE(LIB, ROUTE_MAP_NAME, "Route map name")
-DEFINE_MTYPE(LIB, ROUTE_MAP_INDEX, "Route map index")
-DEFINE_MTYPE(LIB, ROUTE_MAP_RULE, "Route map rule")
-DEFINE_MTYPE(LIB, ROUTE_MAP_RULE_STR, "Route map rule str")
-DEFINE_MTYPE(LIB, ROUTE_MAP_COMPILED, "Route map compiled")
-DEFINE_MTYPE(LIB, ROUTE_MAP_DEP, "Route map dependency")
-DEFINE_MTYPE(LIB, CMD_TOKENS, "Command desc")
-DEFINE_MTYPE(LIB, KEY, "Key")
-DEFINE_MTYPE(LIB, KEYCHAIN, "Key chain")
-DEFINE_MTYPE(LIB, IF_RMAP, "Interface route map")
-DEFINE_MTYPE(LIB, IF_RMAP_NAME, "I.f. route map name")
-DEFINE_MTYPE(LIB, SOCKUNION, "Socket union")
-DEFINE_MTYPE(LIB, PRIVS, "Privilege information")
-DEFINE_MTYPE(LIB, ZLOG, "Logging")
-DEFINE_MTYPE(LIB, ZCLIENT, "Zclient")
-DEFINE_MTYPE(LIB, WORK_QUEUE, "Work queue")
-DEFINE_MTYPE(LIB, WORK_QUEUE_ITEM, "Work queue item")
-DEFINE_MTYPE(LIB, WORK_QUEUE_NAME, "Work queue name string")
-DEFINE_MTYPE(LIB, PQUEUE, "Priority queue")
-DEFINE_MTYPE(LIB, PQUEUE_DATA, "Priority queue data")
-DEFINE_MTYPE(LIB, HOST, "host configuration")
-DEFINE_MTYPE(LIB, BFD_INFO, "BFD info")
-DEFINE_MTYPE(LIB, VRF, "VRF")
-DEFINE_MTYPE(LIB, VRF_NAME, "VRF name")
-DEFINE_MTYPE(LIB, VRF_BITMAP, "VRF bit-map")
-DEFINE_MTYPE(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
-DEFINE_MTYPE(LIB, NS, "Logical-Router")
-DEFINE_MTYPE(LIB, NS_NAME, "Logical-Router Name")
-DEFINE_MTYPE(LIB, NS_BITMAP, "Logical-Router bit-map")
-
-
-
-DEFINE_MGROUP(ZEBRA, "zebra")
-DEFINE_MTYPE(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
-DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
-DEFINE_MTYPE(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
-DEFINE_MTYPE(ZEBRA, NEXTHOP, "Nexthop")
-DEFINE_MTYPE(ZEBRA, RIB, "RIB")
-DEFINE_MTYPE(ZEBRA, RIB_QUEUE, "RIB process work queue")
-DEFINE_MTYPE(ZEBRA, STATIC_ROUTE, "Static route")
-DEFINE_MTYPE(ZEBRA, RIB_DEST, "RIB destination")
-DEFINE_MTYPE(ZEBRA, RIB_TABLE_INFO, "RIB table info")
-DEFINE_MTYPE(ZEBRA, RNH, "Nexthop tracking object")
-DEFINE_MTYPE(ZEBRA, NETLINK_NAME, "Netlink name")
-
-
-
-DEFINE_MGROUP(BGPD, "bgpd")
-DEFINE_MTYPE(BGPD, BGP, "BGP instance")
-DEFINE_MTYPE(BGPD, BGP_LISTENER, "BGP listen socket details")
-DEFINE_MTYPE(BGPD, BGP_PEER, "BGP peer")
-DEFINE_MTYPE(BGPD, BGP_PEER_HOST, "BGP peer hostname")
-DEFINE_MTYPE(BGPD, BGP_PEER_IFNAME, "BGP peer ifname")
-DEFINE_MTYPE(BGPD, PEER_GROUP, "Peer group")
-DEFINE_MTYPE(BGPD, PEER_GROUP_HOST, "BGP Peer group hostname")
-DEFINE_MTYPE(BGPD, PEER_DESC, "Peer description")
-DEFINE_MTYPE(BGPD, PEER_PASSWORD, "Peer password string")
-DEFINE_MTYPE(BGPD, BGP_PEER_AF, "BGP peer af")
-DEFINE_MTYPE(BGPD, BGP_UPDGRP, "BGP update group")
-DEFINE_MTYPE(BGPD, BGP_UPD_SUBGRP, "BGP update subgroup")
-DEFINE_MTYPE(BGPD, BGP_PACKET, "BGP packet")
-DEFINE_MTYPE(BGPD, ATTR, "BGP attribute")
-DEFINE_MTYPE(BGPD, ATTR_EXTRA, "BGP extra attributes")
-DEFINE_MTYPE(BGPD, AS_PATH, "BGP aspath")
-DEFINE_MTYPE(BGPD, AS_SEG, "BGP aspath seg")
-DEFINE_MTYPE(BGPD, AS_SEG_DATA, "BGP aspath segment data")
-DEFINE_MTYPE(BGPD, AS_STR, "BGP aspath str")
-
-DEFINE_MTYPE(BGPD, BGP_TABLE, "BGP table")
-DEFINE_MTYPE(BGPD, BGP_NODE, "BGP node")
-DEFINE_MTYPE(BGPD, BGP_ROUTE, "BGP route")
-DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA, "BGP ancillary route info")
-DEFINE_MTYPE(BGPD, BGP_CONN, "BGP connected")
-DEFINE_MTYPE(BGPD, BGP_STATIC, "BGP static")
-DEFINE_MTYPE(BGPD, BGP_ADVERTISE_ATTR, "BGP adv attr")
-DEFINE_MTYPE(BGPD, BGP_ADVERTISE, "BGP adv")
-DEFINE_MTYPE(BGPD, BGP_SYNCHRONISE, "BGP synchronise")
-DEFINE_MTYPE(BGPD, BGP_ADJ_IN, "BGP adj in")
-DEFINE_MTYPE(BGPD, BGP_ADJ_OUT, "BGP adj out")
-DEFINE_MTYPE(BGPD, BGP_MPATH_INFO, "BGP multipath info")
-
-DEFINE_MTYPE(BGPD, AS_LIST, "BGP AS list")
-DEFINE_MTYPE(BGPD, AS_FILTER, "BGP AS filter")
-DEFINE_MTYPE(BGPD, AS_FILTER_STR, "BGP AS filter str")
-
-DEFINE_MTYPE(BGPD, COMMUNITY, "community")
-DEFINE_MTYPE(BGPD, COMMUNITY_VAL, "community val")
-DEFINE_MTYPE(BGPD, COMMUNITY_STR, "community str")
-
-DEFINE_MTYPE(BGPD, ECOMMUNITY, "extcommunity")
-DEFINE_MTYPE(BGPD, ECOMMUNITY_VAL, "extcommunity val")
-DEFINE_MTYPE(BGPD, ECOMMUNITY_STR, "extcommunity str")
-
-DEFINE_MTYPE(BGPD, COMMUNITY_LIST, "community-list")
-DEFINE_MTYPE(BGPD, COMMUNITY_LIST_NAME, "community-list name")
-DEFINE_MTYPE(BGPD, COMMUNITY_LIST_ENTRY, "community-list entry")
-DEFINE_MTYPE(BGPD, COMMUNITY_LIST_CONFIG, "community-list config")
-DEFINE_MTYPE(BGPD, COMMUNITY_LIST_HANDLER, "community-list handler")
-
-DEFINE_MTYPE(BGPD, CLUSTER, "Cluster list")
-DEFINE_MTYPE(BGPD, CLUSTER_VAL, "Cluster list val")
-
-DEFINE_MTYPE(BGPD, BGP_PROCESS_QUEUE, "BGP Process queue")
-DEFINE_MTYPE(BGPD, BGP_CLEAR_NODE_QUEUE, "BGP node clear queue")
-
-DEFINE_MTYPE(BGPD, TRANSIT, "BGP transit attr")
-DEFINE_MTYPE(BGPD, TRANSIT_VAL, "BGP transit val")
-
-DEFINE_MTYPE(BGPD, BGP_DEBUG_FILTER, "BGP debug filter")
-DEFINE_MTYPE(BGPD, BGP_DEBUG_STR, "BGP debug filter string")
-
-DEFINE_MTYPE(BGPD, BGP_DISTANCE, "BGP distance")
-DEFINE_MTYPE(BGPD, BGP_NEXTHOP_CACHE, "BGP nexthop")
-DEFINE_MTYPE(BGPD, BGP_CONFED_LIST, "BGP confed list")
-DEFINE_MTYPE(BGPD, PEER_UPDATE_SOURCE, "BGP peer update interface")
-DEFINE_MTYPE(BGPD, PEER_CONF_IF, "BGP peer config interface")
-DEFINE_MTYPE(BGPD, BGP_DAMP_INFO, "Dampening info")
-DEFINE_MTYPE(BGPD, BGP_DAMP_ARRAY, "BGP Dampening array")
-DEFINE_MTYPE(BGPD, BGP_REGEXP, "BGP regexp")
-DEFINE_MTYPE(BGPD, BGP_AGGREGATE, "BGP aggregate")
-DEFINE_MTYPE(BGPD, BGP_ADDR, "BGP own address")
-
-DEFINE_MTYPE(BGPD, BGP_REDIST, "BGP redistribution")
-DEFINE_MTYPE(BGPD, BGP_FILTER_NAME, "BGP Filter Information")
-DEFINE_MTYPE(BGPD, BGP_DUMP_STR, "BGP Dump String Information")
-DEFINE_MTYPE(BGPD, ENCAP_TLV, "ENCAP TLV")
-
-
-
-DEFINE_MGROUP(RIPD, "ripd")
-DEFINE_MTYPE(RIPD, RIP, "RIP structure")
-DEFINE_MTYPE(RIPD, RIP_INFO, "RIP route info")
-DEFINE_MTYPE(RIPD, RIP_INTERFACE, "RIP interface")
-DEFINE_MTYPE(RIPD, RIP_PEER, "RIP peer")
-DEFINE_MTYPE(RIPD, RIP_OFFSET_LIST, "RIP offset list")
-DEFINE_MTYPE(RIPD, RIP_DISTANCE, "RIP distance")
-
-
-
-DEFINE_MGROUP(RIPNGD, "ripngd")
-DEFINE_MTYPE(RIPNGD, RIPNG, "RIPng structure")
-DEFINE_MTYPE(RIPNGD, RIPNG_ROUTE, "RIPng route info")
-DEFINE_MTYPE(RIPNGD, RIPNG_AGGREGATE, "RIPng aggregate")
-DEFINE_MTYPE(RIPNGD, RIPNG_PEER, "RIPng peer")
-DEFINE_MTYPE(RIPNGD, RIPNG_OFFSET_LIST, "RIPng offset lst")
-DEFINE_MTYPE(RIPNGD, RIPNG_RTE_DATA, "RIPng rte data")
-
-
-
-DEFINE_MGROUP(OSPFD, "ospfd")
-DEFINE_MTYPE(OSPFD, OSPF_TOP, "OSPF top")
-DEFINE_MTYPE(OSPFD, OSPF_AREA, "OSPF area")
-DEFINE_MTYPE(OSPFD, OSPF_AREA_RANGE, "OSPF area range")
-DEFINE_MTYPE(OSPFD, OSPF_NETWORK, "OSPF network")
-DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR_STATIC, "OSPF static nbr")
-DEFINE_MTYPE(OSPFD, OSPF_IF, "OSPF interface")
-DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR, "OSPF neighbor")
-DEFINE_MTYPE(OSPFD, OSPF_ROUTE, "OSPF route")
-DEFINE_MTYPE(OSPFD, OSPF_TMP, "OSPF tmp mem")
-DEFINE_MTYPE(OSPFD, OSPF_LSA, "OSPF LSA")
-DEFINE_MTYPE(OSPFD, OSPF_LSA_DATA, "OSPF LSA data")
-DEFINE_MTYPE(OSPFD, OSPF_LSDB, "OSPF LSDB")
-DEFINE_MTYPE(OSPFD, OSPF_PACKET, "OSPF packet")
-DEFINE_MTYPE(OSPFD, OSPF_FIFO, "OSPF FIFO queue")
-DEFINE_MTYPE(OSPFD, OSPF_VERTEX, "OSPF vertex")
-DEFINE_MTYPE(OSPFD, OSPF_VERTEX_PARENT, "OSPF vertex parent")
-DEFINE_MTYPE(OSPFD, OSPF_NEXTHOP, "OSPF nexthop")
-DEFINE_MTYPE(OSPFD, OSPF_PATH, "OSPF path")
-DEFINE_MTYPE(OSPFD, OSPF_VL_DATA, "OSPF VL data")
-DEFINE_MTYPE(OSPFD, OSPF_CRYPT_KEY, "OSPF crypt key")
-DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_INFO, "OSPF ext. info")
-DEFINE_MTYPE(OSPFD, OSPF_DISTANCE, "OSPF distance")
-DEFINE_MTYPE(OSPFD, OSPF_IF_INFO, "OSPF if info")
-DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params")
-DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message")
-DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters")
-DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters")
-
-
-
-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_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_OTHER, "OSPF6 other")
-
-
-
-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_AREA, "ISIS area")
-DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address")
-DEFINE_MTYPE(ISISD, ISIS_TLV, "ISIS TLV")
-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_NEXTHOP6, "ISIS nexthop6")
-DEFINE_MTYPE(ISISD, ISIS_DICT, "ISIS dictionary")
-DEFINE_MTYPE(ISISD, ISIS_DICT_NODE, "ISIS dictionary node")
-DEFINE_MTYPE(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters")
-
-
-
-DEFINE_MGROUP(PIMD, "pimd")
-DEFINE_MTYPE(PIMD, PIM_CHANNEL_OIL, "PIM SSM (S,G) channel OIL")
-DEFINE_MTYPE(PIMD, PIM_INTERFACE, "PIM interface")
-DEFINE_MTYPE(PIMD, PIM_IGMP_JOIN, "PIM interface IGMP static join")
-DEFINE_MTYPE(PIMD, PIM_IGMP_SOCKET, "PIM interface IGMP socket")
-DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP, "PIM interface IGMP group")
-DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP_SOURCE, "PIM interface IGMP source")
-DEFINE_MTYPE(PIMD, PIM_NEIGHBOR, "PIM interface neighbor")
-DEFINE_MTYPE(PIMD, PIM_IFCHANNEL, "PIM interface (S,G) state")
-DEFINE_MTYPE(PIMD, PIM_UPSTREAM, "PIM upstream (S,G) state")
-DEFINE_MTYPE(PIMD, PIM_SSMPINGD, "PIM sspimgd socket")
-DEFINE_MTYPE(PIMD, PIM_STATIC_ROUTE, "PIM Static Route")
-DEFINE_MTYPE(PIMD, PIM_BR, "PIM Bridge Router info")
-
-
-
-DEFINE_MGROUP(MVTYSH, "vtysh")
-DEFINE_MTYPE(MVTYSH, VTYSH_CONFIG, "Vtysh configuration")
-DEFINE_MTYPE(MVTYSH, VTYSH_CONFIG_LINE, "Vtysh configuration line")
diff --git a/lib/memtypes.pl b/lib/memtypes.pl
deleted file mode 100755
index 0955161b1..000000000
--- a/lib/memtypes.pl
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/perl
-while (<STDIN>) {
- $_ =~ s/DEFINE_MTYPE\([^,]+,\s*([^,]+)\s*,.*\)/DECLARE_MTYPE\($1\)/;
- $_ =~ s/DEFINE_MGROUP\(([^,]+),.*\)/DECLARE_MGROUP\($1\)/;
- print $_;
-}
diff --git a/lib/nexthop.c b/lib/nexthop.c
index 14486ea15..427f77f87 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -33,6 +33,8 @@
#include "prefix.h"
#include "nexthop.h"
+DEFINE_MTYPE_STATIC(LIB, NEXTHOP, "Nexthop")
+
/* check if nexthops are same, non-recursive */
int
nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2)
diff --git a/lib/ns.c b/lib/ns.c
index 4765a18ef..556350ed1 100644
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -39,6 +39,9 @@
#include "command.h"
#include "vty.h"
+DEFINE_MTYPE_STATIC(LIB, NS, "Logical-Router")
+DEFINE_MTYPE_STATIC(LIB, NS_NAME, "Logical-Router Name")
+DEFINE_MTYPE_STATIC(LIB, NS_BITMAP, "Logical-Router bit-map")
#ifndef CLONE_NEWNET
#define CLONE_NEWNET 0x40000000 /* New network namespace (lo, device, names sockets, etc) */
diff --git a/lib/plist.c b/lib/plist.c
index 7bb80fa2a..eedb830c1 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -34,6 +34,11 @@
#include "plist_int.h"
+DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST, "Prefix List")
+DEFINE_MTYPE_STATIC(LIB, MPREFIX_LIST_STR, "Prefix List Str")
+DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_ENTRY, "Prefix List Entry")
+DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_TRIE, "Prefix List Trie Table")
+
/* not currently changeable, code assumes bytes further down */
#define PLC_BITS 8
#define PLC_LEN (1 << PLC_BITS)
@@ -236,7 +241,7 @@ prefix_list_insert (afi_t afi, int orf, const char *name)
/* Allocate new prefix_list and copy given name. */
plist = prefix_list_new ();
- plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name);
+ plist->name = XSTRDUP (MTYPE_MPREFIX_LIST_STR, name);
plist->master = master;
plist->trie = XCALLOC (MTYPE_PREFIX_LIST_TRIE, sizeof (struct pltrie_table));
@@ -370,7 +375,7 @@ prefix_list_delete (struct prefix_list *plist)
(*master->delete_hook) (plist);
if (plist->name)
- XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
+ XFREE (MTYPE_MPREFIX_LIST_STR, plist->name);
XFREE (MTYPE_PREFIX_LIST_TRIE, plist->trie);
diff --git a/lib/pqueue.c b/lib/pqueue.c
index 69ab8e65d..0f870564d 100644
--- a/lib/pqueue.c
+++ b/lib/pqueue.c
@@ -23,6 +23,9 @@ Boston, MA 02111-1307, USA. */
#include "memory.h"
#include "pqueue.h"
+DEFINE_MTYPE_STATIC(LIB, PQUEUE, "Priority queue")
+DEFINE_MTYPE_STATIC(LIB, PQUEUE_DATA, "Priority queue data")
+
/* priority queue using heap sort */
/* pqueue->cmp() controls the order of sorting (i.e, ascending or
diff --git a/lib/prefix.c b/lib/prefix.c
index d2bb02831..34bb1a493 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -28,6 +28,8 @@
#include "memory.h"
#include "log.h"
+DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix")
+
/* Maskbit. */
static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
0xf8, 0xfc, 0xfe, 0xff};
diff --git a/lib/privs.c b/lib/privs.c
index 3fb96aed1..9228a56d3 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -27,6 +27,9 @@
#include "memory.h"
#ifdef HAVE_CAPABILITIES
+
+DEFINE_MTYPE_STATIC(LIB, PRIVS, "Privilege information")
+
/* sort out some generic internal types for:
*
* privilege values (cap_value_t, priv_t) -> pvalue_t
diff --git a/lib/routemap.c b/lib/routemap.c
index 9267056df..10e5ed304 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -30,6 +30,14 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "log.h"
#include "hash.h"
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map")
+DEFINE_MTYPE( LIB, ROUTE_MAP_NAME, "Route map name")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index")
+DEFINE_MTYPE( LIB, ROUTE_MAP_RULE, "Route map rule")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_RULE_STR, "Route map rule str")
+DEFINE_MTYPE( LIB, ROUTE_MAP_COMPILED, "Route map compiled")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_DEP, "Route map dependency")
+
/* Vector for route match rules. */
static vector route_match_vec;
diff --git a/lib/routemap.h b/lib/routemap.h
index f5981a87f..7006e43f6 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -23,6 +23,10 @@
#define _ZEBRA_ROUTEMAP_H
#include "prefix.h"
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_MAP_NAME)
+DECLARE_MTYPE(ROUTE_MAP_RULE)
+DECLARE_MTYPE(ROUTE_MAP_COMPILED)
/* Route map's type. */
enum route_map_type
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 9184e500f..96408965a 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -29,6 +29,8 @@
#include "log.h"
#include "jhash.h"
+DEFINE_MTYPE_STATIC(LIB, SOCKUNION, "Socket union")
+
#ifndef HAVE_INET_ATON
int
inet_aton (const char *cp, struct in_addr *inaddr)
diff --git a/lib/stream.c b/lib/stream.c
index 809e749fb..301ebc627 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -29,6 +29,10 @@
#include "prefix.h"
#include "log.h"
+DEFINE_MTYPE_STATIC(LIB, STREAM, "Stream")
+DEFINE_MTYPE_STATIC(LIB, STREAM_DATA, "Stream data")
+DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
+
/* Tests whether a position is valid */
#define GETP_VALID(S,G) \
((G) <= (S)->endp)
diff --git a/lib/table.c b/lib/table.c
index da2136168..8858aea0f 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -27,6 +27,9 @@
#include "memory.h"
#include "sockunion.h"
+DEFINE_MTYPE( LIB, ROUTE_TABLE, "Route table")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_NODE, "Route node")
+
static void route_node_delete (struct route_node *);
static void route_table_free (struct route_table *);
diff --git a/lib/table.h b/lib/table.h
index 2ffd79b53..34c196aa4 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -23,6 +23,9 @@
#ifndef _ZEBRA_TABLE_H
#define _ZEBRA_TABLE_H
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_TABLE)
+
/*
* Forward declarations.
*/
diff --git a/lib/thread.c b/lib/thread.c
index 573e9f725..a26eb6bfd 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -32,6 +32,10 @@
#include "command.h"
#include "sigevent.h"
+DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread")
+DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master")
+DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats")
+
#if defined(__APPLE__)
#include <mach/mach.h>
#include <mach/mach_time.h>
diff --git a/lib/vector.c b/lib/vector.c
index 7c1486285..03ad3171d 100644
--- a/lib/vector.c
+++ b/lib/vector.c
@@ -24,6 +24,9 @@
#include "vector.h"
#include "memory.h"
+DEFINE_MTYPE_STATIC(LIB, VECTOR, "Vector")
+DEFINE_MTYPE( LIB, VECTOR_INDEX, "Vector index")
+
/* Initialize vector : allocate memory and return vector. */
vector
vector_init (unsigned int size)
diff --git a/lib/vector.h b/lib/vector.h
index 6b27fd96d..d8f4c7860 100644
--- a/lib/vector.h
+++ b/lib/vector.h
@@ -23,6 +23,9 @@
#ifndef _ZEBRA_VECTOR_H
#define _ZEBRA_VECTOR_H
+#include "memory.h"
+DECLARE_MTYPE(VECTOR_INDEX)
+
/* struct for vector */
struct _vector
{
diff --git a/lib/vrf.c b/lib/vrf.c
index bffcbca54..7d79b3dc9 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -30,6 +30,9 @@
#include "memory.h"
#include "command.h"
+DEFINE_MTYPE_STATIC(LIB, VRF, "VRF")
+DEFINE_MTYPE_STATIC(LIB, VRF_BITMAP, "VRF bit-map")
+
/*
* Turn on/off debug code
* for vrf.
diff --git a/lib/vty.c b/lib/vty.c
index 831ae8e55..48b64a95c 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -40,6 +40,10 @@
#include <arpa/telnet.h>
#include <termios.h>
+DEFINE_MTYPE_STATIC(LIB, VTY, "VTY")
+DEFINE_MTYPE_STATIC(LIB, VTY_OUT_BUF, "VTY output buffer")
+DEFINE_MTYPE_STATIC(LIB, VTY_HIST, "VTY history")
+
/* Vty events */
enum event
{
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 772749403..549bb2360 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -29,6 +29,10 @@
#include "command.h"
#include "log.h"
+DEFINE_MTYPE(LIB, WORK_QUEUE, "Work queue")
+DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_ITEM, "Work queue item")
+DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_NAME, "Work queue name string")
+
/* master list of work_queues */
static struct list _work_queues;
/* pointer primarily to avoid an otherwise harmless warning on
diff --git a/lib/workqueue.h b/lib/workqueue.h
index 19b44041d..eaf857490 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -24,6 +24,9 @@
#ifndef _QUAGGA_WORK_QUEUE_H
#define _QUAGGA_WORK_QUEUE_H
+#include "memory.h"
+DECLARE_MTYPE(WORK_QUEUE)
+
/* Hold time for the initial schedule of a queue run, in millisec */
#define WORK_QUEUE_DEFAULT_HOLD 50
diff --git a/lib/zclient.c b/lib/zclient.c
index 753954fd8..057fa7758 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -34,6 +34,8 @@
#include "table.h"
#include "nexthop.h"
+DEFINE_MTYPE_STATIC(LIB, ZCLIENT, "Zclient")
+
/* Zebra client events. */
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am
index f4181167e..7551503da 100644
--- a/ospf6d/Makefile.am
+++ b/ospf6d/Makefile.am
@@ -10,6 +10,7 @@ noinst_LIBRARIES = libospf6.a
sbin_PROGRAMS = ospf6d
libospf6_a_SOURCES = \
+ ospf6_memory.c \
ospf6_network.c ospf6_message.c ospf6_lsa.c ospf6_lsdb.c \
ospf6_top.c ospf6_area.c ospf6_interface.c ospf6_neighbor.c \
ospf6_flood.c ospf6_route.c ospf6_intra.c ospf6_zebra.c \
@@ -17,6 +18,7 @@ libospf6_a_SOURCES = \
ospf6d.c ospf6_bfd.c
noinst_HEADERS = \
+ ospf6_memory.h \
ospf6_network.h ospf6_message.h ospf6_lsa.h ospf6_lsdb.h \
ospf6_top.h ospf6_area.h ospf6_interface.h ospf6_neighbor.h \
ospf6_flood.h ospf6_route.h ospf6_intra.h ospf6_zebra.h \
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index f24ec46da..f4835d053 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -45,6 +45,8 @@
#include "ospf6d.h"
#include "ospf6_bfd.h"
+DEFINE_MTYPE_STATIC(OSPF6D, CFG_PLIST_NAME, "configured prefix list names")
+
unsigned char conf_debug_ospf6_interface = 0;
const char *ospf6_interface_state_str[] =
@@ -262,7 +264,7 @@ ospf6_interface_delete (struct ospf6_interface *oi)
/* plist_name */
if (oi->plist_name)
- XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
+ XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
ospf6_bfd_info_free(&(oi->bfd_info));
@@ -1668,8 +1670,8 @@ DEFUN (ipv6_ospf6_advertise_prefix_list,
assert (oi);
if (oi->plist_name)
- XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
- oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]);
+ XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
+ oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[0]);
ospf6_interface_connected_route_update (oi->interface);
@@ -1710,7 +1712,7 @@ DEFUN (no_ipv6_ospf6_advertise_prefix_list,
if (oi->plist_name)
{
- XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
+ XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
oi->plist_name = NULL;
}
diff --git a/ospf6d/ospf6_memory.c b/ospf6d/ospf6_memory.c
new file mode 100644
index 000000000..7f2fbbf0b
--- /dev/null
+++ b/ospf6d/ospf6_memory.c
@@ -0,0 +1,44 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, 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_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_OTHER, "OSPF6 other")
diff --git a/ospf6d/ospf6_memory.h b/ospf6d/ospf6_memory.h
new file mode 100644
index 000000000..3ff5de4c3
--- /dev/null
+++ b/ospf6d/ospf6_memory.h
@@ -0,0 +1,45 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, 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_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_OTHER)
+
+#endif /* _QUAGGA_OSPF6_MEMORY_H */
diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h
index 9e2efb41d..b41e8ff00 100644
--- a/ospf6d/ospf6d.h
+++ b/ospf6d/ospf6d.h
@@ -27,6 +27,8 @@
#include "libospf.h"
#include "thread.h"
+#include "ospf6_memory.h"
+
/* global variables */
extern struct thread_master *master;
diff --git a/ospfd/Makefile.am b/ospfd/Makefile.am
index 55f9bf2d8..62db350c5 100644
--- a/ospfd/Makefile.am
+++ b/ospfd/Makefile.am
@@ -17,7 +17,7 @@ libospf_la_SOURCES = \
ospf_spf.c ospf_route.c ospf_ase.c ospf_abr.c ospf_ia.c ospf_flood.c \
ospf_lsdb.c ospf_asbr.c ospf_routemap.c ospf_snmp.c \
ospf_opaque.c ospf_te.c ospf_ri.c ospf_vty.c ospf_api.c ospf_apiserver.c \
- ospf_bfd.c
+ ospf_bfd.c ospf_memory.c
ospfdheaderdir = $(pkgincludedir)/ospfd
@@ -29,7 +29,7 @@ noinst_HEADERS = \
ospf_interface.h ospf_neighbor.h ospf_network.h ospf_packet.h \
ospf_zebra.h ospf_spf.h ospf_route.h ospf_ase.h ospf_abr.h ospf_ia.h \
ospf_flood.h ospf_snmp.h ospf_te.h ospf_ri.h ospf_vty.h ospf_apiserver.h \
- ospf_bfd.h
+ ospf_bfd.h ospf_memory.h
ospfd_SOURCES = ospf_main.c
diff --git a/ospfd/ospf_memory.c b/ospfd/ospf_memory.c
new file mode 100644
index 000000000..0181e1e1f
--- /dev/null
+++ b/ospfd/ospf_memory.c
@@ -0,0 +1,56 @@
+/* ospfd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ospf_memory.h"
+
+DEFINE_MGROUP(OSPFD, "ospfd")
+DEFINE_MTYPE(OSPFD, OSPF_TOP, "OSPF top")
+DEFINE_MTYPE(OSPFD, OSPF_AREA, "OSPF area")
+DEFINE_MTYPE(OSPFD, OSPF_AREA_RANGE, "OSPF area range")
+DEFINE_MTYPE(OSPFD, OSPF_NETWORK, "OSPF network")
+DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR_STATIC, "OSPF static nbr")
+DEFINE_MTYPE(OSPFD, OSPF_IF, "OSPF interface")
+DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR, "OSPF neighbor")
+DEFINE_MTYPE(OSPFD, OSPF_ROUTE, "OSPF route")
+DEFINE_MTYPE(OSPFD, OSPF_TMP, "OSPF tmp mem")
+DEFINE_MTYPE(OSPFD, OSPF_LSA, "OSPF LSA")
+DEFINE_MTYPE(OSPFD, OSPF_LSA_DATA, "OSPF LSA data")
+DEFINE_MTYPE(OSPFD, OSPF_LSDB, "OSPF LSDB")
+DEFINE_MTYPE(OSPFD, OSPF_PACKET, "OSPF packet")
+DEFINE_MTYPE(OSPFD, OSPF_FIFO, "OSPF FIFO queue")
+DEFINE_MTYPE(OSPFD, OSPF_VERTEX, "OSPF vertex")
+DEFINE_MTYPE(OSPFD, OSPF_VERTEX_PARENT, "OSPF vertex parent")
+DEFINE_MTYPE(OSPFD, OSPF_NEXTHOP, "OSPF nexthop")
+DEFINE_MTYPE(OSPFD, OSPF_PATH, "OSPF path")
+DEFINE_MTYPE(OSPFD, OSPF_VL_DATA, "OSPF VL data")
+DEFINE_MTYPE(OSPFD, OSPF_CRYPT_KEY, "OSPF crypt key")
+DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_INFO, "OSPF ext. info")
+DEFINE_MTYPE(OSPFD, OSPF_DISTANCE, "OSPF distance")
+DEFINE_MTYPE(OSPFD, OSPF_IF_INFO, "OSPF if info")
+DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params")
+DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message")
+DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters")
+DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters")
diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h
new file mode 100644
index 000000000..b082c9503
--- /dev/null
+++ b/ospfd/ospf_memory.h
@@ -0,0 +1,57 @@
+/* ospfd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_OSPF_MEMORY_H
+#define _QUAGGA_OSPF_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(OSPFD)
+DECLARE_MTYPE(OSPF_TOP)
+DECLARE_MTYPE(OSPF_AREA)
+DECLARE_MTYPE(OSPF_AREA_RANGE)
+DECLARE_MTYPE(OSPF_NETWORK)
+DECLARE_MTYPE(OSPF_NEIGHBOR_STATIC)
+DECLARE_MTYPE(OSPF_IF)
+DECLARE_MTYPE(OSPF_NEIGHBOR)
+DECLARE_MTYPE(OSPF_ROUTE)
+DECLARE_MTYPE(OSPF_TMP)
+DECLARE_MTYPE(OSPF_LSA)
+DECLARE_MTYPE(OSPF_LSA_DATA)
+DECLARE_MTYPE(OSPF_LSDB)
+DECLARE_MTYPE(OSPF_PACKET)
+DECLARE_MTYPE(OSPF_FIFO)
+DECLARE_MTYPE(OSPF_VERTEX)
+DECLARE_MTYPE(OSPF_VERTEX_PARENT)
+DECLARE_MTYPE(OSPF_NEXTHOP)
+DECLARE_MTYPE(OSPF_PATH)
+DECLARE_MTYPE(OSPF_VL_DATA)
+DECLARE_MTYPE(OSPF_CRYPT_KEY)
+DECLARE_MTYPE(OSPF_EXTERNAL_INFO)
+DECLARE_MTYPE(OSPF_DISTANCE)
+DECLARE_MTYPE(OSPF_IF_INFO)
+DECLARE_MTYPE(OSPF_IF_PARAMS)
+DECLARE_MTYPE(OSPF_MESSAGE)
+DECLARE_MTYPE(OSPF_MPLS_TE)
+DECLARE_MTYPE(OSPF_PCE_PARAMS)
+
+#endif /* _QUAGGA_OSPF_MEMORY_H */
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index e6e296f8a..c118e46c5 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -63,8 +63,6 @@
#include "ospfd/ospf_te.h"
#include "ospfd/ospf_vty.h"
-DEFINE_MTYPE_STATIC(OSPFD, OSPF_MPLS_TE_LINKPARAMS, "OSPF MPLS-TE link parameters")
-
/*
* Global variable to manage Opaque-LSA/MPLS-TE on this node.
* Note that all parameter values are stored in network byte order.
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index af238c53a..bc4acf993 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -29,6 +29,8 @@
#include "filter.h"
#include "log.h"
+#include "ospf_memory.h"
+
#define OSPF_VERSION 2
/* VTY port number. */
diff --git a/pimd/Makefile.am b/pimd/Makefile.am
index d578c9736..eba05076d 100644
--- a/pimd/Makefile.am
+++ b/pimd/Makefile.am
@@ -46,6 +46,7 @@ sbin_PROGRAMS = pimd
noinst_PROGRAMS = test_igmpv3_join
libpim_a_SOURCES = \
+ pim_memory.c \
pimd.c pim_version.c pim_cmd.c pim_signals.c pim_iface.c \
pim_vty.c pim_igmp.c pim_sock.c pim_zebra.c \
pim_igmpv3.c pim_str.c pim_mroute.c pim_util.c pim_time.c \
@@ -56,6 +57,7 @@ libpim_a_SOURCES = \
pim_static.c pim_br.c pim_register.c pim_routemap.c
noinst_HEADERS = \
+ pim_memory.h \
pimd.h pim_version.h pim_cmd.h pim_signals.h pim_iface.h \
pim_vty.h pim_igmp.h pim_sock.h pim_zebra.h \
pim_igmpv3.h pim_str.h pim_mroute.h pim_util.h pim_time.h \
diff --git a/pimd/pim_memory.c b/pimd/pim_memory.c
new file mode 100644
index 000000000..601472502
--- /dev/null
+++ b/pimd/pim_memory.c
@@ -0,0 +1,41 @@
+/* pimd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pim_memory.h"
+
+DEFINE_MGROUP(PIMD, "pimd")
+DEFINE_MTYPE(PIMD, PIM_CHANNEL_OIL, "PIM SSM (S,G) channel OIL")
+DEFINE_MTYPE(PIMD, PIM_INTERFACE, "PIM interface")
+DEFINE_MTYPE(PIMD, PIM_IGMP_JOIN, "PIM interface IGMP static join")
+DEFINE_MTYPE(PIMD, PIM_IGMP_SOCKET, "PIM interface IGMP socket")
+DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP, "PIM interface IGMP group")
+DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP_SOURCE, "PIM interface IGMP source")
+DEFINE_MTYPE(PIMD, PIM_NEIGHBOR, "PIM interface neighbor")
+DEFINE_MTYPE(PIMD, PIM_IFCHANNEL, "PIM interface (S,G) state")
+DEFINE_MTYPE(PIMD, PIM_UPSTREAM, "PIM upstream (S,G) state")
+DEFINE_MTYPE(PIMD, PIM_SSMPINGD, "PIM sspimgd socket")
+DEFINE_MTYPE(PIMD, PIM_STATIC_ROUTE, "PIM Static Route")
+DEFINE_MTYPE(PIMD, PIM_BR, "PIM Bridge Router info")
diff --git a/pimd/pim_memory.h b/pimd/pim_memory.h
new file mode 100644
index 000000000..81841e58b
--- /dev/null
+++ b/pimd/pim_memory.h
@@ -0,0 +1,42 @@
+/* pimd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_PIM_MEMORY_H
+#define _QUAGGA_PIM_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(PIMD)
+DECLARE_MTYPE(PIM_CHANNEL_OIL)
+DECLARE_MTYPE(PIM_INTERFACE)
+DECLARE_MTYPE(PIM_IGMP_JOIN)
+DECLARE_MTYPE(PIM_IGMP_SOCKET)
+DECLARE_MTYPE(PIM_IGMP_GROUP)
+DECLARE_MTYPE(PIM_IGMP_GROUP_SOURCE)
+DECLARE_MTYPE(PIM_NEIGHBOR)
+DECLARE_MTYPE(PIM_IFCHANNEL)
+DECLARE_MTYPE(PIM_UPSTREAM)
+DECLARE_MTYPE(PIM_SSMPINGD)
+DECLARE_MTYPE(PIM_STATIC_ROUTE)
+DECLARE_MTYPE(PIM_BR)
+
+#endif /* _QUAGGA_PIM_MEMORY_H */
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 6d48d8362..8855a2ab3 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -25,6 +25,7 @@
#include <stdint.h>
+#include "pim_memory.h"
#include "pim_assert.h"
#define PIMD_PROGNAME "pimd"
diff --git a/ripd/Makefile.am b/ripd/Makefile.am
index 571a4993d..e7073a790 100644
--- a/ripd/Makefile.am
+++ b/ripd/Makefile.am
@@ -10,10 +10,12 @@ noinst_LIBRARIES = librip.a
sbin_PROGRAMS = ripd
librip_a_SOURCES = \
+ rip_memory.c \
ripd.c rip_zebra.c rip_interface.c rip_debug.c rip_snmp.c \
rip_routemap.c rip_peer.c rip_offset.c
noinst_HEADERS = \
+ rip_memory.h \
ripd.h rip_debug.h rip_interface.h
ripd_SOURCES = \
diff --git a/ripd/rip_memory.c b/ripd/rip_memory.c
new file mode 100644
index 000000000..d2a958064
--- /dev/null
+++ b/ripd/rip_memory.c
@@ -0,0 +1,35 @@
+/* ripd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "rip_memory.h"
+
+DEFINE_MGROUP(RIPD, "ripd")
+DEFINE_MTYPE(RIPD, RIP, "RIP structure")
+DEFINE_MTYPE(RIPD, RIP_INFO, "RIP route info")
+DEFINE_MTYPE(RIPD, RIP_INTERFACE, "RIP interface")
+DEFINE_MTYPE(RIPD, RIP_PEER, "RIP peer")
+DEFINE_MTYPE(RIPD, RIP_OFFSET_LIST, "RIP offset list")
+DEFINE_MTYPE(RIPD, RIP_DISTANCE, "RIP distance")
diff --git a/ripd/rip_memory.h b/ripd/rip_memory.h
new file mode 100644
index 000000000..7aec21930
--- /dev/null
+++ b/ripd/rip_memory.h
@@ -0,0 +1,36 @@
+/* ripd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_RIP_MEMORY_H
+#define _QUAGGA_RIP_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(RIPD)
+DECLARE_MTYPE(RIP)
+DECLARE_MTYPE(RIP_INFO)
+DECLARE_MTYPE(RIP_INTERFACE)
+DECLARE_MTYPE(RIP_PEER)
+DECLARE_MTYPE(RIP_OFFSET_LIST)
+DECLARE_MTYPE(RIP_DISTANCE)
+
+#endif /* _QUAGGA_RIP_MEMORY_H */
diff --git a/ripd/ripd.h b/ripd/ripd.h
index d01d0b6bb..7c77b26d4 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -22,6 +22,8 @@
#ifndef _ZEBRA_RIP_H
#define _ZEBRA_RIP_H
+#include "rip_memory.h"
+
/* RIP version number. */
#define RIPv1 1
#define RIPv2 2
diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am
index df0f7d377..c08e58a90 100644
--- a/ripngd/Makefile.am
+++ b/ripngd/Makefile.am
@@ -10,10 +10,12 @@ noinst_LIBRARIES = libripng.a
sbin_PROGRAMS = ripngd
libripng_a_SOURCES = \
+ ripng_memory.c \
ripng_interface.c ripngd.c ripng_zebra.c ripng_route.c ripng_debug.c \
ripng_routemap.c ripng_offset.c ripng_peer.c ripng_nexthop.c
noinst_HEADERS = \
+ ripng_memory.h \
ripng_debug.h ripng_route.h ripngd.h ripng_nexthop.h
ripngd_SOURCES = \
diff --git a/ripngd/ripng_memory.c b/ripngd/ripng_memory.c
new file mode 100644
index 000000000..1d2320ee2
--- /dev/null
+++ b/ripngd/ripng_memory.c
@@ -0,0 +1,35 @@
+/* ripngd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ripng_memory.h"
+
+DEFINE_MGROUP(RIPNGD, "ripngd")
+DEFINE_MTYPE(RIPNGD, RIPNG, "RIPng structure")
+DEFINE_MTYPE(RIPNGD, RIPNG_ROUTE, "RIPng route info")
+DEFINE_MTYPE(RIPNGD, RIPNG_AGGREGATE, "RIPng aggregate")
+DEFINE_MTYPE(RIPNGD, RIPNG_PEER, "RIPng peer")
+DEFINE_MTYPE(RIPNGD, RIPNG_OFFSET_LIST, "RIPng offset lst")
+DEFINE_MTYPE(RIPNGD, RIPNG_RTE_DATA, "RIPng rte data")
diff --git a/ripngd/ripng_memory.h b/ripngd/ripng_memory.h
new file mode 100644
index 000000000..76b830afb
--- /dev/null
+++ b/ripngd/ripng_memory.h
@@ -0,0 +1,36 @@
+/* ripngd 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_RIPNG_MEMORY_H
+#define _QUAGGA_RIPNG_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(RIPNGD)
+DECLARE_MTYPE(RIPNG)
+DECLARE_MTYPE(RIPNG_ROUTE)
+DECLARE_MTYPE(RIPNG_AGGREGATE)
+DECLARE_MTYPE(RIPNG_PEER)
+DECLARE_MTYPE(RIPNG_OFFSET_LIST)
+DECLARE_MTYPE(RIPNG_RTE_DATA)
+
+#endif /* _QUAGGA_RIPNG_MEMORY_H */
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index b87b927f4..5337eb88f 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -26,6 +26,8 @@
#include <zclient.h>
#include <vty.h>
+#include "ripng_memory.h"
+
/* RIPng version and port number. */
#define RIPNG_V1 1
#define RIPNG_PORT_DEFAULT 521
diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c
index 2f133cc5d..2d15dc37b 100644
--- a/tests/heavy-wq.c
+++ b/tests/heavy-wq.c
@@ -38,6 +38,10 @@
#include "tests.h"
+DEFINE_MGROUP(TEST_HEAVYWQ, "heavy-wq test")
+DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE, "heavy_wq_node")
+DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE_STR, "heavy_wq_node->str")
+
extern struct thread_master *master;
static struct work_queue *heavy_wq;
@@ -61,17 +65,17 @@ heavy_wq_add (struct vty *vty, const char *str, int i)
{
struct heavy_wq_node *hn;
- if ((hn = XCALLOC (MTYPE_PREFIX_LIST, sizeof(struct heavy_wq_node))) == NULL)
+ if ((hn = XCALLOC (MTYPE_WQ_NODE, sizeof(struct heavy_wq_node))) == NULL)
{
zlog_err ("%s: unable to allocate hn", __func__);
return;
}
hn->i = i;
- if (!(hn->str = XSTRDUP (MTYPE_PREFIX_LIST_STR, str)))
+ if (!(hn->str = XSTRDUP (MTYPE_WQ_NODE_STR, str)))
{
zlog_err ("%s: unable to xstrdup", __func__);
- XFREE (MTYPE_PREFIX_LIST, hn);
+ XFREE (MTYPE_WQ_NODE, hn);
return;
}
@@ -92,9 +96,9 @@ slow_func_del (struct work_queue *wq, void *data)
struct heavy_wq_node *hn = data;
assert (hn && hn->str);
printf ("%s: %s\n", __func__, hn->str);
- XFREE (MTYPE_PREFIX_LIST_STR, hn->str);
+ XFREE (MTYPE_WQ_NODE_STR, hn->str);
hn->str = NULL;
- XFREE(MTYPE_PREFIX_LIST, hn);
+ XFREE(MTYPE_WQ_NODE, hn);
}
static wq_item_status
diff --git a/tests/test-memory.c b/tests/test-memory.c
index 807249ea6..6849b9dce 100644
--- a/tests/test-memory.c
+++ b/tests/test-memory.c
@@ -20,6 +20,9 @@
#include <zebra.h>
#include <memory.h>
+DEFINE_MGROUP(TEST_MEMORY, "memory test")
+DEFINE_MTYPE_STATIC(TEST_MEMORY, TEST, "generic test mtype")
+
/* Memory torture tests
*
* Tests below are generic but comments are focused on interaction with
@@ -52,28 +55,28 @@ main(int argc, char **argv)
/* simple case, test cache */
for (i = 0; i < TIMES; i++)
{
- a[0] = XMALLOC (MTYPE_VTY, 1024);
+ a[0] = XMALLOC (MTYPE_TEST, 1024);
memset (a[0], 1, 1024);
- a[1] = XMALLOC (MTYPE_VTY, 1024);
+ a[1] = XMALLOC (MTYPE_TEST, 1024);
memset (a[1], 1, 1024);
- XFREE(MTYPE_VTY, a[0]); /* should go to cache */
- a[0] = XMALLOC (MTYPE_VTY, 1024); /* should be satisfied from cache */
- XFREE(MTYPE_VTY, a[0]);
- XFREE(MTYPE_VTY, a[1]);
+ XFREE(MTYPE_TEST, a[0]); /* should go to cache */
+ a[0] = XMALLOC (MTYPE_TEST, 1024); /* should be satisfied from cache */
+ XFREE(MTYPE_TEST, a[0]);
+ XFREE(MTYPE_TEST, a[1]);
}
printf ("malloc x, malloc y, free x, malloc y, free free\n\n");
/* cache should go invalid, valid, invalid, etc.. */
for (i = 0; i < TIMES; i++)
{
- a[0] = XMALLOC (MTYPE_VTY, 512);
+ a[0] = XMALLOC (MTYPE_TEST, 512);
memset (a[0], 1, 512);
- a[1] = XMALLOC (MTYPE_VTY, 1024); /* invalidate cache */
+ a[1] = XMALLOC (MTYPE_TEST, 1024); /* invalidate cache */
memset (a[1], 1, 1024);
- XFREE(MTYPE_VTY, a[0]);
- a[0] = XMALLOC (MTYPE_VTY, 1024);
- XFREE(MTYPE_VTY, a[0]);
- XFREE(MTYPE_VTY, a[1]);
+ XFREE(MTYPE_TEST, a[0]);
+ a[0] = XMALLOC (MTYPE_TEST, 1024);
+ XFREE(MTYPE_TEST, a[0]);
+ XFREE(MTYPE_TEST, a[1]);
/* cache should become valid again on next request */
}
@@ -81,12 +84,12 @@ main(int argc, char **argv)
/* test calloc */
for (i = 0; i < TIMES; i++)
{
- a[0] = XCALLOC (MTYPE_VTY, 1024);
+ a[0] = XCALLOC (MTYPE_TEST, 1024);
memset (a[0], 1, 1024);
- a[1] = XCALLOC (MTYPE_VTY, 512); /* invalidate cache */
+ a[1] = XCALLOC (MTYPE_TEST, 512); /* invalidate cache */
memset (a[1], 1, 512);
- XFREE(MTYPE_VTY, a[1]);
- XFREE(MTYPE_VTY, a[0]);
+ XFREE(MTYPE_TEST, a[1]);
+ XFREE(MTYPE_TEST, a[0]);
/* alloc == 0, cache can become valid again on next request */
}
@@ -95,27 +98,27 @@ main(int argc, char **argv)
for (i = 0; i < TIMES; i++)
{
printf ("calloc a0 1024\n");
- a[0] = XCALLOC (MTYPE_VTY, 1024);
+ a[0] = XCALLOC (MTYPE_TEST, 1024);
memset (a[0], 1, 1024/2);
printf ("calloc 1 1024\n");
- a[1] = XCALLOC (MTYPE_VTY, 1024);
+ a[1] = XCALLOC (MTYPE_TEST, 1024);
memset (a[1], 1, 1024/2);
printf ("realloc 0 1024\n");
- a[3] = XREALLOC (MTYPE_VTY, a[0], 2048); /* invalidate cache */
+ a[3] = XREALLOC (MTYPE_TEST, a[0], 2048); /* invalidate cache */
if (a[3] != NULL)
a[0] = a[3];
memset (a[0], 1, 1024);
printf ("calloc 2 512\n");
- a[2] = XCALLOC (MTYPE_VTY, 512);
+ a[2] = XCALLOC (MTYPE_TEST, 512);
memset (a[2], 1, 512);
printf ("free 1 0 2\n");
- XFREE(MTYPE_VTY, a[1]);
- XFREE(MTYPE_VTY, a[0]);
- XFREE(MTYPE_VTY, a[2]);
+ XFREE(MTYPE_TEST, a[1]);
+ XFREE(MTYPE_TEST, a[0]);
+ XFREE(MTYPE_TEST, a[2]);
/* alloc == 0, cache valid next request */
}
return 0;
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index d01a1bceb..10bdef8cc 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -44,6 +44,8 @@
#include "ns.h"
#include "vrf.h"
+DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
+
/* Struct VTY. */
struct vty *vty;
@@ -561,7 +563,7 @@ vtysh_mark_file (const char *filename)
vtysh_execute_no_pager ("enable");
vtysh_execute_no_pager ("configure terminal");
- vty_buf_copy = XCALLOC (MTYPE_VTY, VTY_BUFSIZ);
+ vty_buf_copy = XCALLOC (MTYPE_VTYSH_CMD, VTY_BUFSIZ);
while (fgets (vty->buf, VTY_BUFSIZ, confp))
{
@@ -641,25 +643,25 @@ vtysh_mark_file (const char *filename)
fprintf (stderr,"line %d: Warning...: %s\n", lineno, vty->buf);
fclose(confp);
vty_close(vty);
- XFREE(MTYPE_VTY, vty_buf_copy);
+ XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
return CMD_WARNING;
case CMD_ERR_AMBIGUOUS:
fprintf (stderr,"line %d: %% Ambiguous command: %s\n", lineno, vty->buf);
fclose(confp);
vty_close(vty);
- XFREE(MTYPE_VTY, vty_buf_copy);
+ XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
return CMD_ERR_AMBIGUOUS;
case CMD_ERR_NO_MATCH:
fprintf (stderr,"line %d: %% Unknown command: %s\n", lineno, vty->buf);
fclose(confp);
vty_close(vty);
- XFREE(MTYPE_VTY, vty_buf_copy);
+ XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
return CMD_ERR_NO_MATCH;
case CMD_ERR_INCOMPLETE:
fprintf (stderr,"line %d: %% Command incomplete: %s\n", lineno, vty->buf);
fclose(confp);
vty_close(vty);
- XFREE(MTYPE_VTY, vty_buf_copy);
+ XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
return CMD_ERR_INCOMPLETE;
case CMD_SUCCESS:
fprintf(stdout, "%s", vty->buf);
@@ -691,7 +693,7 @@ vtysh_mark_file (const char *filename)
/* This is the end */
fprintf(stdout, "end\n");
vty_close(vty);
- XFREE(MTYPE_VTY, vty_buf_copy);
+ XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
if (confp != stdin)
fclose(confp);
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index 75822b136..3aa2bad81 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -22,6 +22,9 @@
#ifndef VTYSH_H
#define VTYSH_H
+#include "memory.h"
+DECLARE_MGROUP(MVTYSH)
+
#define VTYSH_ZEBRA 0x01
#define VTYSH_RIPD 0x02
#define VTYSH_RIPNGD 0x04
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 118b7ba03..760003eb3 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -27,6 +27,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "vtysh/vtysh.h"
#include "vtysh/vtysh_user.h"
+DEFINE_MGROUP(MVTYSH, "vtysh")
+DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CONFIG, "Vtysh configuration")
+DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CONFIG_LINE, "Vtysh configuration line")
+
vector configvec;
extern int vtysh_writeconfig_integrated;
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 0218af81b..32c94d3f0 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -27,6 +27,7 @@ sbin_PROGRAMS = zebra
noinst_PROGRAMS = testzebra
zebra_SOURCES = \
+ zebra_memory.c \
zserv.c main.c interface.c connected.c zebra_rib.c zebra_routemap.c \
redistribute.c debug.c rtadv.c zebra_snmp.c zebra_vty.c \
irdp_main.c irdp_interface.c irdp_packet.c router-id.c zebra_fpm.c \
@@ -36,9 +37,11 @@ zebra_SOURCES = \
testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
zebra_vty.c zebra_ptm.c zebra_routemap.c zebra_ns.c zebra_vrf.c \
kernel_null.c redistribute_null.c ioctl_null.c misc_null.c zebra_rnh_null.c \
- zebra_ptm_null.c rtadv_null.c if_null.c zserv_null.c zebra_static.c
+ zebra_ptm_null.c rtadv_null.c if_null.c zserv_null.c zebra_static.c \
+ zebra_memory.c
noinst_HEADERS = \
+ zebra_memory.h \
connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
interface.h ipforward.h irdp.h router-id.h kernel_socket.h \
rt_netlink.h zebra_fpm.h zebra_fpm_private.h zebra_rnh.h \
diff --git a/zebra/connected.c b/zebra/connected.c
index 6e82e6ec7..290973a5c 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -30,6 +30,7 @@
#include "table.h"
#include "log.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 0a9807b8b..101529c32 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -28,6 +28,7 @@
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index 55e2f203c..45a45f3e8 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -28,6 +28,7 @@
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "privs.h"
#include "vrf.h"
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index d2a506e32..0b71c7621 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -27,6 +27,7 @@
#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 af1aa08a6..9be97e221 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -28,6 +28,7 @@
#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 31e6d4510..8fb4fcad1 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -44,6 +44,7 @@
#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 c68eca42a..cc3a4abaf 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -45,6 +45,7 @@
#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 a2ca82099..25c7aff26 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -45,6 +45,7 @@
#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/kernel_socket.c b/zebra/kernel_socket.c
index 733e62726..3a232129b 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -27,6 +27,7 @@
#include "sockunion.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "log.h"
#include "str.h"
diff --git a/zebra/main.c b/zebra/main.c
index 25de5aea2..e67568140 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -27,6 +27,7 @@
#include "thread.h"
#include "filter.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "memory_vty.h"
#include "prefix.h"
#include "log.h"
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index fb9fa0216..4e7538327 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -40,6 +40,7 @@
#include "zebra/redistribute.h"
#include "zebra/debug.h"
#include "zebra/router-id.h"
+#include "zebra/zebra_memory.h"
#define ZEBRA_PTM_SUPPORT
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 58c1c031c..d5d9652c5 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -30,6 +30,7 @@
#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 fb9aef4aa..a6984f7f2 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -34,6 +34,7 @@
#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 8384b327f..ac297890a 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -23,6 +23,7 @@
#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 d74eef6c5..b68e1cb74 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -23,6 +23,7 @@
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 7d0baf259..bbaf45028 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -25,6 +25,7 @@
#include "thread.h"
#include "filter.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "memory_vty.h"
#include "prefix.h"
#include "log.h"
diff --git a/zebra/zebra_memory.c b/zebra/zebra_memory.c
new file mode 100644
index 000000000..728051c34
--- /dev/null
+++ b/zebra/zebra_memory.c
@@ -0,0 +1,37 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "zebra_memory.h"
+
+DEFINE_MGROUP(ZEBRA, "zebra")
+DEFINE_MTYPE(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
+DEFINE_MTYPE(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
+DEFINE_MTYPE(ZEBRA, RIB, "RIB")
+DEFINE_MTYPE(ZEBRA, RIB_QUEUE, "RIB process work queue")
+DEFINE_MTYPE(ZEBRA, STATIC_ROUTE, "Static route")
+DEFINE_MTYPE(ZEBRA, RIB_DEST, "RIB destination")
+DEFINE_MTYPE(ZEBRA, RIB_TABLE_INFO, "RIB table info")
+DEFINE_MTYPE(ZEBRA, RNH, "Nexthop tracking object")
diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h
new file mode 100644
index 000000000..fbd8f3261
--- /dev/null
+++ b/zebra/zebra_memory.h
@@ -0,0 +1,40 @@
+/* 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 Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_ZEBRA_MEMORY_H
+#define _QUAGGA_ZEBRA_MEMORY_H
+
+#include "memory.h"
+
+DECLARE_MGROUP(ZEBRA)
+DECLARE_MTYPE(RTADV_PREFIX)
+DECLARE_MTYPE(ZEBRA_NS)
+DECLARE_MTYPE(ZEBRA_VRF)
+DECLARE_MTYPE(RIB)
+DECLARE_MTYPE(RIB_QUEUE)
+DECLARE_MTYPE(STATIC_ROUTE)
+DECLARE_MTYPE(RIB_DEST)
+DECLARE_MTYPE(RIB_TABLE_INFO)
+DECLARE_MTYPE(RNH)
+DECLARE_MTYPE(NETLINK_NAME)
+
+#endif /* _QUAGGA_ZEBRA_MEMORY_H */
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 084a5d181..41034e198 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -29,6 +29,10 @@
#include "rtadv.h"
#include "zebra_ns.h"
#include "zebra_vrf.h"
+#include "zebra_memory.h"
+
+DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
+DEFINE_MTYPE(ZEBRA, NETLINK_NAME, "Netlink name")
struct zebra_ns *dzns;
diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c
index a255f5a1e..396857bc1 100644
--- a/zebra/zebra_ptm_redistribute.c
+++ b/zebra/zebra_ptm_redistribute.c
@@ -25,6 +25,7 @@
#include "stream.h"
#include "zebra/zserv.h"
#include "zebra/zebra_ptm_redistribute.h"
+#include "zebra/zebra_memory.h"
static int
zsend_interface_bfd_update (int cmd, struct zserv *client,
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 45df9ac7d..e238f8e8e 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -25,6 +25,7 @@
#include "prefix.h"
#include "table.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "str.h"
#include "command.h"
#include "log.h"
@@ -285,7 +286,7 @@ rib_nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
{
struct nexthop *nexthop;
- nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
+ nexthop = nexthop_new();
nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX;
nexthop->gate.ipv6 = *ipv6;
nexthop->ifindex = ifindex;
@@ -457,7 +458,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
SET_FLAG(rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
- resolved_hop = XCALLOC(MTYPE_NEXTHOP, sizeof (struct nexthop));
+ resolved_hop = nexthop_new();
SET_FLAG (resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
/* If the resolving route specifies a gateway, use it */
if (newhop->type == NEXTHOP_TYPE_IPV4
@@ -507,7 +508,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
{
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
- resolved_hop = XCALLOC(MTYPE_NEXTHOP, sizeof (struct nexthop));
+ resolved_hop = nexthop_new();
SET_FLAG (resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
/* If the resolving route specifies a gateway, use it */
if (newhop->type == NEXTHOP_TYPE_IPV4
@@ -665,7 +666,7 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
SET_FLAG(rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
- resolved_hop = XCALLOC(MTYPE_NEXTHOP, sizeof (struct nexthop));
+ resolved_hop = nexthop_new();
SET_FLAG (resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
/* See nexthop_active_ipv4 for a description how the
* resolved nexthop is constructed. */
@@ -706,7 +707,7 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
{
SET_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE);
- resolved_hop = XCALLOC(MTYPE_NEXTHOP, sizeof (struct nexthop));
+ resolved_hop = nexthop_new();
SET_FLAG (resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
/* See nexthop_active_ipv4 for a description how the
* resolved nexthop is constructed. */
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index ef2357b99..fdb187a23 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -48,6 +48,7 @@
#include "zebra/zebra_rnh.h"
#include "zebra/zebra_routemap.h"
#include "zebra/interface.h"
+#include "zebra/zebra_memory.h"
static void free_state(vrf_id_t vrf_id, struct rib *rib, struct route_node *rn);
static void copy_state(struct rnh *rnh, struct rib *rib,
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 1417824d0..e6c5a3e91 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -22,6 +22,7 @@
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "prefix.h"
#include "rib.h"
#include "routemap.h"
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 7d4751063..18efe26d9 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -32,6 +32,7 @@
#include "zebra/zebra_static.h"
#include "zebra/zebra_rnh.h"
#include "zebra/redistribute.h"
+#include "zebra/zebra_memory.h"
/* Install static route into rib. */
void
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index d9bd919bf..890d749ca 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -23,12 +23,14 @@
#include "log.h"
#include "linklist.h"
+#include "memory.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
#include "zebra/rib.h"
#include "zebra/zebra_vrf.h"
#include "zebra/router-id.h"
+#include "zebra/zebra_memory.h"
#include "zebra/zebra_static.h"
extern struct zebra_t zebrad;
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index bf1d0a49c..a7ee63d87 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -22,6 +22,7 @@
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "if.h"
#include "prefix.h"
#include "command.h"
@@ -30,6 +31,7 @@
#include "nexthop.h"
#include "vrf.h"
#include "lib/json.h"
+#include "routemap.h"
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
diff --git a/zebra/zserv.c b/zebra/zserv.c
index b1bf5ed32..3402bf1df 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -27,6 +27,7 @@
#include "thread.h"
#include "stream.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "table.h"
#include "rib.h"
#include "network.h"