1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2018 Cumulus Networks, Inc.
9 #include <lib/version.h>
21 #include "routing_nb.h"
23 #include "static_vrf.h"
24 #include "static_vty.h"
25 #include "static_routes.h"
26 #include "static_zebra.h"
27 #include "static_debug.h"
28 #include "static_nb.h"
30 char backup_config_file
[256];
34 zebra_capabilities_t _caps_p
[] = {
37 struct zebra_privs_t static_privs
= {
38 #if defined(FRR_USER) && defined(FRR_GROUP)
42 #if defined(VTY_GROUP)
43 .vty_group
= VTY_GROUP
,
46 .cap_num_p
= array_size(_caps_p
),
49 struct option longopts
[] = { { 0 } };
51 /* Master of threads. */
52 struct thread_master
*master
;
54 static struct frr_daemon_info staticd_di
;
56 static void sighup(void)
58 zlog_info("SIGHUP received");
59 vty_read_config(NULL
, staticd_di
.config_file
, config_default
);
62 /* SIGINT / SIGTERM handler. */
63 static void sigint(void)
65 zlog_notice("Terminating on signal");
67 static_vrf_terminate();
75 /* SIGUSR1 handler. */
76 static void sigusr1(void)
81 struct frr_signal_t static_signals
[] = {
100 static const struct frr_yang_module_info
*const staticd_yang_modules
[] = {
108 #define STATIC_VTY_PORT 2616
110 FRR_DAEMON_INFO(staticd
, STATIC
, .vty_port
= STATIC_VTY_PORT
,
112 .proghelp
= "Implementation of STATIC.",
114 .signals
= static_signals
,
115 .n_signals
= array_size(static_signals
),
117 .privs
= &static_privs
, .yang_modules
= staticd_yang_modules
,
118 .n_yang_modules
= array_size(staticd_yang_modules
),
121 int main(int argc
, char **argv
, char **envp
)
123 frr_preinit(&staticd_di
, argc
, argv
);
124 frr_opt_add("", longopts
, "");
129 opt
= frr_getopt(argc
, argv
, NULL
);
150 hook_register(routing_conf_event
,
151 routing_control_plane_protocols_name_validate
);
153 routing_control_plane_protocols_register_vrf_dependency();
155 snprintf(backup_config_file
, sizeof(backup_config_file
),
156 "%s/zebra.conf", frr_sysconfdir
);
157 staticd_di
.backup_config_file
= backup_config_file
;