mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 13:33:15 +00:00
Merge pull request #12445 from donaldsharp/more_mtype_tmp
More mtype tmp
This commit is contained in:
commit
cee4c22a26
@ -36,6 +36,10 @@
|
|||||||
#include "bgpd/bgp_keepalives.h"
|
#include "bgpd/bgp_keepalives.h"
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
|
DEFINE_MTYPE_STATIC(BGPD, BGP_PKAT, "Peer KeepAlive Timer");
|
||||||
|
DEFINE_MTYPE_STATIC(BGPD, BGP_COND, "BGP Peer pthread Conditional");
|
||||||
|
DEFINE_MTYPE_STATIC(BGPD, BGP_MUTEX, "BGP Peer pthread Mutex");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Peer KeepAlive Timer.
|
* Peer KeepAlive Timer.
|
||||||
* Associates a peer with the time of its last keepalive.
|
* Associates a peer with the time of its last keepalive.
|
||||||
@ -54,7 +58,7 @@ static struct hash *peerhash;
|
|||||||
|
|
||||||
static struct pkat *pkat_new(struct peer *peer)
|
static struct pkat *pkat_new(struct peer *peer)
|
||||||
{
|
{
|
||||||
struct pkat *pkat = XMALLOC(MTYPE_TMP, sizeof(struct pkat));
|
struct pkat *pkat = XMALLOC(MTYPE_BGP_PKAT, sizeof(struct pkat));
|
||||||
pkat->peer = peer;
|
pkat->peer = peer;
|
||||||
monotime(&pkat->last);
|
monotime(&pkat->last);
|
||||||
return pkat;
|
return pkat;
|
||||||
@ -62,7 +66,7 @@ static struct pkat *pkat_new(struct peer *peer)
|
|||||||
|
|
||||||
static void pkat_del(void *pkat)
|
static void pkat_del(void *pkat)
|
||||||
{
|
{
|
||||||
XFREE(MTYPE_TMP, pkat);
|
XFREE(MTYPE_BGP_PKAT, pkat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,8 +162,8 @@ static void bgp_keepalives_finish(void *arg)
|
|||||||
pthread_mutex_destroy(peerhash_mtx);
|
pthread_mutex_destroy(peerhash_mtx);
|
||||||
pthread_cond_destroy(peerhash_cond);
|
pthread_cond_destroy(peerhash_cond);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, peerhash_mtx);
|
XFREE(MTYPE_BGP_MUTEX, peerhash_mtx);
|
||||||
XFREE(MTYPE_TMP, peerhash_cond);
|
XFREE(MTYPE_BGP_COND, peerhash_cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,8 +188,8 @@ void *bgp_keepalives_start(void *arg)
|
|||||||
*/
|
*/
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
|
peerhash_mtx = XCALLOC(MTYPE_BGP_MUTEX, sizeof(pthread_mutex_t));
|
||||||
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
|
peerhash_cond = XCALLOC(MTYPE_BGP_COND, sizeof(pthread_cond_t));
|
||||||
|
|
||||||
/* initialize mutex */
|
/* initialize mutex */
|
||||||
pthread_mutex_init(peerhash_mtx, NULL);
|
pthread_mutex_init(peerhash_mtx, NULL);
|
||||||
|
@ -573,7 +573,7 @@ void ospf6_lsa_show_dump(struct vty *vty, struct ospf6_lsa *lsa,
|
|||||||
json = json_object_new_object();
|
json = json_object_new_object();
|
||||||
size_t header_str_sz = (2 * (end - start)) + 1;
|
size_t header_str_sz = (2 * (end - start)) + 1;
|
||||||
|
|
||||||
header_str = XMALLOC(MTYPE_TMP, header_str_sz);
|
header_str = XMALLOC(MTYPE_OSPF6_LSA_HEADER, header_str_sz);
|
||||||
|
|
||||||
inet_ntop(AF_INET, &lsa->header->id, id, sizeof(id));
|
inet_ntop(AF_INET, &lsa->header->id, id, sizeof(id));
|
||||||
inet_ntop(AF_INET, &lsa->header->adv_router, adv_router,
|
inet_ntop(AF_INET, &lsa->header->adv_router, adv_router,
|
||||||
@ -586,7 +586,7 @@ void ospf6_lsa_show_dump(struct vty *vty, struct ospf6_lsa *lsa,
|
|||||||
json_object_string_add(json, "header", header_str);
|
json_object_string_add(json, "header", header_str);
|
||||||
json_object_array_add(json_array, json);
|
json_object_array_add(json_array, json);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, header_str);
|
XFREE(MTYPE_OSPF6_LSA_HEADER, header_str);
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty, "\n%s:\n", lsa->name);
|
vty_out(vty, "\n%s:\n", lsa->name);
|
||||||
|
|
||||||
|
@ -54,10 +54,6 @@
|
|||||||
|
|
||||||
#include "ospf_apiclient.h"
|
#include "ospf_apiclient.h"
|
||||||
|
|
||||||
/* *sigh* ... can't find a better way to hammer this into automake */
|
|
||||||
#include "ospfd/ospf_dump_api.c"
|
|
||||||
#include "ospfd/ospf_api.c"
|
|
||||||
|
|
||||||
XREF_SETUP();
|
XREF_SETUP();
|
||||||
|
|
||||||
DEFINE_MGROUP(OSPFCLIENT, "libospfapiclient");
|
DEFINE_MGROUP(OSPFCLIENT, "libospfapiclient");
|
||||||
|
@ -27,6 +27,7 @@ endif
|
|||||||
|
|
||||||
ospfclient_ospfclient_LDADD = \
|
ospfclient_ospfclient_LDADD = \
|
||||||
ospfclient/libfrrospfapiclient.la \
|
ospfclient/libfrrospfapiclient.la \
|
||||||
|
ospfd/libfrrospfclient.a \
|
||||||
$(LIBCAP) \
|
$(LIBCAP) \
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
@ -56,10 +56,14 @@
|
|||||||
#include "ospfd/ospf_ase.h"
|
#include "ospfd/ospf_ase.h"
|
||||||
#include "ospfd/ospf_zebra.h"
|
#include "ospfd/ospf_zebra.h"
|
||||||
#include "ospfd/ospf_errors.h"
|
#include "ospfd/ospf_errors.h"
|
||||||
|
#include "ospfd/ospf_memory.h"
|
||||||
|
|
||||||
#include "ospfd/ospf_api.h"
|
#include "ospfd/ospf_api.h"
|
||||||
#include "ospfd/ospf_apiserver.h"
|
#include "ospfd/ospf_apiserver.h"
|
||||||
|
|
||||||
|
DEFINE_MTYPE_STATIC(OSPFD, APISERVER, "API Server");
|
||||||
|
DEFINE_MTYPE_STATIC(OSPFD, APISERVER_MSGFILTER, "API Server Message Filter");
|
||||||
|
|
||||||
/* This is an implementation of an API to the OSPF daemon that allows
|
/* This is an implementation of an API to the OSPF daemon that allows
|
||||||
* external applications to access the OSPF daemon through socket
|
* external applications to access the OSPF daemon through socket
|
||||||
* connections. The application can use this API to inject its own
|
* connections. The application can use this API to inject its own
|
||||||
@ -245,9 +249,9 @@ static int ospf_apiserver_del_lsa_hook(struct ospf_lsa *lsa)
|
|||||||
struct ospf_apiserver *ospf_apiserver_new(int fd_sync, int fd_async)
|
struct ospf_apiserver *ospf_apiserver_new(int fd_sync, int fd_async)
|
||||||
{
|
{
|
||||||
struct ospf_apiserver *new =
|
struct ospf_apiserver *new =
|
||||||
XMALLOC(MTYPE_OSPF_APISERVER, sizeof(struct ospf_apiserver));
|
XMALLOC(MTYPE_APISERVER, sizeof(struct ospf_apiserver));
|
||||||
|
|
||||||
new->filter = XMALLOC(MTYPE_OSPF_APISERVER_MSGFILTER,
|
new->filter = XMALLOC(MTYPE_APISERVER_MSGFILTER,
|
||||||
sizeof(struct lsa_filter_type));
|
sizeof(struct lsa_filter_type));
|
||||||
|
|
||||||
new->fd_sync = fd_sync;
|
new->fd_sync = fd_sync;
|
||||||
@ -360,7 +364,7 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv)
|
|||||||
(void *)apiserv, apiserver_list->count);
|
(void *)apiserv, apiserver_list->count);
|
||||||
|
|
||||||
/* And free instance. */
|
/* And free instance. */
|
||||||
XFREE(MTYPE_OSPF_APISERVER, apiserv);
|
XFREE(MTYPE_APISERVER, apiserv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ospf_apiserver_read(struct thread *thread)
|
void ospf_apiserver_read(struct thread *thread)
|
||||||
@ -862,8 +866,8 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv,
|
|||||||
connection shuts down, we can flush all LSAs of this opaque
|
connection shuts down, we can flush all LSAs of this opaque
|
||||||
type. */
|
type. */
|
||||||
|
|
||||||
regtype = XCALLOC(MTYPE_OSPF_APISERVER,
|
regtype =
|
||||||
sizeof(struct registered_opaque_type));
|
XCALLOC(MTYPE_APISERVER, sizeof(struct registered_opaque_type));
|
||||||
regtype->lsa_type = lsa_type;
|
regtype->lsa_type = lsa_type;
|
||||||
regtype->opaque_type = opaque_type;
|
regtype->opaque_type = opaque_type;
|
||||||
|
|
||||||
@ -1155,12 +1159,12 @@ int ospf_apiserver_handle_register_event(struct ospf_apiserver *apiserv,
|
|||||||
seqnum = msg_get_seq(msg);
|
seqnum = msg_get_seq(msg);
|
||||||
|
|
||||||
/* Free existing filter in apiserv. */
|
/* Free existing filter in apiserv. */
|
||||||
XFREE(MTYPE_OSPF_APISERVER_MSGFILTER, apiserv->filter);
|
XFREE(MTYPE_APISERVER_MSGFILTER, apiserv->filter);
|
||||||
/* Alloc new space for filter. */
|
/* Alloc new space for filter. */
|
||||||
size = ntohs(msg->hdr.msglen);
|
size = ntohs(msg->hdr.msglen);
|
||||||
if (size < OSPF_MAX_LSA_SIZE) {
|
if (size < OSPF_MAX_LSA_SIZE) {
|
||||||
|
|
||||||
apiserv->filter = XMALLOC(MTYPE_OSPF_APISERVER_MSGFILTER, size);
|
apiserv->filter = XMALLOC(MTYPE_APISERVER_MSGFILTER, size);
|
||||||
|
|
||||||
/* copy it over. */
|
/* copy it over. */
|
||||||
memcpy(apiserv->filter, &rmsg->filter, size);
|
memcpy(apiserv->filter, &rmsg->filter, size);
|
||||||
@ -1365,8 +1369,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* send all adds based on current reachable routers */
|
/* send all adds based on current reachable routers */
|
||||||
a = abuf = XCALLOC(MTYPE_OSPF_APISERVER,
|
a = abuf = XCALLOC(MTYPE_APISERVER, sizeof(struct in_addr) * rt->count);
|
||||||
sizeof(struct in_addr) * rt->count);
|
|
||||||
for (struct route_node *rn = route_top(rt); rn; rn = route_next(rn))
|
for (struct route_node *rn = route_top(rt); rn; rn = route_next(rn))
|
||||||
if (listhead((struct list *)rn->info))
|
if (listhead((struct list *)rn->info))
|
||||||
*a++ = rn->p.u.prefix4;
|
*a++ = rn->p.u.prefix4;
|
||||||
@ -1385,7 +1388,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv,
|
|||||||
rc = ospf_apiserver_send_msg(apiserv, amsg);
|
rc = ospf_apiserver_send_msg(apiserv, amsg);
|
||||||
msg_free(amsg);
|
msg_free(amsg);
|
||||||
}
|
}
|
||||||
XFREE(MTYPE_OSPF_APISERVER, abuf);
|
XFREE(MTYPE_APISERVER, abuf);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* Send a reply back to client with return code */
|
/* Send a reply back to client with return code */
|
||||||
@ -2616,9 +2619,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (nrt && nrt->count)
|
if (nrt && nrt->count)
|
||||||
a = abuf = XCALLOC(MTYPE_OSPF_APISERVER, insz * nrt->count);
|
a = abuf = XCALLOC(MTYPE_APISERVER, insz * nrt->count);
|
||||||
if (ort && ort->count)
|
if (ort && ort->count)
|
||||||
d = dbuf = XCALLOC(MTYPE_OSPF_APISERVER, insz * ort->count);
|
d = dbuf = XCALLOC(MTYPE_APISERVER, insz * ort->count);
|
||||||
|
|
||||||
/* walk both tables */
|
/* walk both tables */
|
||||||
orn = ort ? route_top(ort) : NULL;
|
orn = ort ? route_top(ort) : NULL;
|
||||||
@ -2683,9 +2686,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort,
|
|||||||
msg_free(msg);
|
msg_free(msg);
|
||||||
}
|
}
|
||||||
if (abuf)
|
if (abuf)
|
||||||
XFREE(MTYPE_OSPF_APISERVER, abuf);
|
XFREE(MTYPE_APISERVER, abuf);
|
||||||
if (dbuf)
|
if (dbuf)
|
||||||
XFREE(MTYPE_OSPF_APISERVER, dbuf);
|
XFREE(MTYPE_APISERVER, dbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
#include "ospf_api.h"
|
#include "ospf_api.h"
|
||||||
#include "ospf_lsdb.h"
|
#include "ospf_lsdb.h"
|
||||||
|
|
||||||
/* MTYPE definition is not reflected to "memory.h". */
|
|
||||||
#define MTYPE_OSPF_APISERVER MTYPE_TMP
|
|
||||||
#define MTYPE_OSPF_APISERVER_MSGFILTER MTYPE_TMP
|
|
||||||
|
|
||||||
/* List of opaque types that application registered */
|
/* List of opaque types that application registered */
|
||||||
struct registered_opaque_type {
|
struct registered_opaque_type {
|
||||||
uint8_t lsa_type;
|
uint8_t lsa_type;
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
#include "ospfd/ospf_route.h"
|
#include "ospfd/ospf_route.h"
|
||||||
#include "ospfd/ospf_zebra.h"
|
#include "ospfd/ospf_zebra.h"
|
||||||
|
|
||||||
|
DEFINE_MTYPE_STATIC(OSPFD, SNMP, "OSPF SNMP");
|
||||||
|
|
||||||
/* OSPF2-MIB. */
|
/* OSPF2-MIB. */
|
||||||
#define OSPF2MIB 1,3,6,1,2,1,14
|
#define OSPF2MIB 1,3,6,1,2,1,14
|
||||||
|
|
||||||
@ -1321,12 +1323,12 @@ struct ospf_snmp_if {
|
|||||||
|
|
||||||
static struct ospf_snmp_if *ospf_snmp_if_new(void)
|
static struct ospf_snmp_if *ospf_snmp_if_new(void)
|
||||||
{
|
{
|
||||||
return XCALLOC(MTYPE_TMP, sizeof(struct ospf_snmp_if));
|
return XCALLOC(MTYPE_SNMP, sizeof(struct ospf_snmp_if));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ospf_snmp_if_free(struct ospf_snmp_if *osif)
|
static void ospf_snmp_if_free(struct ospf_snmp_if *osif)
|
||||||
{
|
{
|
||||||
XFREE(MTYPE_TMP, osif);
|
XFREE(MTYPE_SNMP, osif);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ospf_snmp_if_delete(struct interface *ifp)
|
static int ospf_snmp_if_delete(struct interface *ifp)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
if OSPFD
|
if OSPFD
|
||||||
noinst_LIBRARIES += ospfd/libfrrospf.a
|
noinst_LIBRARIES += ospfd/libfrrospf.a
|
||||||
|
noinst_LIBRARIES += ospfd/libfrrospfclient.a
|
||||||
sbin_PROGRAMS += ospfd/ospfd
|
sbin_PROGRAMS += ospfd/ospfd
|
||||||
vtysh_daemons += ospfd
|
vtysh_daemons += ospfd
|
||||||
if SNMP
|
if SNMP
|
||||||
@ -12,6 +13,11 @@ endif
|
|||||||
man8 += $(MANBUILD)/frr-ospfd.8
|
man8 += $(MANBUILD)/frr-ospfd.8
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ospfd_libfrrospfclient_a_SOURCES = \
|
||||||
|
ospfd/ospf_api.c \
|
||||||
|
ospfd/ospf_dump_api.c \
|
||||||
|
#end
|
||||||
|
|
||||||
ospfd_libfrrospf_a_SOURCES = \
|
ospfd_libfrrospf_a_SOURCES = \
|
||||||
ospfd/ospf_abr.c \
|
ospfd/ospf_abr.c \
|
||||||
ospfd/ospf_api.c \
|
ospfd/ospf_api.c \
|
||||||
@ -104,7 +110,7 @@ noinst_HEADERS += \
|
|||||||
ospfd/ospf_zebra.h \
|
ospfd/ospf_zebra.h \
|
||||||
# end
|
# end
|
||||||
|
|
||||||
ospfd_ospfd_LDADD = ospfd/libfrrospf.a lib/libfrr.la $(LIBCAP) $(LIBM)
|
ospfd_ospfd_LDADD = ospfd/libfrrospf.a ospfd/libfrrospfclient.a lib/libfrr.la $(LIBCAP) $(LIBM)
|
||||||
ospfd_ospfd_SOURCES = ospfd/ospf_main.c
|
ospfd_ospfd_SOURCES = ospfd/ospf_main.c
|
||||||
|
|
||||||
ospfd_ospfd_snmp_la_SOURCES = ospfd/ospf_snmp.c
|
ospfd_ospfd_snmp_la_SOURCES = ospfd/ospf_snmp.c
|
||||||
|
Loading…
Reference in New Issue
Block a user