pimd: Cleanup ifchannel deletion

When we are being told to go away, cleanup ifchannel deletion
a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-05-11 14:07:53 -04:00
parent 845d9af76a
commit 7692c5ae82
3 changed files with 9 additions and 11 deletions

View File

@ -124,11 +124,6 @@ static void pim_ifchannel_find_new_children(struct pim_ifchannel *ch)
} }
} }
void pim_ifchannel_free(struct pim_ifchannel *ch)
{
XFREE(MTYPE_PIM_IFCHANNEL, ch);
}
void pim_ifchannel_delete(struct pim_ifchannel *ch) void pim_ifchannel_delete(struct pim_ifchannel *ch)
{ {
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
@ -198,7 +193,7 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
zlog_debug("%s: ifchannel entry %s is deleted ", zlog_debug("%s: ifchannel entry %s is deleted ",
__PRETTY_FUNCTION__, ch->sg_str); __PRETTY_FUNCTION__, ch->sg_str);
pim_ifchannel_free(ch); XFREE(MTYPE_PIM_IFCHANNEL, ch);
} }
void pim_ifchannel_delete_all(struct interface *ifp) void pim_ifchannel_delete_all(struct interface *ifp)

View File

@ -114,7 +114,6 @@ RB_HEAD(pim_ifchannel_rb, pim_ifchannel);
RB_PROTOTYPE(pim_ifchannel_rb, pim_ifchannel, pim_ifp_rb, RB_PROTOTYPE(pim_ifchannel_rb, pim_ifchannel, pim_ifp_rb,
pim_ifchannel_compare); pim_ifchannel_compare);
void pim_ifchannel_free(struct pim_ifchannel *ch);
void pim_ifchannel_delete(struct pim_ifchannel *ch); void pim_ifchannel_delete(struct pim_ifchannel *ch);
void pim_ifchannel_delete_all(struct interface *ifp); void pim_ifchannel_delete_all(struct interface *ifp);
void pim_ifchannel_membership_clear(struct interface *ifp); void pim_ifchannel_membership_clear(struct interface *ifp);

View File

@ -155,6 +155,8 @@ static void upstream_channel_oil_detach(struct pim_upstream *up)
struct pim_upstream *pim_upstream_del(struct pim_instance *pim, struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
struct pim_upstream *up, const char *name) struct pim_upstream *up, const char *name)
{ {
struct listnode *node, *nnode;
struct pim_ifchannel *ch;
bool notify_msdp = false; bool notify_msdp = false;
struct prefix nht_p; struct prefix nht_p;
@ -194,15 +196,17 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
notify_msdp = true; notify_msdp = true;
} }
pim_upstream_remove_children(pim, up);
if (up->sources)
list_delete_and_null(&up->sources);
pim_mroute_del(up->channel_oil, __PRETTY_FUNCTION__); pim_mroute_del(up->channel_oil, __PRETTY_FUNCTION__);
upstream_channel_oil_detach(up); upstream_channel_oil_detach(up);
for (ALL_LIST_ELEMENTS(up->ifchannels, node, nnode, ch))
pim_ifchannel_delete(ch);
list_delete_and_null(&up->ifchannels); list_delete_and_null(&up->ifchannels);
pim_upstream_remove_children(pim, up);
if (up->sources)
list_delete_and_null(&up->sources);
if (up->parent && up->parent->sources) if (up->parent && up->parent->sources)
listnode_delete(up->parent->sources, up); listnode_delete(up->parent->sources, up);
up->parent = NULL; up->parent = NULL;