2 * IS-IS Rout(e)ing protocol - isis_main.c
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <lib/version.h>
44 #include "isisd/isis_constants.h"
45 #include "isisd/isis_common.h"
46 #include "isisd/isis_flags.h"
47 #include "isisd/isis_circuit.h"
48 #include "isisd/isisd.h"
49 #include "isisd/isis_dynhn.h"
50 #include "isisd/isis_spf.h"
51 #include "isisd/isis_route.h"
52 #include "isisd/isis_routemap.h"
53 #include "isisd/isis_zebra.h"
54 #include "isisd/isis_te.h"
55 #include "isisd/isis_errors.h"
56 #include "isisd/isis_bfd.h"
57 #include "isisd/isis_lsp.h"
58 #include "isisd/isis_mt.h"
59 #include "isisd/fabricd.h"
60 #include "isisd/isis_nb.h"
61 #include "isisd/isis_ldp_sync.h"
63 /* Default configuration file name */
64 #define ISISD_DEFAULT_CONFIG "isisd.conf"
65 /* Default vty port */
66 #define ISISD_VTY_PORT 2608
67 #define FABRICD_VTY_PORT 2618
69 /* isisd privileges */
70 zebra_capabilities_t _caps_p
[] = {ZCAP_NET_RAW
, ZCAP_BIND
, ZCAP_SYS_ADMIN
};
72 struct zebra_privs_t isisd_privs
= {
80 .vty_group
= VTY_GROUP
,
83 .cap_num_p
= array_size(_caps_p
),
87 static const struct option longopts
[] = {
88 {"int_num", required_argument
, NULL
, 'I'},
91 /* Master of threads. */
92 struct thread_master
*master
;
103 static __attribute__((__noreturn__
)) void terminate(int i
)
117 zlog_notice("SIGHUP/reload is not implemented for fabricd");
121 static struct frr_daemon_info isisd_di
;
124 zlog_info("SIGHUP received");
126 /* Reload config file. */
127 vty_read_config(NULL
, isisd_di
.config_file
, config_default
);
132 __attribute__((__noreturn__
)) void sigint(void)
134 zlog_notice("Terminating on signal SIGINT");
138 __attribute__((__noreturn__
)) void sigterm(void)
140 zlog_notice("Terminating on signal SIGTERM");
146 zlog_debug("SIGUSR1 received");
150 struct quagga_signal_t isisd_signals
[] = {
170 static const struct frr_yang_module_info
*const isisd_yang_modules
[] = {
175 #endif /* ifndef FABRICD */
181 FRR_DAEMON_INFO(fabricd
, OPEN_FABRIC
, .vty_port
= FABRICD_VTY_PORT
,
183 .proghelp
= "Implementation of the OpenFabric routing protocol.",
185 FRR_DAEMON_INFO(isisd
, ISIS
, .vty_port
= ISISD_VTY_PORT
,
187 .proghelp
= "Implementation of the IS-IS routing protocol.",
190 "Copyright (c) 2001-2002 Sampo Saaristo, Ofer Wald and Hannes Gredler",
192 .signals
= isisd_signals
,
193 .n_signals
= array_size(isisd_signals
),
195 .privs
= &isisd_privs
, .yang_modules
= isisd_yang_modules
,
196 .n_yang_modules
= array_size(isisd_yang_modules
),
200 * Main routine of isisd. Parse arguments and handle IS-IS state machine.
202 int main(int argc
, char **argv
, char **envp
)
208 frr_preinit(&fabricd_di
, argc
, argv
);
210 frr_preinit(&isisd_di
, argc
, argv
);
214 " -I, --int_num Set instance number (label-manager)\n");
216 /* Command line argument treatment. */
218 opt
= frr_getopt(argc
, argv
, NULL
);
227 instance
= atoi(optarg
);
228 if (instance
< 1 || instance
> (unsigned short)-1)
229 zlog_err("Instance %i out of range (1..%u)",
230 instance
, (unsigned short)-1);
239 isis_master_init(frr_init());
246 access_list_add_hook(isis_filter_update
);
247 access_list_delete_hook(isis_filter_update
);
250 prefix_list_add_hook(isis_prefix_list_update
);
251 prefix_list_delete_hook(isis_prefix_list_update
);
255 isis_vty_daemon_init();
259 #endif /* ifdef FABRICD */
262 isis_route_map_init();
268 isis_zebra_init(master
, instance
);
269 isis_bfd_init(master
);
270 isis_ldp_sync_init();