]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Clean up the interface deletion
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 28 Oct 2016 00:35:22 +0000 (20:35 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:12 +0000 (20:26 -0500)
When cleaning up the interface, actually clean up
data associated with that interface.

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

index 3f3629395c5afb37eaec0341ef47a51f70af7cb0..50490fc9cb4bc9d08e4327ec95d9b6a4b1d84561 100644 (file)
@@ -185,16 +185,11 @@ void pim_if_delete(struct interface *ifp)
   if (pim_ifp->igmp_join_list) {
     pim_if_igmp_join_del_all(ifp);
   }
-  zassert(!pim_ifp->igmp_join_list);
 
-  zassert(pim_ifp->igmp_socket_list);
-  zassert(!listcount(pim_ifp->igmp_socket_list));
+  pim_ifchannel_delete_all (ifp);
+  igmp_sock_delete_all (ifp);
 
-  zassert(pim_ifp->pim_neighbor_list);
-  zassert(!listcount(pim_ifp->pim_neighbor_list));
-
-  zassert(pim_ifp->pim_ifchannel_list);
-  zassert(!listcount(pim_ifp->pim_ifchannel_list));
+  pim_neighbor_delete_all (ifp, "Interface removed from configuration");
 
   if (PIM_MROUTE_IS_ENABLED) {
     pim_if_del_vif(ifp);
index c2d27f1ec860fb718068794b20e9bece49c5db96..45d1d9434436ac915a4f29431dcc261e0eaee84f 100644 (file)
@@ -143,6 +143,23 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
 
   pim_ifchannel_free(ch);
 }
+
+void
+pim_ifchannel_delete_all (struct interface *ifp)
+{
+  struct pim_interface *pim_ifp;
+  struct listnode *ifchannel_node;
+  struct listnode *ifchannel_nextnode;
+  struct pim_ifchannel *ifchannel;
+
+  pim_ifp = ifp->info;
+
+  for (ALL_LIST_ELEMENTS (pim_ifp->pim_ifchannel_list, ifchannel_node,
+                         ifchannel_nextnode, ifchannel))
+    {
+      pim_ifchannel_delete (ifchannel);
+    }
+}
    
 static void delete_on_noinfo(struct pim_ifchannel *ch)
 {
index 8c542d17f2be44fad8a89c4793bbf78e41326acc..107762c65234306aad66c4663f6c183460c90e79 100644 (file)
@@ -100,6 +100,7 @@ struct pim_ifchannel {
 
 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);
 void pim_ifchannel_delete_on_noinfo(struct interface *ifp);
 struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
index 5532dc1dd06a0f44c41bcabcfcb45d3c53cb6227..04689a030fc94e35691abdd20cc0d19f8a57a2b6 100644 (file)
@@ -781,6 +781,22 @@ void igmp_sock_delete(struct igmp_sock *igmp)
   igmp_sock_free(igmp);
 }
 
+void
+igmp_sock_delete_all (struct interface *ifp)
+{
+  struct pim_interface *pim_ifp;
+  struct listnode *igmp_node, *igmp_nextnode;
+  struct igmp_sock *igmp;
+
+  pim_ifp = ifp->info;
+
+  for (ALL_LIST_ELEMENTS (pim_ifp->igmp_socket_list, igmp_node,
+                         igmp_nextnode, igmp))
+    {
+      igmp_sock_delete(igmp);
+    }
+}
+
 static struct igmp_sock *igmp_sock_new(int fd,
                                       struct in_addr ifaddr,
                                       struct interface *ifp)
index fa2c255dd09dcbe60b7c4eee5ae263c471cfd26b..c9000e3fd9c6eec856a1ee4ac61481f37b1e735a 100644 (file)
@@ -101,7 +101,7 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,
                                    struct interface *ifp);
 void igmp_sock_delete(struct igmp_sock *igmp);
 void igmp_sock_free(struct igmp_sock *igmp);
-
+void igmp_sock_delete_all (struct interface *ifp);
 int pim_igmp_packet(struct igmp_sock *igmp, char *buf, size_t len);
 
 void pim_igmp_general_query_on(struct igmp_sock *igmp);