]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Cleanup ifchannel deletion
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 18:07:53 +0000 (14:07 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 11 May 2018 22:36:24 +0000 (18:36 -0400)
When we are being told to go away, cleanup ifchannel deletion
a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_upstream.c

index bb56379c14a2ec0585f8ffcc08470b7e6cf3dd04..5e6b0f10cf5e47a048bbca58aca0c09cabe47820 100644 (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)
 {
        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 ",
                           __PRETTY_FUNCTION__, ch->sg_str);
 
-       pim_ifchannel_free(ch);
+       XFREE(MTYPE_PIM_IFCHANNEL, ch);
 }
 
 void pim_ifchannel_delete_all(struct interface *ifp)
index 0af9ebf0beb925ca2b37563d020cca9f1327b02e..b9d4d291d854d910aeb96bd58048878b1786050d 100644 (file)
@@ -114,7 +114,6 @@ RB_HEAD(pim_ifchannel_rb, pim_ifchannel);
 RB_PROTOTYPE(pim_ifchannel_rb, pim_ifchannel, pim_ifp_rb,
             pim_ifchannel_compare);
 
-void pim_ifchannel_free(struct pim_ifchannel *ch);
 void pim_ifchannel_delete(struct pim_ifchannel *ch);
 void pim_ifchannel_delete_all(struct interface *ifp);
 void pim_ifchannel_membership_clear(struct interface *ifp);
index 37dff2d05883a7f0a3b41aedf5d9cd71c7956b5b..9329d72ce05536b16f04956efc80efe79aa0299b 100644 (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 *up, const char *name)
 {
+       struct listnode *node, *nnode;
+       struct pim_ifchannel *ch;
        bool notify_msdp = false;
        struct prefix nht_p;
 
@@ -194,15 +196,17 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
                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__);
        upstream_channel_oil_detach(up);
 
+       for (ALL_LIST_ELEMENTS(up->ifchannels, node, nnode, ch))
+               pim_ifchannel_delete(ch);
        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)
                listnode_delete(up->parent->sources, up);
        up->parent = NULL;