summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pimd/pim_upstream.c23
-rw-r--r--pimd/pim_upstream.h1
2 files changed, 9 insertions, 15 deletions
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index b5f5f646d4..37dff2d058 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -140,12 +140,6 @@ static struct pim_upstream *pim_upstream_find_parent(struct pim_instance *pim,
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) {
@@ -209,11 +203,6 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
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;
@@ -237,7 +226,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
}
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
- pim_upstream_free(up);
+ XFREE(MTYPE_PIM_UPSTREAM, up);
return NULL;
}
@@ -1545,8 +1534,15 @@ unsigned int pim_upstream_hash_key(void *arg)
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);
@@ -1773,6 +1769,5 @@ void pim_upstream_init(struct pim_instance *pim)
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;
}
diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h
index b75a5b9df3..ba133b39dd 100644
--- a/pimd/pim_upstream.h
+++ b/pimd/pim_upstream.h
@@ -137,7 +137,6 @@ struct pim_upstream {
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,