1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IS-IS Rout(e)ing protocol - isis_main.c
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
15 #include <lib/version.h>
31 #include "isisd/isis_constants.h"
32 #include "isisd/isis_common.h"
33 #include "isisd/isis_flags.h"
34 #include "isisd/isis_circuit.h"
35 #include "isisd/isisd.h"
36 #include "isisd/isis_dynhn.h"
37 #include "isisd/isis_spf.h"
38 #include "isisd/isis_route.h"
39 #include "isisd/isis_routemap.h"
40 #include "isisd/isis_zebra.h"
41 #include "isisd/isis_te.h"
42 #include "isisd/isis_errors.h"
43 #include "isisd/isis_bfd.h"
44 #include "isisd/isis_lsp.h"
45 #include "isisd/isis_mt.h"
46 #include "isisd/fabricd.h"
47 #include "isisd/isis_nb.h"
48 #include "isisd/isis_ldp_sync.h"
50 /* Default configuration file name */
51 #define ISISD_DEFAULT_CONFIG "isisd.conf"
52 /* Default vty port */
53 #define ISISD_VTY_PORT 2608
54 #define FABRICD_VTY_PORT 2618
56 /* isisd privileges */
57 zebra_capabilities_t _caps_p
[] = {ZCAP_NET_RAW
, ZCAP_BIND
, ZCAP_SYS_ADMIN
};
59 struct zebra_privs_t isisd_privs
= {
67 .vty_group
= VTY_GROUP
,
70 .cap_num_p
= array_size(_caps_p
),
74 static const struct option longopts
[] = {
75 {"int_num", required_argument
, NULL
, 'I'},
78 /* Master of threads. */
79 struct thread_master
*master
;
90 static __attribute__((__noreturn__
)) void terminate(int i
)
104 zlog_notice("SIGHUP/reload is not implemented for fabricd");
108 static struct frr_daemon_info isisd_di
;
111 zlog_info("SIGHUP received");
113 /* Reload config file. */
114 vty_read_config(NULL
, isisd_di
.config_file
, config_default
);
119 __attribute__((__noreturn__
)) void sigint(void)
121 zlog_notice("Terminating on signal SIGINT");
125 __attribute__((__noreturn__
)) void sigterm(void)
127 zlog_notice("Terminating on signal SIGTERM");
133 zlog_debug("SIGUSR1 received");
137 struct frr_signal_t isisd_signals
[] = {
157 static const struct frr_yang_module_info
*const isisd_yang_modules
[] = {
162 #endif /* ifndef FABRICD */
168 FRR_DAEMON_INFO(fabricd
, OPEN_FABRIC
, .vty_port
= FABRICD_VTY_PORT
,
170 .proghelp
= "Implementation of the OpenFabric routing protocol.",
172 FRR_DAEMON_INFO(isisd
, ISIS
, .vty_port
= ISISD_VTY_PORT
,
174 .proghelp
= "Implementation of the IS-IS routing protocol.",
177 "Copyright (c) 2001-2002 Sampo Saaristo, Ofer Wald and Hannes Gredler",
179 .signals
= isisd_signals
,
180 .n_signals
= array_size(isisd_signals
),
182 .privs
= &isisd_privs
, .yang_modules
= isisd_yang_modules
,
183 .n_yang_modules
= array_size(isisd_yang_modules
),
187 * Main routine of isisd. Parse arguments and handle IS-IS state machine.
189 int main(int argc
, char **argv
, char **envp
)
195 frr_preinit(&fabricd_di
, argc
, argv
);
197 frr_preinit(&isisd_di
, argc
, argv
);
201 " -I, --int_num Set instance number (label-manager)\n");
203 /* Command line argument treatment. */
205 opt
= frr_getopt(argc
, argv
, NULL
);
214 instance
= atoi(optarg
);
215 if (instance
< 1 || instance
> (unsigned short)-1)
216 zlog_err("Instance %i out of range (1..%u)",
217 instance
, (unsigned short)-1);
225 isis_master_init(frr_init());
232 access_list_add_hook(isis_filter_update
);
233 access_list_delete_hook(isis_filter_update
);
236 prefix_list_add_hook(isis_prefix_list_update
);
237 prefix_list_delete_hook(isis_prefix_list_update
);
241 isis_vty_daemon_init();
245 #endif /* ifdef FABRICD */
248 isis_route_map_init();
254 isis_zebra_init(master
, instance
);
255 isis_bfd_init(master
);
256 isis_ldp_sync_init();