From: David Lamparter <equi...@opensourcerouting.org>

This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.
The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

Signed-off-by: David Lamparter <equi...@opensourcerouting.org>
Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com>
---
 bgpd/Makefile.am         |   2 +
 bgpd/bgp_community.c     |   1 +
 bgpd/bgp_memory.c        |  97 ++++++++++++++++++++++++
 bgpd/bgp_memory.h        |  94 +++++++++++++++++++++++
 bgpd/bgpd.h              |   1 +
 isisd/Makefile.am        |   2 +
 isisd/dict.c             |   1 +
 isisd/isis_memory.c      |  45 +++++++++++
 isisd/isis_memory.h      |  46 ++++++++++++
 isisd/isisd.h            |   1 +
 lib/memtypes.c           | 190 -----------------------------------------------
 ospf6d/Makefile.am       |   2 +
 ospf6d/ospf6_memory.c    |  44 +++++++++++
 ospf6d/ospf6_memory.h    |  45 +++++++++++
 ospf6d/ospf6d.h          |   2 +
 ospfd/Makefile.am        |   6 +-
 ospfd/ospf_memory.c      |  54 ++++++++++++++
 ospfd/ospf_memory.h      |  55 ++++++++++++++
 ospfd/ospfd.h            |   2 +
 pimd/Makefile.am         |   2 +
 pimd/pim_memory.c        |  40 ++++++++++
 pimd/pim_memory.h        |  41 ++++++++++
 pimd/pimd.h              |   1 +
 ripd/Makefile.am         |   2 +
 ripd/rip_memory.c        |  35 +++++++++
 ripd/rip_memory.h        |  36 +++++++++
 ripd/ripd.h              |   2 +
 ripngd/Makefile.am       |   2 +
 ripngd/ripng_memory.c    |  35 +++++++++
 ripngd/ripng_memory.h    |  36 +++++++++
 ripngd/ripngd.h          |   2 +
 vtysh/vtysh.h            |   3 +
 vtysh/vtysh_config.c     |   4 +
 zebra/Makefile.am        |   6 +-
 zebra/connected.c        |   1 +
 zebra/if_ioctl.c         |   1 +
 zebra/if_ioctl_solaris.c |   1 +
 zebra/if_sysctl.c        |   1 +
 zebra/interface.c        |   1 +
 zebra/irdp_interface.c   |   1 +
 zebra/irdp_main.c        |   1 +
 zebra/irdp_packet.c      |   1 +
 zebra/kernel_socket.c    |   1 +
 zebra/main.c             |   1 +
 zebra/router-id.c        |   1 +
 zebra/rt_netlink.c       |   1 +
 zebra/rtadv.c            |   1 +
 zebra/rtread_sysctl.c    |   1 +
 zebra/test_main.c        |   1 +
 zebra/zebra_memory.c     |  38 ++++++++++
 zebra/zebra_memory.h     |  39 ++++++++++
 zebra/zebra_rib.c        |   1 +
 zebra/zebra_routemap.c   |   1 +
 zebra/zebra_vty.c        |   1 +
 zebra/zserv.c            |   1 +
 55 files changed, 840 insertions(+), 193 deletions(-)
 create mode 100644 bgpd/bgp_memory.c
 create mode 100644 bgpd/bgp_memory.h
 create mode 100644 isisd/isis_memory.c
 create mode 100644 isisd/isis_memory.h
 create mode 100644 ospf6d/ospf6_memory.c
 create mode 100644 ospf6d/ospf6_memory.h
 create mode 100644 ospfd/ospf_memory.c
 create mode 100644 ospfd/ospf_memory.h
 create mode 100644 pimd/pim_memory.c
 create mode 100644 pimd/pim_memory.h
 create mode 100644 ripd/rip_memory.c
 create mode 100644 ripd/rip_memory.h
 create mode 100644 ripngd/ripng_memory.c
 create mode 100644 ripngd/ripng_memory.h
 create mode 100644 zebra/zebra_memory.c
 create mode 100644 zebra/zebra_memory.h

diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index d2775f39d277..608d018140e2 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 \
@@ -19,6 +20,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 f1997bd9ce3e..0d272c4c7896 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_memory.c b/bgpd/bgp_memory.c
new file mode 100644
index 000000000000..3c2b08796713
--- /dev/null
+++ b/bgpd/bgp_memory.c
@@ -0,0 +1,97 @@
+/* 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, PEER_GROUP,         "Peer group")
+DEFINE_MTYPE(BGPD, PEER_DESC,          "Peer description")
+DEFINE_MTYPE(BGPD, PEER_PASSWORD,              "Peer password string")
+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_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, 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, ENCAP_TLV,          "ENCAP TLV")
+
diff --git a/bgpd/bgp_memory.h b/bgpd/bgp_memory.h
new file mode 100644
index 000000000000..61ab310f0d55
--- /dev/null
+++ b/bgpd/bgp_memory.h
@@ -0,0 +1,94 @@
+/* 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(PEER_GROUP)
+DECLARE_MTYPE(PEER_DESC)
+DECLARE_MTYPE(PEER_PASSWORD)
+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_DISTANCE)
+DECLARE_MTYPE(BGP_NEXTHOP_CACHE)
+DECLARE_MTYPE(BGP_CONFED_LIST)
+DECLARE_MTYPE(PEER_UPDATE_SOURCE)
+DECLARE_MTYPE(BGP_DAMP_INFO)
+DECLARE_MTYPE(BGP_DAMP_ARRAY)
+DECLARE_MTYPE(BGP_REGEXP)
+DECLARE_MTYPE(BGP_AGGREGATE)
+DECLARE_MTYPE(BGP_ADDR)
+DECLARE_MTYPE(ENCAP_TLV)
+
+#endif /* _QUAGGA_BGP_MEMORY_H */
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 7665d9d00a4d..5e2675cb8e52 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, 
Boston, MA
 
 /* For union sockunion.  */
 #include "sockunion.h"
+#include "bgp_memory.h"
 
 /* Typedef BGP specific types.  */
 typedef u_int32_t as_t;
diff --git a/isisd/Makefile.am b/isisd/Makefile.am
index 5f866638d969..39ff320b7601 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 \
@@ -20,6 +21,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 bbcb42134d1e..a038028d226a 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 000000000000..9bc506e3a325
--- /dev/null
+++ b/isisd/isis_memory.c
@@ -0,0 +1,45 @@
+/* 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")
diff --git a/isisd/isis_memory.h b/isisd/isis_memory.h
new file mode 100644
index 000000000000..40bb88a842d4
--- /dev/null
+++ b/isisd/isis_memory.h
@@ -0,0 +1,46 @@
+/* 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)
+
+#endif /* _QUAGGA_ISIS_MEMORY_H */
diff --git a/isisd/isisd.h b/isisd/isisd.h
index 1a88efdc785c..53c8e1851db8 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -26,6 +26,7 @@
 #define ISISD_VERSION "0.0.7"
 
 #include "isisd/isis_redist.h"
+#include "isis_memory.h"
 
 /* uncomment if you are a developer in bug hunt */
 /* #define EXTREME_DEBUG  */
diff --git a/lib/memtypes.c b/lib/memtypes.c
index 215ea5265666..38d2811745d3 100644
--- a/lib/memtypes.c
+++ b/lib/memtypes.c
@@ -74,197 +74,7 @@ DEFINE_MTYPE(LIB, VRF_BITMAP,               "VRF bit-map")
 
 
 
-DEFINE_MGROUP(ZEBRA, "zebra")
-DEFINE_MTYPE(ZEBRA, RTADV_PREFIX,              "Router Advertisement Prefix")
-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, 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, PEER_GROUP,         "Peer group")
-DEFINE_MTYPE(BGPD, PEER_DESC,          "Peer description")
-DEFINE_MTYPE(BGPD, PEER_PASSWORD,              "Peer password string")
-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_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, 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, 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(BABELD, "babeld")
 DEFINE_MTYPE(BABELD, BABEL,            "Babel structure")
 DEFINE_MTYPE(BABELD, BABEL_IF,         "Babel interface")
 
-
-
-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_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_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_MGROUP(MVTYSH, "vtysh")
-DEFINE_MTYPE(MVTYSH, VTYSH_CONFIG,             "Vtysh configuration")
-DEFINE_MTYPE(MVTYSH, VTYSH_CONFIG_LINE,        "Vtysh configuration line")
-
-
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am
index 75f22572723f..d988ae92b6de 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
 
 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_memory.c b/ospf6d/ospf6_memory.c
new file mode 100644
index 000000000000..7f2fbbf0b75b
--- /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 000000000000..3ff5de4c31b3
--- /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 9e2efb41d716..b41e8ff001ee 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 f21f50792d99..7055ea5ffa62 100644
--- a/ospfd/Makefile.am
+++ b/ospfd/Makefile.am
@@ -16,7 +16,8 @@ libospf_la_SOURCES = \
        ospf_nsm.c ospf_dump.c ospf_network.c ospf_packet.c ospf_lsa.c \
        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_vty.c ospf_api.c ospf_apiserver.c
+       ospf_opaque.c ospf_te.c ospf_vty.c ospf_api.c ospf_apiserver.c \
+       ospf_memory.c
 
 ospfdheaderdir = $(pkgincludedir)/ospfd
 
@@ -27,7 +28,8 @@ ospfdheader_HEADERS = \
 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_vty.h ospf_apiserver.h
+       ospf_flood.h ospf_snmp.h ospf_te.h ospf_vty.h ospf_apiserver.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 000000000000..ab7e41e56d5e
--- /dev/null
+++ b/ospfd/ospf_memory.c
@@ -0,0 +1,54 @@
+/* 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")
diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h
new file mode 100644
index 000000000000..1b775efe9c08
--- /dev/null
+++ b/ospfd/ospf_memory.h
@@ -0,0 +1,55 @@
+/* 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)
+
+#endif /* _QUAGGA_OSPF_MEMORY_H */
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 098fc5f41cca..ad6913abf56d 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 f57c4c254391..037aa571df47 100644
--- a/pimd/Makefile.am
+++ b/pimd/Makefile.am
@@ -46,6 +46,7 @@ sbin_PROGRAMS = pimd
 bin_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 \
@@ -55,6 +56,7 @@ libpim_a_SOURCES = \
        pim_igmp_join.c pim_ssmpingd.c pim_int.c pim_static.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 000000000000..e955033fadd1
--- /dev/null
+++ b/pimd/pim_memory.c
@@ -0,0 +1,40 @@
+/* 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")
diff --git a/pimd/pim_memory.h b/pimd/pim_memory.h
new file mode 100644
index 000000000000..eb09375dc6d6
--- /dev/null
+++ b/pimd/pim_memory.h
@@ -0,0 +1,41 @@
+/* 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)
+
+#endif /* _QUAGGA_PIM_MEMORY_H */
diff --git a/pimd/pimd.h b/pimd/pimd.h
index aed26bea2649..75c1decd8a08 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -25,6 +25,7 @@
 
 #include <stdint.h>
 
+#include "pim_memory.h"
 #include "pim_mroute.h"
 #include "pim_assert.h"
 
diff --git a/ripd/Makefile.am b/ripd/Makefile.am
index 571a4993dd5a..e7073a79026b 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 000000000000..d2a958064ff4
--- /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 000000000000..7aec2193059c
--- /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 dbed342db736..43479d8db0e2 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 df0f7d377ec2..c08e58a90c66 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 000000000000..1d2320ee2606
--- /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 000000000000..76b830afb4f9
--- /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 75b542e9799b..b0ce36c80ea1 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/vtysh/vtysh.h b/vtysh/vtysh.h
index 1681a71aea76..84051ff5e379 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 a069164b2037..f19fe0b86bc5 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -26,6 +26,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, 
Boston, MA
 
 #include "vtysh/vtysh.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 90ce7b97dc08..63d0376a1576 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -27,16 +27,20 @@ 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 \
        $(othersrc)
 
-testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
+testzebra_SOURCES = \
+       zebra_memory.c \
+       test_main.c zebra_rib.c interface.c connected.c debug.c \
        zebra_vty.c \
        kernel_null.c  redistribute_null.c ioctl_null.c misc_null.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 \
diff --git a/zebra/connected.c b/zebra/connected.c
index 84b0d1cb87c6..59cae4220ac0 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/zserv.h"
 #include "zebra/redistribute.h"
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 8df877dbaaa1..4f2b9a85ba99 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 50b4aca62556..b7a489ccfb9a 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 bb48f61828a9..6acfaa3daa05 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 8a9225ac1187..5339216316d9 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 43c63a83f07f..d82fe6420d30 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 cf78a54e79e8..941a2726f64e 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 0d31050c5594..c2a75e0f1eba 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 5e68c5675f2e..b3c89cafec07 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 af33d0c62e8b..ee80283c4e1d 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/router-id.c b/zebra/router-id.c
index a4eb73ae5303..efb49155288b 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 e4505de33013..6c4b680addfe 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 9450f9a92d13..48870d58d20d 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 385e15069fae..02976814cf16 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 f14c6751adea..6aa17016f5ad 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 000000000000..557a5cfab95b
--- /dev/null
+++ b/zebra/zebra_memory.c
@@ -0,0 +1,38 @@
+/* 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, 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, NETLINK_NAME,   "Netlink name")
diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h
new file mode 100644
index 000000000000..a86311ad087b
--- /dev/null
+++ b/zebra/zebra_memory.h
@@ -0,0 +1,39 @@
+/* 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_VRF)
+DECLARE_MTYPE(NEXTHOP)
+DECLARE_MTYPE(RIB)
+DECLARE_MTYPE(RIB_QUEUE)
+DECLARE_MTYPE(STATIC_ROUTE)
+DECLARE_MTYPE(RIB_DEST)
+DECLARE_MTYPE(RIB_TABLE_INFO)
+DECLARE_MTYPE(NETLINK_NAME)
+
+#endif /* _QUAGGA_ZEBRA_MEMORY_H */
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 031e1fb0fdf2..c7bcb4b57627 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -24,6 +24,7 @@
 #include "prefix.h"
 #include "table.h"
 #include "memory.h"
+#include "zebra_memory.h"
 #include "str.h"
 #include "command.h"
 #include "if.h"
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 49feccd0632e..67f045f9ef6a 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_vty.c b/zebra/zebra_vty.c
index 3973e4382cc4..be6cf70e5bcc 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"
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 03c958bc872e..201f4910bb67 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"
-- 
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to