From 35cadacd2bb9383686753731e31bd7e145fb2506 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 06:24:32 +0200 Subject: Merging upstream version 10.0. Signed-off-by: Daniel Baumann --- babeld/babel_main.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'babeld/babel_main.c') 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 +#include + #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", -- cgit v1.2.3