summaryrefslogtreecommitdiffstats
path: root/babeld/babel_main.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
commitacb594b1d825c6e12369cebb941968ec08c840ce (patch)
treed544788908e7353a4f117e2991f15f4236a0c963 /babeld/babel_main.c
parentAdding upstream version 9.1. (diff)
downloadfrr-acb594b1d825c6e12369cebb941968ec08c840ce.tar.xz
frr-acb594b1d825c6e12369cebb941968ec08c840ce.zip
Adding upstream version 10.0.upstream/10.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'babeld/babel_main.c')
-rw-r--r--babeld/babel_main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index b6126d5..10ab1b5 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -5,6 +5,8 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
/* include zebra library */
#include <zebra.h>
+#include <fcntl.h>
+
#include "getopt.h"
#include "if.h"
#include "log.h"
@@ -56,7 +58,6 @@ unsigned char protocol_group[16]; /* babel's link-local multicast address */
int protocol_port; /* babel's port */
int protocol_socket = -1; /* socket: communicate with others babeld */
-static const char babel_config_default[] = SYSCONFDIR BABEL_DEFAULT_CONFIG;
static char *babel_vty_addr = NULL;
static int babel_vty_port = BABEL_VTY_PORT;
@@ -124,18 +125,20 @@ static const struct frr_yang_module_info *const babeld_yang_modules[] = {
&frr_vrf_info,
};
+/* clang-format off */
FRR_DAEMON_INFO(babeld, BABELD,
- .vty_port = BABEL_VTY_PORT,
- .proghelp = "Implementation of the BABEL routing protocol.",
+ .vty_port = BABEL_VTY_PORT,
+ .proghelp = "Implementation of the BABEL routing protocol.",
- .signals = babel_signals,
- .n_signals = array_size(babel_signals),
+ .signals = babel_signals,
+ .n_signals = array_size(babel_signals),
- .privs = &babeld_privs,
+ .privs = &babeld_privs,
- .yang_modules = babeld_yang_modules,
- .n_yang_modules = array_size(babeld_yang_modules),
+ .yang_modules = babeld_yang_modules,
+ .n_yang_modules = array_size(babeld_yang_modules),
);
+/* clang-format on */
int
main(int argc, char **argv)
@@ -169,8 +172,8 @@ main(int argc, char **argv)
}
}
- snprintf(state_file, sizeof(state_file), "%s/%s",
- frr_vtydir, "babel-state");
+ snprintf(state_file, sizeof(state_file), "%s/%s", frr_runstatedir,
+ "babel-state");
/* create the threads handler */
master = frr_init ();
@@ -182,8 +185,10 @@ main(int argc, char **argv)
change_smoothing_half_life(BABEL_DEFAULT_SMOOTHING_HALF_LIFE);
/* init some quagga's dependencies, and babeld's commands */
- if_zapi_callbacks(babel_ifp_create, babel_ifp_up,
- babel_ifp_down, babel_ifp_destroy);
+ hook_register_prio(if_real, 0, babel_ifp_create);
+ hook_register_prio(if_up, 0, babel_ifp_up);
+ hook_register_prio(if_down, 0, babel_ifp_down);
+ hook_register_prio(if_unreal, 0, babel_ifp_destroy);
babeld_quagga_init();
/* init zebra client's structure and it's commands */
/* this replace kernel_setup && kernel_setup_socket */
@@ -306,6 +311,8 @@ babel_exit_properly(void)
babel_save_state_file();
debugf(BABEL_DEBUG_COMMON, "Remove pid file.");
debugf(BABEL_DEBUG_COMMON, "Done.");
+
+ vrf_terminate();
frr_fini();
exit(0);
@@ -360,7 +367,7 @@ show_babel_main_configuration (struct vty *vty)
"id = %s\n"
"kernel_metric = %d\n",
state_file,
- babeld_di.config_file ? babeld_di.config_file : babel_config_default,
+ babeld_di.config_file,
format_address(protocol_group),
protocol_port,
babel_vty_addr ? babel_vty_addr : "None",