3 * Copyright (C) 2018 Cumulus Networks, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <lib/version.h>
34 #include "routing_nb.h"
36 #include "static_vrf.h"
37 #include "static_vty.h"
38 #include "static_routes.h"
39 #include "static_zebra.h"
40 #include "static_debug.h"
41 #include "static_nb.h"
43 char backup_config_file
[256];
48 zebra_capabilities_t _caps_p
[] = {
51 struct zebra_privs_t static_privs
= {
52 #if defined(FRR_USER) && defined(FRR_GROUP)
56 #if defined(VTY_GROUP)
57 .vty_group
= VTY_GROUP
,
60 .cap_num_p
= array_size(_caps_p
),
63 struct option longopts
[] = { { 0 } };
65 /* Master of threads. */
66 struct thread_master
*master
;
68 static struct frr_daemon_info staticd_di
;
70 static void sighup(void)
72 zlog_info("SIGHUP received");
73 vty_read_config(NULL
, staticd_di
.config_file
, config_default
);
76 /* SIGINT / SIGTERM handler. */
77 static void sigint(void)
79 zlog_notice("Terminating on signal");
81 static_vrf_terminate();
88 /* SIGUSR1 handler. */
89 static void sigusr1(void)
94 struct quagga_signal_t static_signals
[] = {
113 static const struct frr_yang_module_info
*const staticd_yang_modules
[] = {
121 #define STATIC_VTY_PORT 2616
123 FRR_DAEMON_INFO(staticd
, STATIC
, .vty_port
= STATIC_VTY_PORT
,
125 .proghelp
= "Implementation of STATIC.",
127 .signals
= static_signals
,
128 .n_signals
= array_size(static_signals
),
130 .privs
= &static_privs
, .yang_modules
= staticd_yang_modules
,
131 .n_yang_modules
= array_size(staticd_yang_modules
),
134 int main(int argc
, char **argv
, char **envp
)
136 frr_preinit(&staticd_di
, argc
, argv
);
137 frr_opt_add("", longopts
, "");
142 opt
= frr_getopt(argc
, argv
, NULL
);
164 hook_register(routing_conf_event
,
165 routing_control_plane_protocols_name_validate
);
167 snprintf(backup_config_file
, sizeof(backup_config_file
),
168 "%s/zebra.conf", frr_sysconfdir
);
169 staticd_di
.backup_config_file
= backup_config_file
;