]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_main.c
build: move vtysh & manpage listings to subdir.am
[mirror_frr.git] / ospf6d / ospf6_main.c
index b76b40c5b3f34b8e18ace01e0dbffb42a9fc666a..eadc856cac25bc344effb7e440fd463d4bb96a0c 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -80,15 +79,17 @@ struct thread_master *master;
 
 static void __attribute__((noreturn)) ospf6_exit(int status)
 {
-       struct listnode *node;
+       struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        struct interface *ifp;
 
+       frr_early_fini();
+
        if (ospf6)
                ospf6_delete(ospf6);
 
        bfd_gbl_exit();
 
-       for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
+       FOR_ALL_INTERFACES (vrf, ifp)
                if (ifp->info != NULL)
                        ospf6_interface_delete(ifp->info);
 
@@ -96,18 +97,22 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
        ospf6_asbr_terminate();
        ospf6_lsa_terminate();
 
-       vrf_terminate();
-       vty_terminate();
-       cmd_terminate();
+       /* reverse access_list_init */
+       access_list_reset();
 
-       if (zclient)
-               zclient_free(zclient);
+       /* reverse prefix_list_init */
+       prefix_list_add_hook(NULL);
+       prefix_list_delete_hook(NULL);
+       prefix_list_reset();
 
-       if (master)
-               thread_master_free(master);
+       vrf_terminate();
 
-       closezlog();
+       if (zclient) {
+               zclient_stop(zclient);
+               zclient_free(zclient);
+       }
 
+       frr_fini();
        exit(status);
 }
 
@@ -128,7 +133,6 @@ static void sigint(void)
 static void sigterm(void)
 {
        zlog_notice("Terminating on signal SIGTERM");
-       ospf6_clean();
        ospf6_exit(0);
 }
 
@@ -198,10 +202,13 @@ int main(int argc, char *argv[], char *envp[])
                exit(1);
        }
 
+       /* OSPF6 master init. */
+       ospf6_master_init();
+
        /* thread master */
        master = frr_init();
 
-       vrf_init();
+       vrf_init(NULL, NULL, NULL, NULL, NULL);
        access_list_init();
        prefix_list_init();