return NULL;
}
-void pim_upstream_free(struct pim_upstream *up)
-{
- XFREE(MTYPE_PIM_UPSTREAM, up);
- up = NULL;
-}
-
static void upstream_channel_oil_detach(struct pim_upstream *up)
{
if (up->channel_oil) {
list_delete_and_null(&up->ifchannels);
- /*
- notice that listnode_delete() can't be moved
- into pim_upstream_free() because the later is
- called by list_delete_all_node()
- */
if (up->parent && up->parent->sources)
listnode_delete(up->parent->sources, up);
up->parent = NULL;
}
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
- pim_upstream_free(up);
+ XFREE(MTYPE_PIM_UPSTREAM, up);
return NULL;
}
void pim_upstream_terminate(struct pim_instance *pim)
{
- if (pim->upstream_list)
+ struct listnode *node, *nnode;
+ struct pim_upstream *up;
+
+ if (pim->upstream_list) {
+ for (ALL_LIST_ELEMENTS(pim->upstream_list, node, nnode, up))
+ pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
+
list_delete_and_null(&pim->upstream_list);
+ }
if (pim->upstream_hash)
hash_free(pim->upstream_hash);
pim_upstream_equal, hash_name);
pim->upstream_list = list_new();
- pim->upstream_list->del = (void (*)(void *))pim_upstream_free;
pim->upstream_list->cmp = pim_upstream_compare;
}
int64_t state_transition; /* Record current state uptime */
};
-void pim_upstream_free(struct pim_upstream *up);
struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
struct prefix_sg *sg);
struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,