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];
47 zebra_capabilities_t _caps_p
[] = {
50 struct zebra_privs_t static_privs
= {
51 #if defined(FRR_USER) && defined(FRR_GROUP)
55 #if defined(VTY_GROUP)
56 .vty_group
= VTY_GROUP
,
59 .cap_num_p
= array_size(_caps_p
),
62 struct option longopts
[] = { { 0 } };
64 /* Master of threads. */
65 struct thread_master
*master
;
67 static struct frr_daemon_info staticd_di
;
69 static void sighup(void)
71 zlog_info("SIGHUP received");
72 vty_read_config(NULL
, staticd_di
.config_file
, config_default
);
75 /* SIGINT / SIGTERM handler. */
76 static void sigint(void)
78 zlog_notice("Terminating on signal");
80 static_vrf_terminate();
87 /* SIGUSR1 handler. */
88 static void sigusr1(void)
93 struct frr_signal_t static_signals
[] = {
112 static const struct frr_yang_module_info
*const staticd_yang_modules
[] = {
120 #define STATIC_VTY_PORT 2616
122 FRR_DAEMON_INFO(staticd
, STATIC
, .vty_port
= STATIC_VTY_PORT
,
124 .proghelp
= "Implementation of STATIC.",
126 .signals
= static_signals
,
127 .n_signals
= array_size(static_signals
),
129 .privs
= &static_privs
, .yang_modules
= staticd_yang_modules
,
130 .n_yang_modules
= array_size(staticd_yang_modules
),
133 int main(int argc
, char **argv
, char **envp
)
135 frr_preinit(&staticd_di
, argc
, argv
);
136 frr_opt_add("", longopts
, "");
141 opt
= frr_getopt(argc
, argv
, NULL
);
162 hook_register(routing_conf_event
,
163 routing_control_plane_protocols_name_validate
);
165 routing_control_plane_protocols_register_vrf_dependency();
167 snprintf(backup_config_file
, sizeof(backup_config_file
),
168 "%s/zebra.conf", frr_sysconfdir
);
169 staticd_di
.backup_config_file
= backup_config_file
;