3 * Copyright (C) 2018-2019 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>
24 #include "lib/command.h"
25 #include "lib/filter.h"
26 #include "lib/getopt.h"
28 #include "lib/libfrr.h"
30 #include "lib/memory.h"
31 #include "lib/nexthop.h"
32 #include "lib/privs.h"
33 #include "lib/sigevent.h"
34 #include "lib/thread.h"
39 #include "vrrp_debug.h"
41 #include "vrrp_zebra.h"
43 DEFINE_MGROUP(VRRPD
, "vrrpd");
45 char backup_config_file
[256];
47 zebra_capabilities_t _caps_p
[] = {
51 struct zebra_privs_t vrrp_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 vrrpd_di
;
71 static void sighup(void)
73 zlog_info("SIGHUP received");
75 vty_read_config(NULL
, vrrpd_di
.config_file
, config_default
);
78 /* SIGINT / SIGTERM handler. */
79 static void __attribute__((noreturn
)) sigint(void)
81 zlog_notice("Terminating on signal");
90 /* SIGUSR1 handler. */
91 static void sigusr1(void)
96 struct quagga_signal_t vrrp_signals
[] = {
115 static const struct frr_yang_module_info
*const vrrp_yang_modules
[] = {
122 #define VRRP_VTY_PORT 2619
124 FRR_DAEMON_INFO(vrrpd
, VRRP
, .vty_port
= VRRP_VTY_PORT
,
125 .proghelp
= "Virtual Router Redundancy Protocol",
126 .signals
= vrrp_signals
,
127 .n_signals
= array_size(vrrp_signals
),
128 .privs
= &vrrp_privs
,
129 .yang_modules
= vrrp_yang_modules
,
130 .n_yang_modules
= array_size(vrrp_yang_modules
),
133 int main(int argc
, char **argv
, char **envp
)
135 frr_preinit(&vrrpd_di
, argc
, argv
);
136 frr_opt_add("", longopts
, "");
141 opt
= frr_getopt(argc
, argv
, NULL
);
163 snprintf(backup_config_file
, sizeof(backup_config_file
),
164 "%s/vrrpd.conf", frr_sysconfdir
);
165 vrrpd_di
.backup_config_file
= backup_config_file
;