diff options
Diffstat (limited to 'ospfd/ospf_apiserver.c')
| -rw-r--r-- | ospfd/ospf_apiserver.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index a5fb42b851..6415fda1fc 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -56,10 +56,14 @@ #include "ospfd/ospf_ase.h" #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_errors.h" +#include "ospfd/ospf_memory.h" #include "ospfd/ospf_api.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 * external applications to access the OSPF daemon through socket * connections. The application can use this API to inject its own @@ -250,9 +254,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 *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)); new->fd_sync = fd_sync; @@ -368,7 +372,7 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv) (void *)apiserv, apiserver_list->count); /* And free instance. */ - XFREE(MTYPE_OSPF_APISERVER, apiserv); + XFREE(MTYPE_APISERVER, apiserv); } void ospf_apiserver_read(struct thread *thread) @@ -870,8 +874,8 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv, connection shuts down, we can flush all LSAs of this opaque type. */ - regtype = XCALLOC(MTYPE_OSPF_APISERVER, - sizeof(struct registered_opaque_type)); + regtype = + XCALLOC(MTYPE_APISERVER, sizeof(struct registered_opaque_type)); regtype->lsa_type = lsa_type; regtype->opaque_type = opaque_type; @@ -1164,12 +1168,12 @@ int ospf_apiserver_handle_register_event(struct ospf_apiserver *apiserv, seqnum = msg_get_seq(msg); /* Free existing filter in apiserv. */ - XFREE(MTYPE_OSPF_APISERVER_MSGFILTER, apiserv->filter); + XFREE(MTYPE_APISERVER_MSGFILTER, apiserv->filter); /* Alloc new space for filter. */ size = ntohs(msg->hdr.msglen); if (size < OSPF_MAX_LSA_SIZE) { - apiserv->filter = XMALLOC(MTYPE_OSPF_APISERVER_MSGFILTER, size); + apiserv->filter = XMALLOC(MTYPE_APISERVER_MSGFILTER, size); /* copy it over. */ memcpy(apiserv->filter, &rmsg->filter, size); @@ -1374,8 +1378,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv, goto out; /* send all adds based on current reachable routers */ - a = abuf = XCALLOC(MTYPE_OSPF_APISERVER, - sizeof(struct in_addr) * rt->count); + a = abuf = XCALLOC(MTYPE_APISERVER, sizeof(struct in_addr) * rt->count); for (struct route_node *rn = route_top(rt); rn; rn = route_next(rn)) if (listhead((struct list *)rn->info)) *a++ = rn->p.u.prefix4; @@ -1394,7 +1397,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv, rc = ospf_apiserver_send_msg(apiserv, amsg); msg_free(amsg); } - XFREE(MTYPE_OSPF_APISERVER, abuf); + XFREE(MTYPE_APISERVER, abuf); out: /* Send a reply back to client with return code */ @@ -2628,9 +2631,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort, return; } 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) - d = dbuf = XCALLOC(MTYPE_OSPF_APISERVER, insz * ort->count); + d = dbuf = XCALLOC(MTYPE_APISERVER, insz * ort->count); /* walk both tables */ orn = ort ? route_top(ort) : NULL; @@ -2695,9 +2698,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort, msg_free(msg); } if (abuf) - XFREE(MTYPE_OSPF_APISERVER, abuf); + XFREE(MTYPE_APISERVER, abuf); if (dbuf) - XFREE(MTYPE_OSPF_APISERVER, dbuf); + XFREE(MTYPE_APISERVER, dbuf); } |
