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 \
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 \
#include "hash.h"
#include "memory.h"
+#include "bgpd/bgp_memory.h"
#include "bgpd/bgp_community.h"
/* Hash of community attribute. */
#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
{
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;
}
{
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;
}
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#include "zebra/rib.h"
#include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */
-
-
char *
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 *
#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
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)
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))
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)),
#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;
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;
}
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 *
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 ();
#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 */
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 \
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 \
#include "zebra.h"
#include "zassert.h"
#include "memory.h"
+#include "isis_memory.h"
#include "dict.h"
/*
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#include "if.h"
#include "linklist.h"
#include "memory.h"
+#include "isis_memory.h"
#include "prefix.h"
#include "routemap.h"
#include "stream.h"
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;
}
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 = {
}
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));
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;
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;
#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 */
.arch-ids
*~
*.loT
-memtypes.h
route_types.h
refix
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@
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
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 > $@
#include "vty.h"
#include "bfd.h"
+DEFINE_MTYPE_STATIC(LIB, BFD_INFO, "BFD info")
+
int bfd_debug = 0;
struct bfd_gbl bfd_gbl;
#include "network.h"
#include <stddef.h>
-
+DEFINE_MTYPE_STATIC(LIB, BUFFER, "Buffer")
+DEFINE_MTYPE_STATIC(LIB, BUFFER_DATA, "Buffer data")
/* Buffer master. */
struct buffer
#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;
#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
#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;
#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 */
#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 *),
#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. */
#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;
#include "zebra.h"
#include "linklist.h"
+#include "memory.h"
+
+DECLARE_MTYPE(IF)
+DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from:
*
#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. */
#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;
#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)
#include <ucontext.h>
#endif
+DEFINE_MTYPE_STATIC(LIB, ZLOG, "Logging")
+
static int logfile_fd = -1; /* Used in signal handler. */
struct zlog *zlog_default = NULL;
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)
{
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));
extern void memory_oom (size_t size, const char *name);
-#include "memtypes.h"
-
#endif /* _QUAGGA_MEMORY_H */
+++ /dev/null
-/*
- * 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")
+++ /dev/null
-#!/usr/bin/perl
-while (<STDIN>) {
- $_ =~ s/DEFINE_MTYPE\([^,]+,\s*([^,]+)\s*,.*\)/DECLARE_MTYPE\($1\)/;
- $_ =~ s/DEFINE_MGROUP\(([^,]+),.*\)/DECLARE_MGROUP\($1\)/;
- print $_;
-}
#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)
#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) */
#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)
/* 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));
(*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);
#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
#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};
#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
#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;
#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
#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)
#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)
#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 *);
#ifndef _ZEBRA_TABLE_H
#define _ZEBRA_TABLE_H
+#include "memory.h"
+DECLARE_MTYPE(ROUTE_TABLE)
+
/*
* Forward declarations.
*/
#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>
#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)
#ifndef _ZEBRA_VECTOR_H
#define _ZEBRA_VECTOR_H
+#include "memory.h"
+DECLARE_MTYPE(VECTOR_INDEX)
+
/* struct for vector */
struct _vector
{
#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.
#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
{
#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
#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
#include "table.h"
#include "nexthop.h"
+DEFINE_MTYPE_STATIC(LIB, ZCLIENT, "Zclient")
+
/* Zebra client events. */
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
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 \
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 \
#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[] =
/* 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));
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);
if (oi->plist_name)
{
- XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name);
+ XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
oi->plist_name = NULL;
}
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#include "libospf.h"
#include "thread.h"
+#include "ospf6_memory.h"
+
/* global variables */
extern struct thread_master *master;
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
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
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#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.
#include "filter.h"
#include "log.h"
+#include "ospf_memory.h"
+
#define OSPF_VERSION 2
/* VTY port number. */
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 \
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 \
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#include <stdint.h>
+#include "pim_memory.h"
#include "pim_assert.h"
#define PIMD_PROGNAME "pimd"
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 = \
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#ifndef _ZEBRA_RIP_H
#define _ZEBRA_RIP_H
+#include "rip_memory.h"
+
/* RIP version number. */
#define RIPv1 1
#define RIPv2 2
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 = \
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#include <zclient.h>
#include <vty.h>
+#include "ripng_memory.h"
+
/* RIPng version and port number. */
#define RIPNG_V1 1
#define RIPNG_PORT_DEFAULT 521
#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;
{
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;
}
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
#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
/* 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 */
}
/* 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 */
}
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;
#include "ns.h"
#include "vrf.h"
+DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
+
/* Struct VTY. */
struct vty *vty;
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))
{
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);
/* 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);
#ifndef VTYSH_H
#define VTYSH_H
+#include "memory.h"
+DECLARE_MGROUP(MVTYSH)
+
#define VTYSH_ZEBRA 0x01
#define VTYSH_RIPD 0x02
#define VTYSH_RIPNGD 0x04
#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;
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 \
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 \
#include "table.h"
#include "log.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "zebra/debug.h"
#include "zebra/zserv.h"
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "privs.h"
#include "vrf.h"
#include "prefix.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "log.h"
#include "interface.h"
#include "prefix.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "connected.h"
#include "log.h"
#include "prefix.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
#include "prefix.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
#include "prefix.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
#include "sockunion.h"
#include "connected.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "log.h"
#include "str.h"
#include "thread.h"
#include "filter.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "memory_vty.h"
#include "prefix.h"
#include "log.h"
#include "zebra/redistribute.h"
#include "zebra/debug.h"
#include "zebra/router-id.h"
+#include "zebra/zebra_memory.h"
#define ZEBRA_PTM_SUPPORT
#include "stream.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "connected.h"
#include "network.h"
#include "connected.h"
#include "table.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "rib.h"
#include "thread.h"
#include "privs.h"
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "sockopt.h"
#include "thread.h"
#include "if.h"
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"
#include "thread.h"
#include "filter.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "memory_vty.h"
#include "prefix.h"
#include "log.h"
--- /dev/null
+/* 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")
--- /dev/null
+/* 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 */
#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;
#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,
#include "prefix.h"
#include "table.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "str.h"
#include "command.h"
#include "log.h"
{
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;
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
{
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
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. */
{
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. */
#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,
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "prefix.h"
#include "rib.h"
#include "routemap.h"
#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
#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;
#include <zebra.h>
#include "memory.h"
+#include "zebra_memory.h"
#include "if.h"
#include "prefix.h"
#include "command.h"
#include "nexthop.h"
#include "vrf.h"
#include "lib/json.h"
+#include "routemap.h"
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
#include "thread.h"
#include "stream.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "table.h"
#include "rib.h"
#include "network.h"