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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <lib/version.h>
31 #include "memory_vty.h"
44 #include "ospf6_top.h"
45 #include "ospf6_message.h"
46 #include "ospf6_asbr.h"
47 #include "ospf6_lsa.h"
48 #include "ospf6_interface.h"
49 #include "ospf6_zebra.h"
51 /* Default configuration file name for ospf6d. */
52 #define OSPF6_DEFAULT_CONFIG "ospf6d.conf"
54 /* Default port values. */
55 #define OSPF6_VTY_PORT 2606
57 /* ospf6d privileges */
58 zebra_capabilities_t _caps_p
[] = {ZCAP_NET_RAW
, ZCAP_BIND
};
60 struct zebra_privs_t ospf6d_privs
= {
68 .vty_group
= VTY_GROUP
,
74 /* ospf6d options, we use GNU getopt library. */
75 struct option longopts
[] = {{0}};
77 /* Master of threads. */
78 struct thread_master
*master
;
80 static void __attribute__((noreturn
)) ospf6_exit(int status
)
82 struct listnode
*node
;
83 struct interface
*ifp
;
92 for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT
), node
, ifp
))
93 if (ifp
->info
!= NULL
)
94 ospf6_interface_delete(ifp
->info
);
96 ospf6_message_terminate();
97 ospf6_asbr_terminate();
98 ospf6_lsa_terminate();
103 zclient_stop(zclient
);
104 zclient_free(zclient
);
111 /* SIGHUP handler. */
112 static void sighup(void)
114 zlog_info("SIGHUP received");
117 /* SIGINT handler. */
118 static void sigint(void)
120 zlog_notice("Terminating on signal SIGINT");
124 /* SIGTERM handler. */
125 static void sigterm(void)
127 zlog_notice("Terminating on signal SIGTERM");
132 /* SIGUSR1 handler. */
133 static void sigusr1(void)
135 zlog_info("SIGUSR1 received");
139 struct quagga_signal_t ospf6_signals
[] = {
158 FRR_DAEMON_INFO(ospf6d
, OSPF6
, .vty_port
= OSPF6_VTY_PORT
,
160 .proghelp
= "Implementation of the OSPFv3 routing protocol.",
162 .signals
= ospf6_signals
,
163 .n_signals
= array_size(ospf6_signals
),
165 .privs
= &ospf6d_privs
, )
167 /* Main routine of ospf6d. Treatment of argument and starting ospf finite
168 state machine is handled here. */
169 int main(int argc
, char *argv
[], char *envp
[])
173 frr_preinit(&ospf6d_di
, argc
, argv
);
174 frr_opt_add("", longopts
, "");
176 /* Command line argument treatment. */
178 opt
= frr_getopt(argc
, argv
, NULL
);
192 if (geteuid() != 0) {
194 perror(ospf6d_di
.progname
);
201 vrf_init(NULL
, NULL
, NULL
, NULL
);
205 /* initialize ospf6 */