summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-14 14:04:45 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-02-14 18:24:01 +0100
commit22b982dfe9eebe6c3ce0f39100d937650e24e082 (patch)
tree4cadae6d92e94fa5fe5df27aebdd0560ced69819 /ospf6d
parentospf6d: closing server socket when leaving ospf6d (diff)
downloadfrr-22b982dfe9eebe6c3ce0f39100d937650e24e082.tar.xz
frr-22b982dfe9eebe6c3ce0f39100d937650e24e082.zip
ospf6d: upon interface deletion, the area if list may be updated
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>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_area.c13
-rw-r--r--ospf6d/ospf6_area.h2
-rw-r--r--ospf6d/ospf6_interface.c3
3 files changed, 18 insertions, 0 deletions
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 30f0e9e77..76722aad1 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -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);
+
+}
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index ba497a168..5648b1dfe 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
@@ -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 */
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index dd08144da..83b9001fe 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -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);
}