2 * Copyright (C) 1999 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #include <lib/version.h>
32 #include "memory_vty.h"
45 #include "ospf6_top.h"
46 #include "ospf6_message.h"
47 #include "ospf6_asbr.h"
48 #include "ospf6_lsa.h"
49 #include "ospf6_interface.h"
50 #include "ospf6_zebra.h"
52 /* Default configuration file name for ospf6d. */
53 #define OSPF6_DEFAULT_CONFIG "ospf6d.conf"
55 /* Default port values. */
56 #define OSPF6_VTY_PORT 2606
58 /* ospf6d privileges */
59 zebra_capabilities_t _caps_p
[] = {ZCAP_NET_RAW
, ZCAP_BIND
};
61 struct zebra_privs_t ospf6d_privs
= {
69 .vty_group
= VTY_GROUP
,
75 /* ospf6d options, we use GNU getopt library. */
76 struct option longopts
[] = {{0}};
78 /* Master of threads. */
79 struct thread_master
*master
;
81 static void __attribute__((noreturn
)) ospf6_exit(int status
)
83 struct listnode
*node
;
84 struct interface
*ifp
;
91 for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT
), node
, ifp
))
92 if (ifp
->info
!= NULL
)
93 ospf6_interface_delete(ifp
->info
);
95 ospf6_message_terminate();
96 ospf6_asbr_terminate();
97 ospf6_lsa_terminate();
104 zclient_free(zclient
);
107 thread_master_free(master
);
114 /* SIGHUP handler. */
115 static void sighup(void)
117 zlog_info("SIGHUP received");
120 /* SIGINT handler. */
121 static void sigint(void)
123 zlog_notice("Terminating on signal SIGINT");
127 /* SIGTERM handler. */
128 static void sigterm(void)
130 zlog_notice("Terminating on signal SIGTERM");
135 /* SIGUSR1 handler. */
136 static void sigusr1(void)
138 zlog_info("SIGUSR1 received");
142 struct quagga_signal_t ospf6_signals
[] = {
161 FRR_DAEMON_INFO(ospf6d
, OSPF6
, .vty_port
= OSPF6_VTY_PORT
,
163 .proghelp
= "Implementation of the OSPFv3 routing protocol.",
165 .signals
= ospf6_signals
,
166 .n_signals
= array_size(ospf6_signals
),
168 .privs
= &ospf6d_privs
, )
170 /* Main routine of ospf6d. Treatment of argument and starting ospf finite
171 state machine is handled here. */
172 int main(int argc
, char *argv
[], char *envp
[])
176 frr_preinit(&ospf6d_di
, argc
, argv
);
177 frr_opt_add("", longopts
, "");
179 /* Command line argument treatment. */
181 opt
= frr_getopt(argc
, argv
, NULL
);
195 if (geteuid() != 0) {
197 perror(ospf6d_di
.progname
);
208 /* initialize ospf6 */