ospf6d: improve ordered shutdown
Improve the _disable/_enable infrastructure so it gets into
a more usable shape and make 'no router ospf6' actually work.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 86c0bf6..d9d2d03 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -219,31 +219,28 @@
ospf6_interface_enable (struct ospf6_interface *oi)
{
UNSET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
-
- oi->thread_send_hello =
- thread_add_event (master, ospf6_hello_send, oi, 0);
+ ospf6_interface_state_update (oi->interface);
}
void
ospf6_interface_disable (struct ospf6_interface *oi)
{
- struct listnode *node, *nnode;
- struct ospf6_neighbor *on;
-
SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE);
- for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
- ospf6_neighbor_delete (on);
-
- list_delete_all_node (oi->neighbor_list);
+ thread_execute (master, interface_down, oi, 0);
ospf6_lsdb_remove_all (oi->lsdb);
+ ospf6_lsdb_remove_all (oi->lsdb_self);
ospf6_lsdb_remove_all (oi->lsupdate_list);
ospf6_lsdb_remove_all (oi->lsack_list);
THREAD_OFF (oi->thread_send_hello);
THREAD_OFF (oi->thread_send_lsupdate);
THREAD_OFF (oi->thread_send_lsack);
+
+ THREAD_OFF (oi->thread_network_lsa);
+ THREAD_OFF (oi->thread_link_lsa);
+ THREAD_OFF (oi->thread_intra_prefix_lsa);
}
static struct in6_addr *
@@ -327,6 +324,8 @@
return;
if (oi->area == NULL)
return;
+ if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
+ return;
if (if_is_operative (ifp))
thread_add_event (master, interface_up, oi, 0);
@@ -355,6 +354,9 @@
if (oi->area == NULL)
return;
+ if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
+ return;
+
/* update "route to advertise" interface route table */
ospf6_route_remove_all (oi->route_connected);