zif->link_ifindex = link_ifindex;
if (desc) {
- XFREE(MTYPE_TMP, zif->desc);
- zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ XFREE(MTYPE_ZIF_DESC, zif->desc);
+ zif->desc = XSTRDUP(MTYPE_ZIF_DESC, desc);
}
/* Hardware type and address. */
zif = ifp->info;
if (zif) {
- XFREE(MTYPE_TMP, zif->desc);
+ XFREE(MTYPE_ZIF_DESC, zif->desc);
if (desc)
- zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ zif->desc = XSTRDUP(MTYPE_ZIF_DESC, desc);
}
} else {
/* Delete interface notification from kernel */
DEFINE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp),
(vty, ifp));
+DEFINE_MTYPE(ZEBRA, ZIF_DESC, "Intf desc");
static void if_down_del_nbr_connected(struct interface *ifp);
if_nhg_dependents_release(ifp);
zebra_if_nhg_dependents_free(zebra_if);
- XFREE(MTYPE_TMP, zebra_if->desc);
+ XFREE(MTYPE_ZIF_DESC, zebra_if->desc);
THREAD_OFF(zebra_if->speed_update);
#define ZEBRA_IF_IS_PROTODOWN_ONLY_EXTERNAL(zif) \
((zif)->protodown_rc == ZEBRA_PROTODOWN_EXTERNAL)
+/* Mem type for zif desc */
+DECLARE_MTYPE(ZIF_DESC);
+
/* `zebra' daemon local interface structure. */
struct zebra_if {
/* back pointer to the interface */
static struct Adv *Adv_new(void)
{
- return XCALLOC(MTYPE_TMP, sizeof(struct Adv));
+ return XCALLOC(MTYPE_IRDP_IF, sizeof(struct Adv));
}
static void Adv_free(struct Adv *adv)
{
- XFREE(MTYPE_TMP, adv);
+ XFREE(MTYPE_IRDP_IF, adv);
}
static void irdp_if_start(struct interface *ifp, int multicast,
static inline void zread_iptable(ZAPI_HANDLER_ARGS)
{
struct zebra_pbr_iptable *zpi =
- XCALLOC(MTYPE_TMP, sizeof(struct zebra_pbr_iptable));
+ XCALLOC(MTYPE_PBR_OBJ, sizeof(struct zebra_pbr_iptable));
struct stream *s;
s = msg;
#include "zebra/debug.h"
#include "zebra/zapi_msg.h"
+DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_GR, "GR");
/*
* Forward declaration.
{
struct client_gr_info *info;
- info = XCALLOC(MTYPE_TMP, sizeof(struct client_gr_info));
+ info = XCALLOC(MTYPE_ZEBRA_GR, sizeof(struct client_gr_info));
TAILQ_INSERT_TAIL(&(client->gr_info_queue), info, gr_info);
return info;
THREAD_OFF(info->t_stale_removal);
- XFREE(MTYPE_TMP, info->current_prefix);
+ XFREE(MTYPE_ZEBRA_GR, info->current_prefix);
LOG_GR("%s: Instance info is being deleted for client %s", __func__,
zebra_route_string(client->proto));
info->do_delete = true;
zebra_gr_delete_stale_routes(info);
- XFREE(MTYPE_TMP, info);
+ XFREE(MTYPE_ZEBRA_GR, info);
}
/*
TAILQ_INIT(&(s_client->gr_info_queue));
listnode_delete(zrouter.stale_client_list, s_client);
if (info->stale_client)
- XFREE(MTYPE_TMP, s_client);
- XFREE(MTYPE_TMP, info);
+ zserv_client_delete(s_client);
+ XFREE(MTYPE_ZEBRA_GR, info);
}
/*
/* Delete the stale client */
listnode_delete(zrouter.stale_client_list, old_client);
/* Delete old client */
- XFREE(MTYPE_TMP, old_client);
+ zserv_client_delete(old_client);
}
/*
LOG_GR("%s: Client %s all stale routes processed", __func__,
zebra_route_string(client->proto));
- XFREE(MTYPE_TMP, info->current_prefix);
+ XFREE(MTYPE_ZEBRA_GR, info->current_prefix);
info->current_afi = 0;
zebra_gr_delete_stale_client(info);
}
&& (info->do_delete == false)) {
info->current_afi = afi;
info->current_prefix = XCALLOC(
- MTYPE_TMP,
+ MTYPE_ZEBRA_GR,
sizeof(struct prefix));
prefix_copy(
info->current_prefix,
* Reset the current prefix to indicate processing completion
* of the current AFI
*/
- XFREE(MTYPE_TMP, info->current_prefix);
+ XFREE(MTYPE_ZEBRA_GR, info->current_prefix);
}
return 0;
}
/* definitions */
DEFINE_MTYPE_STATIC(ZEBRA, PBR_IPTABLE_IFNAME, "PBR interface list");
+DEFINE_MTYPE(ZEBRA, PBR_OBJ, "PBR");
/* definitions */
static const struct message ipset_type_msg[] = {
rule = (struct zebra_pbr_rule *)arg;
(void)dplane_pbr_rule_delete(rule);
- XFREE(MTYPE_TMP, rule);
+ XFREE(MTYPE_PBR_OBJ, rule);
}
uint32_t zebra_pbr_rules_hash_key(const void *arg)
ipset = (struct zebra_pbr_ipset *)arg;
hook_call(zebra_pbr_ipset_update, 0, ipset);
- XFREE(MTYPE_TMP, ipset);
+ XFREE(MTYPE_PBR_OBJ, ipset);
}
uint32_t zebra_pbr_ipset_hash_key(const void *arg)
hook_call(zebra_pbr_ipset_entry_update, 0, ipset);
- XFREE(MTYPE_TMP, ipset);
+ XFREE(MTYPE_PBR_OBJ, ipset);
}
uint32_t zebra_pbr_ipset_entry_hash_key(const void *arg)
}
list_delete(&iptable->interface_name_list);
}
- XFREE(MTYPE_TMP, iptable);
+ XFREE(MTYPE_PBR_OBJ, iptable);
}
void zebra_pbr_iptable_free(void *arg)
zpr = (struct zebra_pbr_rule *)arg;
- new = XCALLOC(MTYPE_TMP, sizeof(*new));
+ new = XCALLOC(MTYPE_PBR_OBJ, sizeof(*new));
memcpy(new, zpr, sizeof(*zpr));
zebra_neigh_deref(hash_data);
hash_release(zrouter.rules_hash, hash_data);
if (free_data) {
- XFREE(MTYPE_TMP, hash_data);
+ XFREE(MTYPE_PBR_OBJ, hash_data);
return NULL;
}
(void)dplane_pbr_rule_update(found, new);
/* release the old hash data */
if (old)
- XFREE(MTYPE_TMP, old);
+ XFREE(MTYPE_PBR_OBJ, old);
} else {
if (IS_ZEBRA_DEBUG_PBR)
zlog_debug(
zpi = (struct zebra_pbr_ipset *)arg;
- new = XCALLOC(MTYPE_TMP, sizeof(struct zebra_pbr_ipset));
+ new = XCALLOC(MTYPE_PBR_OBJ, sizeof(struct zebra_pbr_ipset));
memcpy(new, zpi, sizeof(*zpi));
(void)dplane_pbr_ipset_delete(ipset);
if (lookup) {
hash_release(zrouter.ipset_hash, lookup);
- XFREE(MTYPE_TMP, lookup);
+ XFREE(MTYPE_PBR_OBJ, lookup);
} else
zlog_debug(
"%s: IPSet Entry being deleted we know nothing about",
zpi = (struct zebra_pbr_ipset_entry *)arg;
- new = XCALLOC(MTYPE_TMP, sizeof(struct zebra_pbr_ipset_entry));
+ new = XCALLOC(MTYPE_PBR_OBJ, sizeof(struct zebra_pbr_ipset_entry));
memcpy(new, zpi, sizeof(*zpi));
(void)dplane_pbr_ipset_entry_delete(ipset);
if (lookup) {
hash_release(zrouter.ipset_entry_hash, lookup);
- XFREE(MTYPE_TMP, lookup);
+ XFREE(MTYPE_PBR_OBJ, lookup);
} else
zlog_debug("%s: IPSet being deleted we know nothing about",
__func__);
zpi = (struct zebra_pbr_iptable *)arg;
- new = XCALLOC(MTYPE_TMP, sizeof(struct zebra_pbr_iptable));
+ new = XCALLOC(MTYPE_PBR_OBJ, sizeof(struct zebra_pbr_iptable));
/* Deep structure copy */
memcpy(new, zpi, sizeof(*zpi));
node);
}
list_delete(&iptable->interface_name_list);
- XFREE(MTYPE_TMP, lookup);
+ XFREE(MTYPE_PBR_OBJ, lookup);
} else
zlog_debug("%s: IPTable being deleted we know nothing about",
__func__);
extern "C" {
#endif
+/* Memory type for PBR objects. */
+DECLARE_MTYPE(PBR_OBJ);
+
struct zebra_pbr_action {
afi_t afi;
unsigned short instance,
uint32_t session_id);
+/* Mem type for zclients. */
+DEFINE_MTYPE_STATIC(ZEBRA, ZSERV_CLIENT, "ZClients");
/*
* Client thread events.
/* Client thread lifecycle -------------------------------------------------- */
+/*
+ * Free a zserv client object.
+ */
+void zserv_client_delete(struct zserv *client)
+{
+ XFREE(MTYPE_ZSERV_CLIENT, client);
+}
+
/*
* Log zapi message to zlog.
*
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("%s: Deleting client %s", __func__,
zebra_route_string(client->proto));
- XFREE(MTYPE_TMP, client);
+ zserv_client_delete(client);
} else {
/* Handle cases where client has GR instance. */
if (IS_ZEBRA_DEBUG_EVENT)
int i;
afi_t afi;
- client = XCALLOC(MTYPE_TMP, sizeof(struct zserv));
+ client = XCALLOC(MTYPE_ZSERV_CLIENT, sizeof(struct zserv));
/* Make client input/output buffer. */
client->sock = sock;
*/
extern void zserv_close_client(struct zserv *client);
+/*
+ * Free memory for a zserv client object - note that this does not
+ * clean up the internal allocations associated with the zserv client,
+ * this just free the struct's memory.
+ */
+void zserv_client_delete(struct zserv *client);
+
/*
* Log a ZAPI message hexdump.
*