forked from Mirror/frr
lib: add frr_config_pre hook
... for any initialization that needs to run after forking, but that would be racy if it were just scheduled on the thread_master (since the config load is also just a thread callback, ordering would be undefined for another scheduled thread callback.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
2bafda27a6
commit
bf645e31f6
|
@ -46,6 +46,7 @@
|
|||
#include "frrscript.h"
|
||||
|
||||
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));
|
||||
DEFINE_KOOH(frr_early_fini, (), ());
|
||||
DEFINE_KOOH(frr_fini, (), ());
|
||||
|
@ -931,6 +932,8 @@ static void frr_daemonize(void)
|
|||
*/
|
||||
static int frr_config_read_in(struct thread *t)
|
||||
{
|
||||
hook_call(frr_config_pre, master);
|
||||
|
||||
if (!vty_read_config(vty_shared_candidate_config, di->config_file,
|
||||
config_default)
|
||||
&& di->backup_config_file) {
|
||||
|
|
|
@ -141,8 +141,12 @@ extern enum frr_cli_mode frr_get_cli_mode(void);
|
|||
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_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));
|
||||
DECLARE_HOOK(frr_config_post, (struct thread_master * tm), (tm));
|
||||
|
||||
extern void frr_config_fork(void);
|
||||
|
||||
extern void frr_run(struct thread_master *master);
|
||||
|
|
Loading…
Reference in a new issue