]> git.proxmox.com Git - mirror_frr.git/blame - eigrpd/eigrp_main.c
*: add indent control files
[mirror_frr.git] / eigrpd / eigrp_main.c
CommitLineData
7f57883e
DS
1/*
2 * EIGRP Main Routine.
3 * Copyright (C) 2013-2015
4 * Authors:
5 * Donnie Savage
6 * Jan Janovic
7 * Matej Perina
8 * Peter Orsag
9 * Peter Paluch
10 * Frantisek Gazo
11 * Tomas Hvorkovy
12 * Martin Kontsek
13 * Lukas Koribsky
14 *
15 * This file is part of GNU Zebra.
16 *
17 * GNU Zebra is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2, or (at your option) any
20 * later version.
21 *
22 * GNU Zebra is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * General Public License for more details.
26 *
896014f4
DL
27 * You should have received a copy of the GNU General Public License along
28 * with this program; see the file COPYING; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
7f57883e
DS
30 */
31#include <zebra.h>
32
33#include <lib/version.h>
34#include "getopt.h"
35#include "thread.h"
36#include "prefix.h"
37#include "linklist.h"
38#include "if.h"
39#include "vector.h"
40#include "vty.h"
41#include "command.h"
42#include "filter.h"
43#include "plist.h"
44#include "stream.h"
45#include "log.h"
46#include "memory.h"
47#include "privs.h"
48#include "sigevent.h"
49#include "zclient.h"
50#include "keychain.h"
51#include "distribute.h"
52#include "libfrr.h"
53//#include "routemap.h"
54//#include "if_rmap.h"
55
56#include "eigrpd/eigrp_structs.h"
57#include "eigrpd/eigrpd.h"
58#include "eigrpd/eigrp_dump.h"
59#include "eigrpd/eigrp_interface.h"
60#include "eigrpd/eigrp_neighbor.h"
61#include "eigrpd/eigrp_packet.h"
62#include "eigrpd/eigrp_vty.h"
63#include "eigrpd/eigrp_zebra.h"
64#include "eigrpd/eigrp_network.h"
65#include "eigrpd/eigrp_snmp.h"
66#include "eigrpd/eigrp_filter.h"
67//#include "eigrpd/eigrp_routemap.h"
68
69/* eigprd privileges */
70zebra_capabilities_t _caps_p [] =
71{
72 ZCAP_NET_RAW,
73 ZCAP_BIND,
74 ZCAP_NET_ADMIN,
75};
76
77struct zebra_privs_t eigrpd_privs =
78{
79#if defined (FRR_USER) && defined (FRR_GROUP)
80 .user = FRR_USER,
81 .group = FRR_GROUP,
82#endif
83#if defined (VTY_GROUP)
84 .vty_group = VTY_GROUP,
85#endif
86 .caps_p = _caps_p,
87 .cap_num_p = array_size (_caps_p),
88 .cap_num_i = 0
89};
90
91/* EIGRPd options. */
92struct option longopts[] =
f9e5c9ca
DS
93 {
94 { 0 }
95 };
7f57883e
DS
96
97/* Master of threads. */
98struct thread_master *master;
99
100/* SIGHUP handler. */
101static void
102sighup (void)
103{
104 zlog_info ("SIGHUP received");
105}
106
107/* SIGINT / SIGTERM handler. */
108static void
109sigint (void)
110{
111 zlog_notice ("Terminating on signal");
112 eigrp_terminate ();
113}
114
115/* SIGUSR1 handler. */
116static void
117sigusr1 (void)
118{
119 zlog_rotate ();
120}
121
122struct quagga_signal_t eigrp_signals[] =
123{
124 {
125 .signal = SIGHUP,
126 .handler = &sighup,
127 },
128 {
129 .signal = SIGUSR1,
130 .handler = &sigusr1,
131 },
132 {
133 .signal = SIGINT,
134 .handler = &sigint,
135 },
136 {
137 .signal = SIGTERM,
138 .handler = &sigint,
139 },
140};
141
142FRR_DAEMON_INFO(eigrpd, EIGRP,
143 .vty_port = EIGRP_VTY_PORT,
144
145 .proghelp = "Implementation of the EIGRP routing protocol.",
146
147 .signals = eigrp_signals,
148 .n_signals = array_size(eigrp_signals),
149
150 .privs = &eigrpd_privs,
151 )
152
153/* EIGRPd main routine. */
154int
155main (int argc, char **argv, char **envp)
156{
157 frr_preinit (&eigrpd_di, argc, argv);
158 frr_opt_add ("", longopts, "");
159
160 while (1)
161 {
162 int opt;
163
164 opt = frr_getopt (argc, argv, NULL);
165
166 if (opt == EOF)
167 break;
168
169 switch (opt)
170 {
171 case 0:
172 break;
173 default:
174 frr_help_exit (1);
175 break;
176 }
177 }
178
179 /* EIGRP master init. */
180 eigrp_master_init ();
181 eigrp_om->master = frr_init();
182 master = eigrp_om->master;
183
6df85364 184 vrf_init (NULL, NULL, NULL, NULL);
7f57883e
DS
185
186 /*EIGRPd init*/
187 eigrp_if_init ();
188 eigrp_zebra_init ();
189 eigrp_debug_init ();
190
191 /* Get configuration file. */
192 /* EIGRP VTY inits */
193 eigrp_vty_init ();
194 keychain_init();
195 eigrp_vty_show_init ();
196 eigrp_vty_if_init ();
197
198#ifdef HAVE_SNMP
199 eigrp_snmp_init ();
200#endif /* HAVE_SNMP */
201
202 /* Access list install. */
203 access_list_init ();
204 access_list_add_hook (eigrp_distribute_update_all_wrapper);
205 access_list_delete_hook (eigrp_distribute_update_all_wrapper);
206
207 /* Prefix list initialize.*/
208 prefix_list_init ();
209 prefix_list_add_hook (eigrp_distribute_update_all);
210 prefix_list_delete_hook (eigrp_distribute_update_all);
211
212 /*eigrp_route_map_init();
f9e5c9ca
DS
213 route_map_add_hook (eigrp_rmap_update);
214 route_map_delete_hook (eigrp_rmap_update);*/
7f57883e 215 /*if_rmap_init (EIGRP_NODE);
f9e5c9ca
DS
216 if_rmap_hook_add (eigrp_if_rmap_update);
217 if_rmap_hook_delete (eigrp_if_rmap_update);*/
7f57883e
DS
218
219 /* Distribute list install. */
220 distribute_list_init (EIGRP_NODE);
221 distribute_list_add_hook (eigrp_distribute_update);
222 distribute_list_delete_hook (eigrp_distribute_update);
223
224 frr_config_fork ();
225 frr_run(master);
226
227 /* Not reached. */
228 return (0);
229
230}