diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-01-25 19:37:26 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2024-01-27 19:02:52 +0100 |
| commit | 567f5702c0ec53700388383030e55fee49459389 (patch) | |
| tree | 1b6cd3d290553a48b974ec9412108c31e44c2c5d /ospf6d/ospf6_main.c | |
| parent | 110945ba0d2314c18504adbc6ee3896fb67e4f09 (diff) | |
ospf6d: fix GR & auth seqno state location
Unfortunately, `ospf6d` is much worse than `ospfd` and `isisd` regarding
its state saving, due to the existence of the auth trailer code.
Again, this belongs in `/var/lib`, not `/var/run`.
Merge both state files into one, and add reconciliation code for the
auth seqno.
I'm gonna save my comment on the fact that `ospf6_auth_seqno_nvm_delete`
is not in fact used anywhere. Which is now a warning because it's
`static`. Well. It probably should be used somewhere, so leave it in.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_main.c')
| -rw-r--r-- | ospf6d/ospf6_main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 9d802531ba..6449d68453 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -38,6 +38,14 @@ /* Default configuration file name for ospf6d. */ #define OSPF6_DEFAULT_CONFIG "ospf6d.conf" +/* GR and auth trailer persistent state */ +#define OSPF6D_STATE_NAME "%s/ospf6d.json", frr_libstatedir +#define OSPF6D_COMPAT_STATE_NAME "%s/ospf6d-gr.json", frr_runstatedir +/* for extra confusion, "ospf6d-at-seq-no.dat" is handled directly in + * ospf6_auth_trailer.c; the alternative would be somehow merging JSON which + * is excessive for just supporting a legacy compatibility file location + */ + /* Default port values. */ #define OSPF6_VTY_PORT 2606 @@ -166,6 +174,15 @@ static const struct frr_yang_module_info *const ospf6d_yang_modules[] = { &frr_ospf6_route_map_info, }; +/* actual paths filled in main() */ +static char state_path[512]; +static char state_compat_path[512]; +static char *state_paths[] = { + state_path, + state_compat_path, + NULL, +}; + /* clang-format off */ FRR_DAEMON_INFO(ospf6d, OSPF6, .vty_port = OSPF6_VTY_PORT, @@ -178,6 +195,8 @@ FRR_DAEMON_INFO(ospf6d, OSPF6, .yang_modules = ospf6d_yang_modules, .n_yang_modules = array_size(ospf6d_yang_modules), + + .state_paths = state_paths, ); /* clang-format on */ @@ -237,6 +256,10 @@ int main(int argc, char *argv[], char *envp[]) exit(1); } + snprintf(state_path, sizeof(state_path), OSPF6D_STATE_NAME); + snprintf(state_compat_path, sizeof(state_compat_path), + OSPF6D_COMPAT_STATE_NAME); + /* OSPF6 master init. */ ospf6_master_init(frr_init()); |
