]> git.proxmox.com Git - mirror_frr.git/blame - eigrpd/eigrp_main.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / eigrpd / eigrp_main.c
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
7f57883e
DS
2/*
3 * EIGRP Main Routine.
4 * Copyright (C) 2013-2015
5 * Authors:
6 * Donnie Savage
7 * Jan Janovic
8 * Matej Perina
9 * Peter Orsag
10 * Peter Paluch
11 * Frantisek Gazo
12 * Tomas Hvorkovy
13 * Martin Kontsek
14 * Lukas Koribsky
7f57883e
DS
15 */
16#include <zebra.h>
17
18#include <lib/version.h>
19#include "getopt.h"
20#include "thread.h"
21#include "prefix.h"
22#include "linklist.h"
23#include "if.h"
24#include "vector.h"
25#include "vty.h"
26#include "command.h"
27#include "filter.h"
28#include "plist.h"
29#include "stream.h"
30#include "log.h"
31#include "memory.h"
32#include "privs.h"
33#include "sigevent.h"
34#include "zclient.h"
35#include "keychain.h"
36#include "distribute.h"
37#include "libfrr.h"
a72730d3 38#include "routemap.h"
7f57883e
DS
39//#include "if_rmap.h"
40
41#include "eigrpd/eigrp_structs.h"
42#include "eigrpd/eigrpd.h"
43#include "eigrpd/eigrp_dump.h"
44#include "eigrpd/eigrp_interface.h"
45#include "eigrpd/eigrp_neighbor.h"
46#include "eigrpd/eigrp_packet.h"
47#include "eigrpd/eigrp_vty.h"
48#include "eigrpd/eigrp_zebra.h"
49#include "eigrpd/eigrp_network.h"
50#include "eigrpd/eigrp_snmp.h"
51#include "eigrpd/eigrp_filter.h"
8b0a80f1 52#include "eigrpd/eigrp_errors.h"
c20fa244 53#include "eigrpd/eigrp_vrf.h"
b66c8fbb 54#include "eigrpd/eigrp_cli.h"
fb532db3 55#include "eigrpd/eigrp_yang.h"
7f57883e
DS
56//#include "eigrpd/eigrp_routemap.h"
57
58/* eigprd privileges */
d62a17ae 59zebra_capabilities_t _caps_p[] = {
9d303b37 60 ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
7f57883e
DS
61};
62
d62a17ae 63struct zebra_privs_t eigrpd_privs = {
64#if defined(FRR_USER) && defined(FRR_GROUP)
65 .user = FRR_USER,
66 .group = FRR_GROUP,
7f57883e 67#endif
d62a17ae 68#if defined(VTY_GROUP)
69 .vty_group = VTY_GROUP,
7f57883e 70#endif
d62a17ae 71 .caps_p = _caps_p,
72 .cap_num_p = array_size(_caps_p),
73 .cap_num_i = 0};
7f57883e
DS
74
75/* EIGRPd options. */
d62a17ae 76struct option longopts[] = {{0}};
7f57883e
DS
77
78/* Master of threads. */
79struct thread_master *master;
80
3e975968
RZ
81/* Forward declaration of daemon info structure. */
82static struct frr_daemon_info eigrpd_di;
83
7f57883e 84/* SIGHUP handler. */
d62a17ae 85static void sighup(void)
7f57883e 86{
d62a17ae 87 zlog_info("SIGHUP received");
3e975968
RZ
88
89 /* Reload config file. */
90 vty_read_config(NULL, eigrpd_di.config_file, config_default);
7f57883e
DS
91}
92
93/* SIGINT / SIGTERM handler. */
d62a17ae 94static void sigint(void)
7f57883e 95{
d62a17ae 96 zlog_notice("Terminating on signal");
97 eigrp_terminate();
77382984
DS
98
99 exit(0);
7f57883e
DS
100}
101
102/* SIGUSR1 handler. */
d62a17ae 103static void sigusr1(void)
7f57883e 104{
d62a17ae 105 zlog_rotate();
7f57883e
DS
106}
107
7cc91e67 108struct frr_signal_t eigrp_signals[] = {
d62a17ae 109 {
110 .signal = SIGHUP,
111 .handler = &sighup,
112 },
113 {
114 .signal = SIGUSR1,
115 .handler = &sigusr1,
116 },
117 {
118 .signal = SIGINT,
119 .handler = &sigint,
120 },
121 {
122 .signal = SIGTERM,
123 .handler = &sigint,
124 },
7f57883e
DS
125};
126
0d8c7a26 127static const struct frr_yang_module_info *const eigrpd_yang_modules[] = {
f25c244b 128 &frr_eigrpd_info,
c2aab693 129 &frr_filter_info,
a4bed468 130 &frr_interface_info,
91835f1f 131 &frr_route_map_info,
6fd8972a 132 &frr_vrf_info,
8fcdd0d6
RW
133};
134
d62a17ae 135FRR_DAEMON_INFO(eigrpd, EIGRP, .vty_port = EIGRP_VTY_PORT,
7f57883e 136
d62a17ae 137 .proghelp = "Implementation of the EIGRP routing protocol.",
7f57883e 138
d62a17ae 139 .signals = eigrp_signals,
140 .n_signals = array_size(eigrp_signals),
7f57883e 141
8fcdd0d6 142 .privs = &eigrpd_privs, .yang_modules = eigrpd_yang_modules,
80413c20
DL
143 .n_yang_modules = array_size(eigrpd_yang_modules),
144);
7f57883e
DS
145
146/* EIGRPd main routine. */
d62a17ae 147int main(int argc, char **argv, char **envp)
7f57883e 148{
d62a17ae 149 frr_preinit(&eigrpd_di, argc, argv);
150 frr_opt_add("", longopts, "");
151
152 while (1) {
153 int opt;
154
155 opt = frr_getopt(argc, argv, NULL);
156
157 if (opt == EOF)
158 break;
159
160 switch (opt) {
161 case 0:
162 break;
163 default:
164 frr_help_exit(1);
d62a17ae 165 }
166 }
167
01cbe587
DS
168 eigrp_sw_version_initialize();
169
d62a17ae 170 /* EIGRP master init. */
171 eigrp_master_init();
172 eigrp_om->master = frr_init();
173 master = eigrp_om->master;
174
8b0a80f1 175 eigrp_error_init();
c20fa244 176 eigrp_vrf_init();
ac2cb9bf 177 vrf_init(NULL, NULL, NULL, NULL);
d62a17ae 178
179 /*EIGRPd init*/
180 eigrp_if_init();
181 eigrp_zebra_init();
182 eigrp_debug_init();
183
184 /* Get configuration file. */
185 /* EIGRP VTY inits */
186 eigrp_vty_init();
187 keychain_init();
188 eigrp_vty_show_init();
f25c244b 189 eigrp_cli_init();
7f57883e
DS
190
191#ifdef HAVE_SNMP
d62a17ae 192 eigrp_snmp_init();
7f57883e
DS
193#endif /* HAVE_SNMP */
194
d62a17ae 195 /* Access list install. */
196 access_list_init();
197 access_list_add_hook(eigrp_distribute_update_all_wrapper);
198 access_list_delete_hook(eigrp_distribute_update_all_wrapper);
199
200 /* Prefix list initialize.*/
201 prefix_list_init();
202 prefix_list_add_hook(eigrp_distribute_update_all);
203 prefix_list_delete_hook(eigrp_distribute_update_all);
204
a72730d3
QY
205 /*
206 * XXX: This is just to get the CLI installed to suppress VTYSH errors.
207 * Routemaps in EIGRP are not yet functional.
208 */
209 route_map_init();
d62a17ae 210 /*eigrp_route_map_init();
211 route_map_add_hook (eigrp_rmap_update);
212 route_map_delete_hook (eigrp_rmap_update);*/
4b23867c 213 /*if_rmap_init (EIGRP_NODE); */
d62a17ae 214
215 frr_config_fork();
216 frr_run(master);
217
218 /* Not reached. */
95f7965d 219 return 0;
7f57883e 220}