diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-04-22 12:17:42 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2021-04-22 13:24:51 +0200 |
| commit | 159246be247fd4332780fcafe5909874ae2c705a (patch) | |
| tree | abb5e66300075734c2fd7b04c7b9706f525328f5 | |
| parent | bf645e31f696a42f60fbd5361beefd4ee707b25e (diff) | |
pathd: don't init PCEP before fork()
Turns out the PCEP stuff does not work particularly well if its threads
are ... missing. Who would've thought?
Reported-by: Erik Kooistra <me@erikkooistra.nl>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| -rw-r--r-- | pathd/path_pcep.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c index 1c650737b2..ad24c2eb02 100644 --- a/pathd/path_pcep.c +++ b/pathd/path_pcep.c @@ -264,7 +264,11 @@ int pathd_candidate_removed_handler(struct srte_candidate *candidate) /* ------------ Module Functions ------------ */ -int pcep_module_late_init(struct thread_master *tm) +/* this creates threads, therefore must run after fork(). but it must also + * run before config load, so the CLI commands don't try to touch things that + * aren't set up yet... + */ +static int pcep_module_config_pre(struct thread_master *tm) { assert(pcep_g->fpt == NULL); assert(pcep_g->master == NULL); @@ -280,10 +284,16 @@ int pcep_module_late_init(struct thread_master *tm) pcep_g->master = tm; pcep_g->fpt = fpt; + return 0; +} + +static int pcep_module_late_init(struct thread_master *tm) +{ hook_register(pathd_candidate_created, pathd_candidate_created_handler); hook_register(pathd_candidate_updated, pathd_candidate_updated_handler); hook_register(pathd_candidate_removed, pathd_candidate_removed_handler); + hook_register(frr_config_pre, pcep_module_config_pre); hook_register(frr_fini, pcep_module_finish); pcep_cli_init(); |
