mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
isisd: kill isis_memory.h, use MTYPE_STATIC
Convert most DEFINE_MTYPE into the _STATIC variant, and move the remaining non-static ones to appropriate places. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
992c42ef01
commit
66b9a3816a
@ -22,7 +22,6 @@
|
||||
#include <zebra.h>
|
||||
#include "isisd/fabricd.h"
|
||||
#include "isisd/isisd.h"
|
||||
#include "isisd/isis_memory.h"
|
||||
#include "isisd/isis_circuit.h"
|
||||
#include "isisd/isis_misc.h"
|
||||
#include "isisd/isis_adjacency.h"
|
||||
|
@ -49,6 +49,9 @@
|
||||
#include "isisd/fabricd.h"
|
||||
#include "isisd/isis_nb.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_ADJACENCY, "ISIS adjacency");
|
||||
DEFINE_MTYPE(ISISD, ISIS_ADJACENCY_INFO, "ISIS adjacency info");
|
||||
|
||||
static struct isis_adjacency *adj_alloc(struct isis_circuit *circuit,
|
||||
const uint8_t *id)
|
||||
{
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "isisd/isis_tlvs.h"
|
||||
|
||||
DECLARE_MTYPE(ISIS_ADJACENCY_INFO);
|
||||
|
||||
enum isis_adj_usage {
|
||||
ISIS_ADJ_NONE,
|
||||
ISIS_ADJ_LEVEL1,
|
||||
|
@ -61,6 +61,8 @@
|
||||
#include "isisd/isis_nb.h"
|
||||
#include "isisd/isis_ldp_sync.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_CIRCUIT, "ISIS circuit");
|
||||
|
||||
DEFINE_QOBJ_TYPE(isis_circuit);
|
||||
|
||||
DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include "isisd/isis_misc.h"
|
||||
#include "isisd/isis_constants.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_DYNHN, "ISIS dyn hostname");
|
||||
|
||||
extern struct host host;
|
||||
|
||||
struct list *dyn_cache = NULL;
|
||||
|
@ -46,6 +46,7 @@ DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_NODE, "ISIS SPF Node");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_LFA_TIEBREAKER, "ISIS LFA Tiebreaker");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_LFA_EXCL_IFACE, "ISIS LFA Excluded Interface");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_RLFA, "ISIS Remote LFA");
|
||||
DEFINE_MTYPE(ISISD, ISIS_NEXTHOP_LABELS, "ISIS nexthop MPLS labels");
|
||||
|
||||
static inline int isis_spf_node_compare(const struct isis_spf_node *a,
|
||||
const struct isis_spf_node *b)
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#include "lib/typesafe.h"
|
||||
#include "lib/zclient.h"
|
||||
#include "lib/memory.h"
|
||||
|
||||
DECLARE_MTYPE(ISIS_NEXTHOP_LABELS);
|
||||
|
||||
PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree);
|
||||
PREDECL_RBTREE_UNIQ(rlfa_tree);
|
||||
|
@ -60,6 +60,8 @@
|
||||
#include "isisd/isis_tx_queue.h"
|
||||
#include "isisd/isis_nb.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP");
|
||||
|
||||
static int lsp_refresh(struct thread *thread);
|
||||
static int lsp_l1_refresh_pseudo(struct thread *thread);
|
||||
static int lsp_l2_refresh_pseudo(struct thread *thread);
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* 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 this program; see the file COPYING; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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_ADJACENCY_INFO, "ISIS adjacency info");
|
||||
DEFINE_MTYPE(ISISD, ISIS_AREA, "ISIS area");
|
||||
DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address");
|
||||
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_NEXTHOP_LABELS, "ISIS nexthop MPLS labels");
|
||||
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");
|
||||
DEFINE_MTYPE(ISISD, ISIS_ACL_NAME, "ISIS access-list name");
|
||||
DEFINE_MTYPE(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
|
@ -1,50 +0,0 @@
|
||||
/* 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 this program; see the file COPYING; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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_ADJACENCY_INFO);
|
||||
DECLARE_MTYPE(ISIS_AREA);
|
||||
DECLARE_MTYPE(ISIS_AREA_ADDR);
|
||||
DECLARE_MTYPE(ISIS_DYNHN);
|
||||
DECLARE_MTYPE(ISIS_SPFTREE);
|
||||
DECLARE_MTYPE(ISIS_VERTEX);
|
||||
DECLARE_MTYPE(ISIS_ROUTE_INFO);
|
||||
DECLARE_MTYPE(ISIS_NEXTHOP);
|
||||
DECLARE_MTYPE(ISIS_NEXTHOP_LABELS);
|
||||
DECLARE_MTYPE(ISIS_DICT);
|
||||
DECLARE_MTYPE(ISIS_DICT_NODE);
|
||||
DECLARE_MTYPE(ISIS_EXT_ROUTE);
|
||||
DECLARE_MTYPE(ISIS_EXT_INFO);
|
||||
DECLARE_MTYPE(ISIS_MPLS_TE);
|
||||
DECLARE_MTYPE(ISIS_ACL_NAME);
|
||||
DECLARE_MTYPE(ISIS_PLIST_NAME);
|
||||
|
||||
#endif /* _QUAGGA_ISIS_MEMORY_H */
|
@ -21,7 +21,6 @@
|
||||
*/
|
||||
#include <zebra.h>
|
||||
#include "isisd/isisd.h"
|
||||
#include "isisd/isis_memory.h"
|
||||
#include "isisd/isis_circuit.h"
|
||||
#include "isisd/isis_adjacency.h"
|
||||
#include "isisd/isis_misc.h"
|
||||
|
@ -48,12 +48,14 @@
|
||||
#include "isisd/isis_spf.h"
|
||||
#include "isisd/isis_spf_private.h"
|
||||
#include "isisd/isis_te.h"
|
||||
#include "isisd/isis_memory.h"
|
||||
#include "isisd/isis_mt.h"
|
||||
#include "isisd/isis_redist.h"
|
||||
#include "isisd/isis_ldp_sync.h"
|
||||
#include "isisd/isis_dr.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
/*
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "if.h"
|
||||
#include "linklist.h"
|
||||
#include "memory.h"
|
||||
#include "isis_memory.h"
|
||||
#include "prefix.h"
|
||||
#include "routemap.h"
|
||||
#include "stream.h"
|
||||
@ -42,6 +41,10 @@
|
||||
#include "isisd/isis_route.h"
|
||||
#include "isisd/isis_zebra.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_EXT_ROUTE, "ISIS redistributed route");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_EXT_INFO, "ISIS redistributed route info");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_RMAP_NAME, "ISIS redistribute route-map name");
|
||||
|
||||
static int redist_protocol(int family)
|
||||
{
|
||||
if (family == AF_INET)
|
||||
@ -327,13 +330,13 @@ static void isis_redist_routemap_set(struct isis_redist *redist,
|
||||
const char *routemap)
|
||||
{
|
||||
if (redist->map_name) {
|
||||
XFREE(MTYPE_ISIS, redist->map_name);
|
||||
XFREE(MTYPE_ISIS_RMAP_NAME, redist->map_name);
|
||||
route_map_counter_decrement(redist->map);
|
||||
redist->map = NULL;
|
||||
}
|
||||
|
||||
if (routemap && strlen(routemap)) {
|
||||
redist->map_name = XSTRDUP(MTYPE_ISIS, routemap);
|
||||
redist->map_name = XSTRDUP(MTYPE_ISIS_RMAP_NAME, routemap);
|
||||
redist->map = route_map_lookup_by_name(routemap);
|
||||
route_map_counter_increment(redist->map);
|
||||
}
|
||||
@ -507,7 +510,7 @@ void isis_redist_area_finish(struct isis_area *area)
|
||||
redist = &area->redist_settings[protocol][type]
|
||||
[level];
|
||||
redist->redist = 0;
|
||||
XFREE(MTYPE_ISIS, redist->map_name);
|
||||
XFREE(MTYPE_ISIS_RMAP_NAME, redist->map_name);
|
||||
}
|
||||
route_table_finish(area->ext_reach[protocol][level]);
|
||||
}
|
||||
|
@ -50,6 +50,9 @@
|
||||
#include "isis_route.h"
|
||||
#include "isis_zebra.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_NEXTHOP, "ISIS nexthop");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_ROUTE_INFO, "ISIS route info");
|
||||
|
||||
DEFINE_HOOK(isis_route_update_hook,
|
||||
(struct isis_area * area, struct prefix *prefix,
|
||||
struct isis_route_info *route_info),
|
||||
|
@ -60,8 +60,10 @@
|
||||
#include "fabricd.h"
|
||||
#include "isis_spf_private.h"
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_SPFTREE, "ISIS SPFtree");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_RUN, "ISIS SPF Run Info");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_SPF_ADJ, "ISIS SPF Adjacency");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_VERTEX, "ISIS vertex");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_VERTEX_ADJ, "ISIS SPF Vertex Adjacency");
|
||||
|
||||
static void spf_adj_list_parse_lsp(struct isis_spftree *spftree,
|
||||
@ -248,6 +250,20 @@ static struct isis_vertex *isis_vertex_new(struct isis_spftree *spftree,
|
||||
return vertex;
|
||||
}
|
||||
|
||||
void isis_vertex_del(struct isis_vertex *vertex)
|
||||
{
|
||||
list_delete(&vertex->Adj_N);
|
||||
list_delete(&vertex->parents);
|
||||
if (vertex->firsthops) {
|
||||
hash_clean(vertex->firsthops, NULL);
|
||||
hash_free(vertex->firsthops);
|
||||
vertex->firsthops = NULL;
|
||||
}
|
||||
|
||||
memset(vertex, 0, sizeof(struct isis_vertex));
|
||||
XFREE(MTYPE_ISIS_VERTEX, vertex);
|
||||
}
|
||||
|
||||
struct isis_vertex_adj *
|
||||
isis_vertex_adj_add(struct isis_spftree *spftree, struct isis_vertex *vertex,
|
||||
struct list *vadj_list, struct isis_spf_adj *sadj,
|
||||
|
@ -179,20 +179,7 @@ static void isis_vertex_queue_init(struct isis_vertex_queue *queue,
|
||||
isis_vertex_queue_hash_cmp, name);
|
||||
}
|
||||
|
||||
__attribute__((__unused__))
|
||||
static void isis_vertex_del(struct isis_vertex *vertex)
|
||||
{
|
||||
list_delete(&vertex->Adj_N);
|
||||
list_delete(&vertex->parents);
|
||||
if (vertex->firsthops) {
|
||||
hash_clean(vertex->firsthops, NULL);
|
||||
hash_free(vertex->firsthops);
|
||||
vertex->firsthops = NULL;
|
||||
}
|
||||
|
||||
memset(vertex, 0, sizeof(struct isis_vertex));
|
||||
XFREE(MTYPE_ISIS_VERTEX, vertex);
|
||||
}
|
||||
void isis_vertex_del(struct isis_vertex *vertex);
|
||||
|
||||
bool isis_vertex_adj_exists(const struct isis_spftree *spftree,
|
||||
const struct isis_vertex *vertex,
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "network.h"
|
||||
|
||||
#include "isisd/isisd.h"
|
||||
#include "isisd/isis_memory.h"
|
||||
#include "isisd/isis_tlvs.h"
|
||||
#include "isisd/isis_common.h"
|
||||
#include "isisd/isis_mt.h"
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "jhash.h"
|
||||
|
||||
#include "isisd/isisd.h"
|
||||
#include "isisd/isis_memory.h"
|
||||
#include "isisd/isis_flags.h"
|
||||
#include "isisd/isis_circuit.h"
|
||||
#include "isisd/isis_lsp.h"
|
||||
|
@ -81,6 +81,14 @@ unsigned long debug_sr;
|
||||
unsigned long debug_ldp_sync;
|
||||
unsigned long debug_lfa;
|
||||
|
||||
DEFINE_MGROUP(ISISD, "isisd");
|
||||
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS, "ISIS process");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_NAME, "ISIS process name");
|
||||
DEFINE_MTYPE_STATIC(ISISD, ISIS_AREA, "ISIS area");
|
||||
DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address");
|
||||
DEFINE_MTYPE(ISISD, ISIS_ACL_NAME, "ISIS access-list name");
|
||||
|
||||
DEFINE_QOBJ_TYPE(isis_area);
|
||||
|
||||
/* ISIS process wide configuration. */
|
||||
@ -198,10 +206,10 @@ struct isis *isis_new(const char *vrf_name)
|
||||
if (vrf) {
|
||||
isis->vrf_id = vrf->vrf_id;
|
||||
isis_vrf_link(isis, vrf);
|
||||
isis->name = XSTRDUP(MTYPE_ISIS, vrf->name);
|
||||
isis->name = XSTRDUP(MTYPE_ISIS_NAME, vrf->name);
|
||||
} else {
|
||||
isis->vrf_id = VRF_UNKNOWN;
|
||||
isis->name = XSTRDUP(MTYPE_ISIS, vrf_name);
|
||||
isis->name = XSTRDUP(MTYPE_ISIS_NAME, vrf_name);
|
||||
}
|
||||
|
||||
if (IS_DEBUG_EVENTS)
|
||||
@ -565,7 +573,7 @@ static int isis_vrf_enable(struct vrf *vrf)
|
||||
isis = isis_lookup_by_vrfname(vrf->name);
|
||||
if (isis) {
|
||||
if (isis->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
|
||||
XFREE(MTYPE_ISIS, isis->name);
|
||||
XFREE(MTYPE_ISIS_NAME, isis->name);
|
||||
isis->name = NULL;
|
||||
}
|
||||
old_vrf_id = isis->vrf_id;
|
||||
@ -631,7 +639,7 @@ void isis_finish(struct isis *isis)
|
||||
vrf = vrf_lookup_by_name(isis->name);
|
||||
if (vrf)
|
||||
isis_vrf_unlink(isis, vrf);
|
||||
XFREE(MTYPE_ISIS, isis->name);
|
||||
XFREE(MTYPE_ISIS_NAME, isis->name);
|
||||
} else {
|
||||
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
if (vrf)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define ISISD_H
|
||||
|
||||
#include "vty.h"
|
||||
#include "memory.h"
|
||||
|
||||
#include "isisd/isis_constants.h"
|
||||
#include "isisd/isis_common.h"
|
||||
@ -34,10 +35,11 @@
|
||||
#include "isis_flags.h"
|
||||
#include "isis_lsp.h"
|
||||
#include "isis_lfa.h"
|
||||
#include "isis_memory.h"
|
||||
#include "qobj.h"
|
||||
#include "ldp_sync.h"
|
||||
|
||||
DECLARE_MGROUP(ISISD);
|
||||
|
||||
#ifdef FABRICD
|
||||
static const bool fabricd = true;
|
||||
#define PROTO_TYPE ZEBRA_ROUTE_OPENFABRIC
|
||||
@ -240,6 +242,9 @@ struct isis_area {
|
||||
};
|
||||
DECLARE_QOBJ_TYPE(isis_area);
|
||||
|
||||
DECLARE_MTYPE(ISIS_ACL_NAME); /* isis_area->spf_prefix_prioritites */
|
||||
DECLARE_MTYPE(ISIS_AREA_ADDR); /* isis_area->area_addrs */
|
||||
|
||||
DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area));
|
||||
|
||||
void isis_terminate(void);
|
||||
|
@ -57,7 +57,6 @@ noinst_HEADERS += \
|
||||
isisd/isis_ldp_sync.h \
|
||||
isisd/isis_lfa.h \
|
||||
isisd/isis_lsp.h \
|
||||
isisd/isis_memory.h \
|
||||
isisd/isis_misc.h \
|
||||
isisd/isis_mt.h \
|
||||
isisd/isis_nb.h \
|
||||
@ -92,7 +91,6 @@ LIBISIS_SOURCES = \
|
||||
isisd/isis_ldp_sync.c \
|
||||
isisd/isis_lfa.c \
|
||||
isisd/isis_lsp.c \
|
||||
isisd/isis_memory.c \
|
||||
isisd/isis_misc.c \
|
||||
isisd/isis_mt.c \
|
||||
isisd/isis_pdu.c \
|
||||
|
Loading…
Reference in New Issue
Block a user