bfdd: implement configuration reload

Reload configuration on SIGHUP using the northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2019-05-30 15:14:50 -03:00
parent 0030482f5e
commit 49cc9e7b64

View File

@ -39,6 +39,9 @@ struct thread_master *master;
/* BFDd privileges */ /* BFDd privileges */
static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_SYS_ADMIN, ZCAP_NET_RAW}; static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_SYS_ADMIN, ZCAP_NET_RAW};
/* BFD daemon information. */
static struct frr_daemon_info bfdd_di;
void socket_close(int *s) void socket_close(int *s)
{ {
if (*s <= 0) if (*s <= 0)
@ -78,6 +81,14 @@ static void sigterm_handler(void)
exit(0); exit(0);
} }
static void sighup_handler(void)
{
zlog_info("SIGHUP received");
/* Reload config file. */
vty_read_config(NULL, bfdd_di.config_file, config_default);
}
static struct quagga_signal_t bfd_signals[] = { static struct quagga_signal_t bfd_signals[] = {
{ {
.signal = SIGUSR1, .signal = SIGUSR1,
@ -91,6 +102,10 @@ static struct quagga_signal_t bfd_signals[] = {
.signal = SIGINT, .signal = SIGINT,
.handler = &sigterm_handler, .handler = &sigterm_handler,
}, },
{
.signal = SIGHUP,
.handler = &sighup_handler,
},
}; };
static const struct frr_yang_module_info *bfdd_yang_modules[] = { static const struct frr_yang_module_info *bfdd_yang_modules[] = {