]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 29 May 2015 03:48:31 +0000 (05:48 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 19 Sep 2016 20:31:04 +0000 (16:31 -0400)
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.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
111 files changed:
bgpd/Makefile.am
bgpd/bgp_community.c
bgpd/bgp_fsm.c
bgpd/bgp_memory.c [new file with mode: 0644]
bgpd/bgp_memory.h [new file with mode: 0644]
bgpd/bgp_nexthop.c
bgpd/bgp_open.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h
isisd/Makefile.am
isisd/dict.c
isisd/isis_memory.c [new file with mode: 0644]
isisd/isis_memory.h [new file with mode: 0644]
isisd/isis_redist.c
isisd/isisd.h
lib/.gitignore
lib/Makefile.am
lib/bfd.c
lib/buffer.c
lib/command.c
lib/command.h
lib/distribute.c
lib/filter.c
lib/hash.c
lib/hash.h
lib/if.c
lib/if.h
lib/if_rmap.c
lib/keychain.c
lib/linklist.c
lib/log.c
lib/memory.c
lib/memory.h
lib/memtypes.c [deleted file]
lib/memtypes.pl [deleted file]
lib/nexthop.c
lib/ns.c
lib/plist.c
lib/pqueue.c
lib/prefix.c
lib/privs.c
lib/routemap.c
lib/routemap.h
lib/sockunion.c
lib/stream.c
lib/table.c
lib/table.h
lib/thread.c
lib/vector.c
lib/vector.h
lib/vrf.c
lib/vty.c
lib/workqueue.c
lib/workqueue.h
lib/zclient.c
ospf6d/Makefile.am
ospf6d/ospf6_interface.c
ospf6d/ospf6_memory.c [new file with mode: 0644]
ospf6d/ospf6_memory.h [new file with mode: 0644]
ospf6d/ospf6d.h
ospfd/Makefile.am
ospfd/ospf_memory.c [new file with mode: 0644]
ospfd/ospf_memory.h [new file with mode: 0644]
ospfd/ospf_te.c
ospfd/ospfd.h
pimd/Makefile.am
pimd/pim_memory.c [new file with mode: 0644]
pimd/pim_memory.h [new file with mode: 0644]
pimd/pimd.h
ripd/Makefile.am
ripd/rip_memory.c [new file with mode: 0644]
ripd/rip_memory.h [new file with mode: 0644]
ripd/ripd.h
ripngd/Makefile.am
ripngd/ripng_memory.c [new file with mode: 0644]
ripngd/ripng_memory.h [new file with mode: 0644]
ripngd/ripngd.h
tests/heavy-wq.c
tests/test-memory.c
vtysh/vtysh.c
vtysh/vtysh.h
vtysh/vtysh_config.c
zebra/Makefile.am
zebra/connected.c
zebra/if_ioctl.c
zebra/if_ioctl_solaris.c
zebra/if_sysctl.c
zebra/interface.c
zebra/irdp_interface.c
zebra/irdp_main.c
zebra/irdp_packet.c
zebra/kernel_socket.c
zebra/main.c
zebra/redistribute.c
zebra/router-id.c
zebra/rt_netlink.c
zebra/rtadv.c
zebra/rtread_sysctl.c
zebra/test_main.c
zebra/zebra_memory.c [new file with mode: 0644]
zebra/zebra_memory.h [new file with mode: 0644]
zebra/zebra_ns.c
zebra/zebra_ptm_redistribute.c
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_routemap.c
zebra/zebra_static.c
zebra/zebra_vrf.c
zebra/zebra_vty.c
zebra/zserv.c

index 5176a8e048494221430e6d78590ec84285a9de92..fb5b2375deb8768baab71e59bd5c2f2fd10ff3ed 100644 (file)
@@ -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 \
index d7aa4c1e38b36957490ba680576ca0ce633a4106..450cbddcfadc4a93f77711373a6d6bc29a499d18 100644 (file)
@@ -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. */
index 046767177b91a8c2b20b6018caa5e8c4d18d960b..f63c9aa71348b6a1915897d6784d1cf82a8c0828 100644 (file)
@@ -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 (file)
index 0000000..166400b
--- /dev/null
@@ -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 (file)
index 0000000..b2956f0
--- /dev/null
@@ -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 */
index 1e5c4cf8b00ede596e5981fc8999814368a5f1b1..19f5428d882a55eb07d9154181e080b5179d1e2c 100644 (file)
@@ -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 *
index 6001092ce2cd1b320653508e32451aea0b3ec566..02026a004ab30426abdd196f9a9556091355b5b1 100644 (file)
@@ -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))
index 56db6975028f53500ca380c2b3707ae99fb6d3a1..96dcf9044a582df50e46caac2f6c99a89c36c92f 100644 (file)
@@ -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)),
index bfde53d3e487c2d9d0f5fb1fd9eefdb954b3773c..f4a16d6ba29d55711cfe147eb39229f7c965d6da 100644 (file)
@@ -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 ();
index e8827ca91f54a234ea6a755fc21c6c763ff5e530..a6d3b61e550271b84884e446cfedf820f54e8a77 100644 (file)
@@ -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 */
 
index bfe2e947793bffa898bc7a4a4f35d8f5e6f144aa..c14351ca3ac7e9464a0e5f2d9eaf8e07462d816a 100644 (file)
@@ -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 \
index bbcb42134d1e34018b818a09630d2f6cfafef4ad..a038028d226a9fdd629b33adf7196bdfb2b65d47 100644 (file)
@@ -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 (file)
index 0000000..f3ecc6c
--- /dev/null
@@ -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 (file)
index 0000000..9345229
--- /dev/null
@@ -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 */
index cc77785cedde4221fe8a87dd5bc97dd441c83489..5311b5c69c8de94390fd1648fe7e2b3fd98b5599 100644 (file)
@@ -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;
index 9a4f360a2be96fbeefdfd1475b7da15157bbdaca..ca3e570063e700cb5959deddc949c9fdd7da04fb 100644 (file)
@@ -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  */
index a25bae5aae7c9de24fe14b57ee64edea8cdb53cf..fe75137bca481e3bab2c24e57f93a1071332cd87 100644 (file)
@@ -14,6 +14,5 @@ gitversion.h.tmp
 .arch-ids
 *~
 *.loT
-memtypes.h
 route_types.h
 refix
index 7a2151151029284abbe8c444f14b0e3b754dedd7..dbb80076c57ff1a21a5ed82079cc3c6655e74b00 100644 (file)
@@ -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 > $@
 
index 67a84c95f97492372fb26eb96b9c1e453a2e4df1..a498daf762b5e538c1aa907aa1be744512f19af2 100644 (file)
--- 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;
 
index ee9310100e487f4878145ea89a6a82daee573962..1dfcdb4732dcb5b0fb5ee5c1fbd0feba249836be 100644 (file)
@@ -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
index e67007ae2f95236bf099e89f0e8255d3b5380c49..cfdb91a5b9ae34039cfb7183f63a0baad0ea05aa 100644 (file)
@@ -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;
index 0415834b09db124274df66b4a4f7ad28983ee3a9..9ee4f2db3d83c6fd064af2fef960c3af323d2071 100644 (file)
 #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
index 757525fd7151841d1b8863f2536c192831b85fa5..d0d637fbb412f39a442114dac1d7ffae4fada78e 100644 (file)
 #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;
 
index 0eeb8f187222129a5b55b0786e40713ecb37cfd0..e9ba715c92667c3739b1c887a874c5ebdd0aeed6 100644 (file)
 #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 */
index a20093cd64c05d847ecc41635d24a75b95b33e1f..cb8531fccffd36230826da67147aa8b02f3446a7 100644 (file)
 #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 *),
index 0bc3089f340ffd4c9dd50729895edd60516d126f..11ecf75ec97dfc01a8a6793d061781eef6eb0ddb 100644 (file)
@@ -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. */
index e44882a43e9a203456004ef32d79ace25544483d..bd6079c0fd24827f83e30d120330403f9781b2cc 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
 #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;
 
index 17f8565595797d4a171a16c5bb7d4cbabeb559c3..d1875e695ae56b079cfe2b792f2c194f736c9d57 100644 (file)
--- 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:
  *
index f2d76c69d61d2d314c3edcbd96f0530c18f36569..736f2e237d4803b6f3cea7bff35aad4705099229 100644 (file)
@@ -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. */
index c4a007edd0f016422ddf7a374306dcd28d21922d..ac2083cf4bc74bc500eb4452c9689f41ec72bc32 100644 (file)
@@ -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;
 
index d27a2da848aa870f85b277ff73e5b7b4e86e7c83..6fe91c75fcc4e6c4b3b4bb18aa62bd402ae1b4ed 100644 (file)
@@ -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)
index 1ecc5b6df6da8a34b08ccf18a5a9afc9d4444554..b9edb12fbd38d73bd9b4741a3a828cd7835a63fa 100644 (file)
--- 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;
index 60008d4b5bbb38bec71428199dba7d8b64e6d134..562b0f589a3d79837e681c2279c6562503b310b3 100644 (file)
@@ -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)
 {
index e8243f1733d5634f5ad403e90e75f5d3359a2649..2680253d98e86a71a72997112bad30386b832dec 100644 (file)
@@ -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 (file)
index 4fa64a8..0000000
+++ /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 (executable)
index 0955161..0000000
+++ /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 $_;
-}
index 14486ea157f95c8f1a9ae53d1d8cbd708143be8b..427f77f87ac69c4020f3dde60bc9965f7ad216b4 100644 (file)
@@ -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)
index 4765a18ef2313c8f4d7dbd2f7c590ee4b2c0057c..556350ed176eedd7cdea8323ae2054da061e0e48 100644 (file)
--- 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) */
index 7bb80fa2a4608e66aeab98b0f2a11da5825c44a5..eedb830c1a4060f5eea7a2e673585e7b97047f72 100644 (file)
 
 #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);
 
index 69ab8e65d6c2e8cd16e23d93b4a09fe293163468..0f870564dab7a032d4a77d63b3cb1746f68e8f86 100644 (file)
@@ -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
index d2bb0283159815b7a2c82cd0942698f093084b05..34bb1a493a8f2865a6a3d7de759b8f10f58f01b0 100644 (file)
@@ -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};
index 3fb96aed12c5facfdfbf807dc98ab3f4431f4410..9228a56d356315c460ab522cb66b8fb693b32eb6 100644 (file)
@@ -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
index 9267056df62d515922bd461e896b85da96bfb5e1..10e5ed304c477351b8c0d3e70e88fd3feb0f378d 100644 (file)
@@ -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;
 
index f5981a87f33b31dd3f5ccc1765330de4e0ac4c89..7006e43f66233918b49dcd999f279e6ee1bce9a9 100644 (file)
 #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
index 9184e500fc81a058beda694ac2b7885f0fbe3a2b..96408965ab94e3b9941a90c5091263cab23ca206 100644 (file)
@@ -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)
index 809e749fb90af3b59802f7c4307b07ff7df7caf9..301ebc627527611977326b0005de950f94514d89 100644 (file)
 #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)
index da213616849b40f264fde19fab9d3f4b7a2d913c..8858aea0fd0d053fd37e39fbe696a234450f245d 100644 (file)
@@ -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 *);
 
index 2ffd79b53f48ecd6f25df4a29d1307fabbdf336d..34c196aa47d203b75c7d84df2319eef5655329d0 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef _ZEBRA_TABLE_H
 #define _ZEBRA_TABLE_H
 
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_TABLE)
+
 /*
  * Forward declarations.
  */
index 573e9f725d4892630068f51d8ccfe4b35933c6d3..a26eb6bfd21dd0fe6879524e8dda8f11610ed016 100644 (file)
 #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>
index 7c1486285f38c443e4a40c7d332aac1f6d611392..03ad3171d6603857a2b23b21d06bbf8f96344613 100644 (file)
@@ -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)
index 6b27fd96d4f3a9f27cbeafb2d9649b124cc7600c..d8f4c78608ccb5f6516c927f3fe7d1c9b55084ed 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef _ZEBRA_VECTOR_H
 #define _ZEBRA_VECTOR_H
 
+#include "memory.h"
+DECLARE_MTYPE(VECTOR_INDEX)
+
 /* struct for vector */
 struct _vector 
 {
index bffcbca54e590862da739600e8a8ea575866814f..7d79b3dc9af50fb0d7c2244c8cd8142eff62e20c 100644 (file)
--- 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.
index 831ae8e55638f69e2dd7968a971c28a11852275c..48b64a95c4461c5e752b6ff71c591e93874b4a03 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
 #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 
 {
index 772749403cfcf76f2864359a101e597cf99dec9f..549bb2360aa433aa91a1973832356db547a653e4 100644 (file)
 #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
index 19b44041d786d3da21e33a611bcfa3dafa779db6..eaf85749077923d8763d5b48ede1591c8b210560 100644 (file)
@@ -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 
 
index 753954fd848dba26830cf5bf5bf975b98082c122..057fa77580d5cecf6ea5005580b9734bc81b1e3e 100644 (file)
@@ -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};
 
index f4181167e1c1a5edda69164b10fdf0e88e507a9e..7551503dae169df4acdaf30fa173c8c46b40ca0f 100644 (file)
@@ -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 \
index f24ec46da70de9bda8c2ea811fbae6c1140c2116..f4835d05322c7fa1bd032e0b443396b5babbfe85 100644 (file)
@@ -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 (file)
index 0000000..7f2fbbf
--- /dev/null
@@ -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 (file)
index 0000000..3ff5de4
--- /dev/null
@@ -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 */
index 9e2efb41d716969532c240d2817746e6aa55b076..b41e8ff001eecc935b40561bf2e0b7473f1a7afc 100644 (file)
@@ -27,6 +27,8 @@
 #include "libospf.h"
 #include "thread.h"
 
+#include "ospf6_memory.h"
+
 /* global variables */
 extern struct thread_master *master;
 
index 55f9bf2d8e042142a9772768ef9d486edded6b0b..62db350c5bcf1666cf5457ddabb816d236902c25 100644 (file)
@@ -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 (file)
index 0000000..0181e1e
--- /dev/null
@@ -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 (file)
index 0000000..b082c95
--- /dev/null
@@ -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 */
index e6e296f8af8ce7e771a0a3091db56f120fc24d6a..c118e46c55ed591572bca174be3dc2cba1b76d0e 100644 (file)
@@ -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.
index af238c53aefb410161042210495f82de45cfe2f3..bc4acf993b74b472ca4184318d35dc60686d6e8d 100644 (file)
@@ -29,6 +29,8 @@
 #include "filter.h"
 #include "log.h"
 
+#include "ospf_memory.h"
+
 #define OSPF_VERSION            2
 
 /* VTY port number. */
index d578c97363719ae8cf289e272ca083732ab7d290..eba05076d5f7ecb338d5031d7158e6197c55b42f 100644 (file)
@@ -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 (file)
index 0000000..6014725
--- /dev/null
@@ -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 (file)
index 0000000..81841e5
--- /dev/null
@@ -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 */
index 6d48d83621561f84d429c940008205fe41ce6c76..8855a2ab3ff0142909149d71f0cbf6a42f76b43d 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <stdint.h>
 
+#include "pim_memory.h"
 #include "pim_assert.h"
 
 #define PIMD_PROGNAME       "pimd"
index 571a4993dd5a7fa5fd33ea8eac5fac64387d0560..e7073a79026b24b300c1e8ffe63a50e0d19964ce 100644 (file)
@@ -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 (file)
index 0000000..d2a9580
--- /dev/null
@@ -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 (file)
index 0000000..7aec219
--- /dev/null
@@ -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 */
index d01d0b6bbe2945b12cb7330b9d1e829ed77e7631..7c77b26d41de48708bea67f09bc2a1605d38fb79 100644 (file)
@@ -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
index df0f7d377ec27f915e1459f4887701e4c5cdcbc5..c08e58a90c66cff03506396e6bbf974c06f6e8ad 100644 (file)
@@ -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 (file)
index 0000000..1d2320e
--- /dev/null
@@ -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 (file)
index 0000000..76b830a
--- /dev/null
@@ -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 */
index b87b927f488b9b3353cda2eb5a4f87993af8b142..5337eb88f31100563c960917aa919bdc048d224c 100644 (file)
@@ -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
index 2f133cc5d46290c14aa81fdba590e11bc3b8e91d..2d15dc37bdeb7ee91a57f772f8a509070b034bbc 100644 (file)
 
 #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
index 807249ea6dfc40f7f6198bfd124606b6380ad7d0..6849b9dcebefa0db94231994ee4ed71fe4b8e13a 100644 (file)
@@ -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;
index d01a1bcebbd9428d1f1e7c1387d4312d2ae94f92..10bdef8cc83c818a7832c62d40533e7aee512845 100644 (file)
@@ -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);
index 75822b1363666c6186cff9a293e302c14a5815f9..3aa2bad81efaf01479e572dbdf2b60ed9ba65b81 100644 (file)
@@ -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
index 118b7ba0357556afc5c3f1b4b2565585dcd6f30b..760003eb3b2409a4acda4b9c51dfa2a89a619f69 100644 (file)
@@ -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;
index 0218af81b7ec4780e307e2c8ae4ffc7d2112b63c..32c94d3f0ebe5675f2c3cdaf8b6a29903ee91217 100644 (file)
@@ -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 \
index 6e82e6ec78de17574439316441cb7992b714b7fd..290973a5cbf15b8b875a577751355dc7df84cad1 100644 (file)
@@ -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"
index 0a9807b8b93598fef8035d399ff409158083d630..101529c321bbeb64804b0f0859af6f7d3cf7f95c 100644 (file)
@@ -28,6 +28,7 @@
 #include "ioctl.h"
 #include "connected.h"
 #include "memory.h"
+#include "zebra_memory.h"
 #include "log.h"
 #include "vrf.h"
 
index 55e2f203ca6995ecc3696348def99f3d5c4088ea..45a45f3e81dbdd40f0bb20fb58a92137c98d2c1f 100644 (file)
@@ -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"
index d2a506e32983460ac0c5e41b0a68e5f37817a9f2..0b71c76214a20dcd95ca6b63ec3cc3d2190ce01e 100644 (file)
@@ -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"
index af1aa08a6d40e095fbb83e45740d9b41f3f09f3b..9be97e2214e3b6ad75bc2651e2f7a819093e73cf 100644 (file)
@@ -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"
index 31e6d4510c00eeb977b5ee72ab91931d7e011ad2..8fb4fcad10b2a7416051bd2d9150200f40bb426b 100644 (file)
@@ -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"
index c68eca42a696815e4adae5ad877526103cdd4cf2..cc3a4abaf3787895d2760c5c6382d468c2c9cb3d 100644 (file)
@@ -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"
index a2ca82099bde944dc1c5672c47e6e82f43de3b9b..25c7aff26b9c1f712ff24edd41af1052285f132e 100644 (file)
@@ -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"
index 733e627265be9d11bd23d216e8eb6a8e42b06723..3a232129b664780e0bc2ce4e7b0ee69c488a216f 100644 (file)
@@ -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"
index 25de5aea22bcd26cb921f50182a61dadd395ca97..e67568140ac0b9016043fe00925b518765d010a7 100644 (file)
@@ -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"
index fb9fa0216abdf8ba50e2c13edfc95dedf0ef33ad..4e7538327ff1bffe1752c8a7ce5e885a24634ef6 100644 (file)
@@ -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
 
index 58c1c031cf3292cc9eb6ab5d4e378ba322ab42b2..d5d9652c5993f75f4e09074835fdb6440f180f71 100644 (file)
@@ -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"
index fb9aef4aafec445d0eb3c1e3078b95e40f404601..a6984f7f2f0b7ce6eb9b62185169c5e9a03e9824 100644 (file)
@@ -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"
index 8384b327ffbfaf77018eee17493813d0960c03ad..ac297890a5e64f23cfb61970f2a5dc8278b22ec8 100644 (file)
@@ -23,6 +23,7 @@
 #include <zebra.h>
 
 #include "memory.h"
+#include "zebra_memory.h"
 #include "sockopt.h"
 #include "thread.h"
 #include "if.h"
index d74eef6c5af5939fb602b88a24930123becd2474..b68e1cb74aa756222849fc58bf18bd7756663b6a 100644 (file)
@@ -23,6 +23,7 @@
 #include <zebra.h>
 
 #include "memory.h"
+#include "zebra_memory.h"
 #include "log.h"
 #include "vrf.h"
 
index 7d0baf25990d0a922b718853a9e78068c2d4bc5b..bbaf45028284ff6d2851c1143b4fde523048efc3 100644 (file)
@@ -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 (file)
index 0000000..728051c
--- /dev/null
@@ -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 (file)
index 0000000..fbd8f32
--- /dev/null
@@ -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 */
index 084a5d181f4f034b1744faf63089459ee980ee49..41034e19801d5166bedfa50330b1c6610a196b9c 100644 (file)
 #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;
 
index a255f5a1e5d084b58cfd0c28f9562a0969023f06..396857bc1f1221e86cff9b09b3c0d55b731be11c 100644 (file)
@@ -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,
index 45df9ac7dc06fdb26e7b11150be29854dd25ac07..e238f8e8eb07a1c4b4331b61e2d658853ecad589 100644 (file)
@@ -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. */
index ef2357b99c97d975edbbcaa64b6da287b2cf9ae7..fdb187a23a6db089d76d37c19106084b904f0bfe 100644 (file)
@@ -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,
index 1417824d0729eebdb55e40e2c60b6c7588d58c8f..e6c5a3e917d187be0152c903815712892d412c14 100644 (file)
@@ -22,6 +22,7 @@
 #include <zebra.h>
 
 #include "memory.h"
+#include "zebra_memory.h"
 #include "prefix.h"
 #include "rib.h"
 #include "routemap.h"
index 7d47510635b43cac32a36fdca1aff7760a5f41af..18efe26d9f93f508de99e2fcb92dfbe2d3e5d14a 100644 (file)
@@ -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
index d9bd919bfebb8bda2c7bfab2e8c2cd56d87b21e5..890d749ca4996c8664a83d76715694eb0b4519c1 100644 (file)
 
 #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;
index bf1d0a49c64ec1a9ca1a582e502dc68941400567..a7ee63d87f67be70f1e8bfca1bab7fc5be4b0321 100644 (file)
@@ -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"
index b1bf5ed328a5540f522d5d0728fce93a8971a618..3402bf1dfb883013ecb35969e693995a21ec70ce 100644 (file)
@@ -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"