]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: add frr_early_init hook
authorDavid Lamparter <equinox@opensourcerouting.org>
Sun, 16 Jan 2022 14:25:31 +0000 (15:25 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 16 Jan 2022 23:39:00 +0000 (00:39 +0100)
To bring up bits that use thread_master before other init happens.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/libfrr.c
lib/libfrr.h

index 1610ba4e7d34008bf1d810bcdfbfe0867e6ede94..77d0d38f32dbbfcc013d0152d6b24c92cdac9ded 100644 (file)
@@ -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)
index e0642ef84787deeb2127ad5f9ffa241e1fbe338b..65c1df9675e3dd426edfed5ab5df055111bfa8f9 100644 (file)
@@ -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));