*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs

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>
This commit is contained in:
David Lamparter 2015-05-29 05:48:31 +02:00 committed by Donald Sharp
parent fc7948fafe
commit 4a1ab8e405
111 changed files with 1100 additions and 392 deletions

View 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 \

View 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. */

View 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;
}

110
bgpd/bgp_memory.c Normal file
View File

@ -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")

108
bgpd/bgp_memory.h Normal file
View File

@ -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 */

View 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 *

View 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))

View 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)),

View 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 ();

View 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 */

View 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 \

View File

@ -18,6 +18,7 @@
#include "zebra.h"
#include "zassert.h"
#include "memory.h"
#include "isis_memory.h"
#include "dict.h"
/*

48
isisd/isis_memory.c Normal file
View File

@ -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")

49
isisd/isis_memory.h Normal file
View File

@ -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 */

View 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;

View 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 */

1
lib/.gitignore vendored
View File

@ -14,6 +14,5 @@ gitversion.h.tmp
.arch-ids
*~
*.loT
memtypes.h
route_types.h
refix

View 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 > $@

View File

@ -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;

View 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

View 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;

View File

@ -26,6 +26,12 @@
#include "vector.h"
#include "vty.h"
#include "lib/route_types.h"
#include "memory.h"
DECLARE_MTYPE(HOST)
/* for test-commands.c */
DECLARE_MTYPE(STRVEC)
/* Host configuration variable */
struct host

View File

@ -28,6 +28,10 @@
#include "distribute.h"
#include "memory.h"
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE, "Distribute list")
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_NAME, "Dist-list name")
/* Hash of distribute list. */
struct hash *disthash;

View File

@ -30,6 +30,10 @@
#include "log.h"
#include "routemap.h"
DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST, "Access List")
DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST_STR, "Access List Str")
DEFINE_MTYPE_STATIC(LIB, ACCESS_FILTER, "Access Filter")
struct filter_cisco
{
/* Cisco access-list */

View File

@ -24,6 +24,10 @@
#include "hash.h"
#include "memory.h"
DEFINE_MTYPE( LIB, HASH, "Hash")
DEFINE_MTYPE( LIB, HASH_BACKET, "Hash Bucket")
DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
/* Allocate a new hash. */
struct hash *
hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),

View 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. */

View File

@ -37,6 +37,12 @@
#include "str.h"
#include "log.h"
DEFINE_MTYPE( LIB, IF, "Interface")
DEFINE_MTYPE_STATIC(LIB, CONNECTED, "Connected")
DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
DEFINE_MTYPE( LIB, CONNECTED_LABEL, "Connected interface label")
DEFINE_MTYPE_STATIC(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
/* List of interfaces in only the default VRF */
int ptm_enable = 0;

View File

@ -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:
*

View 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. */

View 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;

View 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)

View File

@ -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;

View 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)
{

View 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 */

View File

@ -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")

View File

@ -1,6 +0,0 @@
#!/usr/bin/perl
while (<STDIN>) {
$_ =~ s/DEFINE_MTYPE\([^,]+,\s*([^,]+)\s*,.*\)/DECLARE_MTYPE\($1\)/;
$_ =~ s/DEFINE_MGROUP\(([^,]+),.*\)/DECLARE_MGROUP\($1\)/;
print $_;
}

View 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)

View File

@ -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) */

View File

@ -34,6 +34,11 @@
#include "plist_int.h"
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST, "Prefix List")
DEFINE_MTYPE_STATIC(LIB, MPREFIX_LIST_STR, "Prefix List Str")
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_ENTRY, "Prefix List Entry")
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_TRIE, "Prefix List Trie Table")
/* not currently changeable, code assumes bytes further down */
#define PLC_BITS 8
#define PLC_LEN (1 << PLC_BITS)
@ -236,7 +241,7 @@ prefix_list_insert (afi_t afi, int orf, const char *name)
/* Allocate new prefix_list and copy given name. */
plist = prefix_list_new ();
plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name);
plist->name = XSTRDUP (MTYPE_MPREFIX_LIST_STR, name);
plist->master = master;
plist->trie = XCALLOC (MTYPE_PREFIX_LIST_TRIE, sizeof (struct pltrie_table));
@ -370,7 +375,7 @@ prefix_list_delete (struct prefix_list *plist)
(*master->delete_hook) (plist);
if (plist->name)
XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
XFREE (MTYPE_MPREFIX_LIST_STR, plist->name);
XFREE (MTYPE_PREFIX_LIST_TRIE, plist->trie);

View 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

View 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};

View 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

View 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;

View File

@ -23,6 +23,10 @@
#define _ZEBRA_ROUTEMAP_H
#include "prefix.h"
#include "memory.h"
DECLARE_MTYPE(ROUTE_MAP_NAME)
DECLARE_MTYPE(ROUTE_MAP_RULE)
DECLARE_MTYPE(ROUTE_MAP_COMPILED)
/* Route map's type. */
enum route_map_type

View 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)

View File

@ -29,6 +29,10 @@
#include "prefix.h"
#include "log.h"
DEFINE_MTYPE_STATIC(LIB, STREAM, "Stream")
DEFINE_MTYPE_STATIC(LIB, STREAM_DATA, "Stream data")
DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
/* Tests whether a position is valid */
#define GETP_VALID(S,G) \
((G) <= (S)->endp)

View 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 *);

View File

@ -23,6 +23,9 @@
#ifndef _ZEBRA_TABLE_H
#define _ZEBRA_TABLE_H
#include "memory.h"
DECLARE_MTYPE(ROUTE_TABLE)
/*
* Forward declarations.
*/

View File

@ -32,6 +32,10 @@
#include "command.h"
#include "sigevent.h"
DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread")
DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master")
DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats")
#if defined(__APPLE__)
#include <mach/mach.h>
#include <mach/mach_time.h>

View 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)

View 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
{

View File

@ -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.

View File

@ -40,6 +40,10 @@
#include <arpa/telnet.h>
#include <termios.h>
DEFINE_MTYPE_STATIC(LIB, VTY, "VTY")
DEFINE_MTYPE_STATIC(LIB, VTY_OUT_BUF, "VTY output buffer")
DEFINE_MTYPE_STATIC(LIB, VTY_HIST, "VTY history")
/* Vty events */
enum event
{

View File

@ -29,6 +29,10 @@
#include "command.h"
#include "log.h"
DEFINE_MTYPE(LIB, WORK_QUEUE, "Work queue")
DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_ITEM, "Work queue item")
DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_NAME, "Work queue name string")
/* master list of work_queues */
static struct list _work_queues;
/* pointer primarily to avoid an otherwise harmless warning on

View 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

View 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};

View 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 \

View 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;
}

44
ospf6d/ospf6_memory.c Normal file
View File

@ -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")

45
ospf6d/ospf6_memory.h Normal file
View File

@ -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 */

View File

@ -27,6 +27,8 @@
#include "libospf.h"
#include "thread.h"
#include "ospf6_memory.h"
/* global variables */
extern struct thread_master *master;

View 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

56
ospfd/ospf_memory.c Normal file
View File

@ -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")

57
ospfd/ospf_memory.h Normal file
View File

@ -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 */

View 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.

View File

@ -29,6 +29,8 @@
#include "filter.h"
#include "log.h"
#include "ospf_memory.h"
#define OSPF_VERSION 2
/* VTY port number. */

View 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 \

41
pimd/pim_memory.c Normal file
View File

@ -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")

42
pimd/pim_memory.h Normal file
View File

@ -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 */

View File

@ -25,6 +25,7 @@
#include <stdint.h>
#include "pim_memory.h"
#include "pim_assert.h"
#define PIMD_PROGNAME "pimd"

View 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 = \

35
ripd/rip_memory.c Normal file
View File

@ -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")

36
ripd/rip_memory.h Normal file
View File

@ -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 */

View 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

View 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 = \

35
ripngd/ripng_memory.c Normal file
View File

@ -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")

36
ripngd/ripng_memory.h Normal file
View File

@ -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 */

View 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

View File

@ -38,6 +38,10 @@
#include "tests.h"
DEFINE_MGROUP(TEST_HEAVYWQ, "heavy-wq test")
DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE, "heavy_wq_node")
DEFINE_MTYPE_STATIC(TEST_HEAVYWQ, WQ_NODE_STR, "heavy_wq_node->str")
extern struct thread_master *master;
static struct work_queue *heavy_wq;
@ -61,17 +65,17 @@ heavy_wq_add (struct vty *vty, const char *str, int i)
{
struct heavy_wq_node *hn;
if ((hn = XCALLOC (MTYPE_PREFIX_LIST, sizeof(struct heavy_wq_node))) == NULL)
if ((hn = XCALLOC (MTYPE_WQ_NODE, sizeof(struct heavy_wq_node))) == NULL)
{
zlog_err ("%s: unable to allocate hn", __func__);
return;
}
hn->i = i;
if (!(hn->str = XSTRDUP (MTYPE_PREFIX_LIST_STR, str)))
if (!(hn->str = XSTRDUP (MTYPE_WQ_NODE_STR, str)))
{
zlog_err ("%s: unable to xstrdup", __func__);
XFREE (MTYPE_PREFIX_LIST, hn);
XFREE (MTYPE_WQ_NODE, hn);
return;
}
@ -92,9 +96,9 @@ slow_func_del (struct work_queue *wq, void *data)
struct heavy_wq_node *hn = data;
assert (hn && hn->str);
printf ("%s: %s\n", __func__, hn->str);
XFREE (MTYPE_PREFIX_LIST_STR, hn->str);
XFREE (MTYPE_WQ_NODE_STR, hn->str);
hn->str = NULL;
XFREE(MTYPE_PREFIX_LIST, hn);
XFREE(MTYPE_WQ_NODE, hn);
}
static wq_item_status

View 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;

View 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);

View 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

View 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;

View 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 \

View 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"

View File

@ -28,6 +28,7 @@
#include "ioctl.h"
#include "connected.h"
#include "memory.h"
#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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

View 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"

View 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"

View File

@ -23,6 +23,7 @@
#include <zebra.h>
#include "memory.h"
#include "zebra_memory.h"
#include "sockopt.h"
#include "thread.h"
#include "if.h"

View File

@ -23,6 +23,7 @@
#include <zebra.h>
#include "memory.h"
#include "zebra_memory.h"
#include "log.h"
#include "vrf.h"

View 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"

Some files were not shown because too many files have changed in this diff Show More