ospf6d: Have ospf6d cleanup when it terminates normally

A clean exit makes it easier to use memory debuggers.

* ospf6_asbr.c: (ospf6_asbr_terminate) Add a function to do route map
  cleanup.
* ospf6_lsa.c: (ospf6_lsa_terminate) Add a function to cleanup the lsa
  handler vector.
* ospf6_main.c: (ospf6_exit) Add an function that causes ospf6d to
  gracefully exit.
* ospf6_message.c: (ospf6_message_terminate) Add a function that frees
  the send and receive buffers.
* ospf6_top.c: (ospf6_delete) Enable the ospf6_delete() function.
  Disable ospf6 before freeing everything.
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 8237026..2b65be8 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -51,6 +51,8 @@
 /* global ospf6d variable */
 struct ospf6 *ospf6;
 
+static void ospf6_disable (struct ospf6 *o);
+
 static void
 ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa)
 {
@@ -143,15 +145,17 @@
   return o;
 }
 
-#if 0
-static void
+void
 ospf6_delete (struct ospf6 *o)
 {
   struct listnode *node, *nnode;
   struct ospf6_area *oa;
 
+  ospf6_disable (ospf6);
+
   for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
     ospf6_area_delete (oa);
+  list_delete (o->area_list);
 
   ospf6_lsdb_delete (o->lsdb);
   ospf6_lsdb_delete (o->lsdb_self);
@@ -164,7 +168,6 @@
 
   XFREE (MTYPE_OSPF6_TOP, o);
 }
-#endif
 
 static void
 ospf6_enable (struct ospf6 *o)