]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: upon interface deletion, the area if list may be updated
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 14 Feb 2019 13:04:45 +0000 (14:04 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 14 Feb 2019 17:24:01 +0000 (18:24 +0100)
there are some events where the list of interfaces per area should be
reviewed due to an interface is being removed. This fix avoids having
some memory leak.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
ospf6d/ospf6_area.c
ospf6d/ospf6_area.h
ospf6d/ospf6_interface.c

index 30f0e9e77421daaf10c682c71a0ab3d422a78989..76722aad1028550c37df5510352adfaa11cfb892 100644 (file)
@@ -1022,3 +1022,16 @@ void ospf6_area_init(void)
        install_element(OSPF6_NODE, &area_filter_list_cmd);
        install_element(OSPF6_NODE, &no_area_filter_list_cmd);
 }
+
+void ospf6_area_interface_delete(struct ospf6_interface *oi)
+{
+       struct ospf6_area *oa;
+       struct listnode *node, *nnode;
+
+       if (!ospf6)
+               return;
+       for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
+               if(listnode_lookup(oa->if_list, oi))
+                       listnode_delete(oa->if_list, oi);
+
+}
index ba497a168e987b9ed3d60a897e0cc6b67e30482b..5648b1dfec3aa2fe123b6b52971c2688295af26b 100644 (file)
@@ -132,5 +132,7 @@ extern void ospf6_area_show(struct vty *, struct ospf6_area *);
 extern void ospf6_area_plist_update(struct prefix_list *plist, int add);
 extern void ospf6_area_config_write(struct vty *vty);
 extern void ospf6_area_init(void);
+struct ospf6_interface;
+extern void ospf6_area_interface_delete(struct ospf6_interface *oi);
 
 #endif /* OSPF_AREA_H */
index dd08144daaf33ece08b4f7a3dcc6e9c21fbf074a..83b9001fea9cdf3498337ad405d56e74d1e2fd6f 100644 (file)
@@ -269,6 +269,9 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
 
        ospf6_bfd_info_free(&(oi->bfd_info));
 
+       /* disable from area list if possible */
+       ospf6_area_interface_delete(oi);
+
        XFREE(MTYPE_OSPF6_IF, oi);
 }