]> git.proxmox.com Git - mirror_frr.git/blobdiff - vrrpd/vrrp_main.c
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / vrrpd / vrrp_main.c
index d60f37d8fc92682965b760e5e0c85e7ad8fc22d2..95b3cfad8f1e8b59538707857401277d030023ea 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * VRRP
- * Copyright (C) 2018 Cumulus Networks, Inc.
- *               Quentin Young
+ * VRRP entry point.
+ * Copyright (C) 2018-2019 Cumulus Networks, Inc.
+ * Quentin Young
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
 #include <zebra.h>
 
 #include <lib/version.h>
-#include "getopt.h"
-#include "thread.h"
-#include "command.h"
-#include "log.h"
-#include "memory.h"
-#include "privs.h"
-#include "sigevent.h"
-#include "libfrr.h"
-#include "vrf.h"
-#include "nexthop.h"
-#include "filter.h"
-#include "if.h"
+
+#include "lib/command.h"
+#include "lib/filter.h"
+#include "lib/getopt.h"
+#include "lib/if.h"
+#include "lib/libfrr.h"
+#include "lib/log.h"
+#include "lib/memory.h"
+#include "lib/nexthop.h"
+#include "lib/privs.h"
+#include "lib/sigevent.h"
+#include "lib/thread.h"
+#include "lib/vrf.h"
+#include "lib/vty.h"
 
 #include "vrrp.h"
-#include "vrrp_zebra.h"
+#include "vrrp_debug.h"
 #include "vrrp_vty.h"
+#include "vrrp_zebra.h"
+
+DEFINE_MGROUP(VRRPD, "vrrpd")
 
 char backup_config_file[256];
 
@@ -55,22 +60,28 @@ struct zebra_privs_t vrrp_privs = {
        .cap_num_p = array_size(_caps_p),
        .cap_num_i = 0};
 
-struct option longopts[] = { { 0 } };
+struct option longopts[] = { {0} };
 
 /* Master of threads. */
 struct thread_master *master;
 
+static struct frr_daemon_info vrrpd_di;
+
 /* SIGHUP handler. */
 static void sighup(void)
 {
        zlog_info("SIGHUP received");
+
+       vty_read_config(NULL, vrrpd_di.config_file, config_default);
 }
 
 /* SIGINT / SIGTERM handler. */
-static void sigint(void)
+static void __attribute__((noreturn)) sigint(void)
 {
        zlog_notice("Terminating on signal");
 
+       vrrp_fini();
+
        exit(0);
 }
 
@@ -99,11 +110,12 @@ struct quagga_signal_t vrrp_signals[] = {
        },
 };
 
-static const struct frr_yang_module_info *vrrp_yang_modules[] = {
+static const struct frr_yang_module_info *const vrrp_yang_modules[] = {
        &frr_interface_info,
+       &frr_vrrpd_info,
 };
 
-#define VRRP_VTY_PORT 2617
+#define VRRP_VTY_PORT 2619
 
 FRR_DAEMON_INFO(vrrpd, VRRP, .vty_port = VRRP_VTY_PORT,
                .proghelp = "Virtual Router Redundancy Protocol",
@@ -138,6 +150,8 @@ int main(int argc, char **argv, char **envp)
 
        master = frr_init();
 
+       access_list_init();
+       vrrp_debug_init();
        vrrp_zebra_init();
        vrrp_vty_init();
        vrrp_init();