summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-01-16 15:25:31 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-01-17 00:39:00 +0100
commit603c61656fe2a758aae466a801baccbe63697f67 (patch)
treefa37a8f62397b770968e36547924ac70d08c24ee /lib
parentd948c317c579ad7674baf9b88a199e69cdb35933 (diff)
lib: add frr_early_init hook
To bring up bits that use thread_master before other init happens. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libfrr.c2
-rw-r--r--lib/libfrr.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 1610ba4e7d..77d0d38f32 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -46,6 +46,7 @@
#include "frrscript.h"
#include "systemd.h"
+DEFINE_HOOK(frr_early_init, (struct thread_master * tm), (tm));
DEFINE_HOOK(frr_late_init, (struct thread_master * tm), (tm));
DEFINE_HOOK(frr_config_pre, (struct thread_master * tm), (tm));
DEFINE_HOOK(frr_config_post, (struct thread_master * tm), (tm));
@@ -765,6 +766,7 @@ struct thread_master *frr_init(void)
master = thread_master_create(NULL);
signal_init(master, di->n_signals, di->signals);
+ hook_call(frr_early_init, master);
#ifdef HAVE_SQLITE3
if (!di->db_file)
diff --git a/lib/libfrr.h b/lib/libfrr.h
index e0642ef847..65c1df9675 100644
--- a/lib/libfrr.h
+++ b/lib/libfrr.h
@@ -144,6 +144,7 @@ extern uint32_t frr_get_fd_limit(void);
extern bool frr_is_startup_fd(int fd);
/* call order of these hooks is as ordered here */
+DECLARE_HOOK(frr_early_init, (struct thread_master * tm), (tm));
DECLARE_HOOK(frr_late_init, (struct thread_master * tm), (tm));
/* fork() happens between late_init and config_pre */
DECLARE_HOOK(frr_config_pre, (struct thread_master * tm), (tm));