summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_main.c')
-rw-r--r--ospf6d/ospf6_main.c70
1 files changed, 65 insertions, 5 deletions
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index fdb93475d4..abd4320335 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -38,8 +38,13 @@
/* Default configuration file name for ospf6d. */
#define OSPF6_DEFAULT_CONFIG "ospf6d.conf"
-/* Default port values. */
-#define OSPF6_VTY_PORT 2606
+/* 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
+ */
/* ospf6d privileges */
zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_SYS_ADMIN};
@@ -103,7 +108,12 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
zclient_free(zclient);
}
+ ospf6_master_delete();
+
+ keychain_terminate();
+
frr_fini();
+
exit(status);
}
@@ -160,18 +170,61 @@ static const struct frr_yang_module_info *const ospf6d_yang_modules[] = {
&frr_vrf_info,
&frr_ospf_route_map_info,
&frr_ospf6_route_map_info,
+ &ietf_key_chain_info,
+ &ietf_key_chain_deviation_info,
};
-FRR_DAEMON_INFO(ospf6d, OSPF6, .vty_port = OSPF6_VTY_PORT,
+/* 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,
.proghelp = "Implementation of the OSPFv3 routing protocol.",
.signals = ospf6_signals,
.n_signals = array_size(ospf6_signals),
- .privs = &ospf6d_privs, .yang_modules = ospf6d_yang_modules,
+ .privs = &ospf6d_privs,
+
+ .yang_modules = ospf6d_yang_modules,
.n_yang_modules = array_size(ospf6d_yang_modules),
-);
+
+ .state_paths = state_paths,
+ );
+/* clang-format on */
+
+/* Max wait time for config to load before accepting hellos */
+#define OSPF6_PRE_CONFIG_MAX_WAIT_SECONDS 600
+
+static void ospf6_config_finish(struct event *t)
+{
+ zlog_err("OSPF6 configuration end timer expired after %d seconds.",
+ OSPF6_PRE_CONFIG_MAX_WAIT_SECONDS);
+}
+
+static void ospf6_config_start(void)
+{
+ if (IS_OSPF6_DEBUG_EVENT)
+ zlog_debug("ospf6d config start received");
+ EVENT_OFF(t_ospf6_cfg);
+ event_add_timer(master, ospf6_config_finish, NULL,
+ OSPF6_PRE_CONFIG_MAX_WAIT_SECONDS, &t_ospf6_cfg);
+}
+
+static void ospf6_config_end(void)
+{
+ if (IS_OSPF6_DEBUG_EVENT)
+ zlog_debug("ospf6d config end received");
+
+ EVENT_OFF(t_ospf6_cfg);
+}
/* Main routine of ospf6d. Treatment of argument and starting ospf finite
state machine is handled here. */
@@ -203,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());
@@ -217,6 +274,9 @@ int main(int argc, char *argv[], char *envp[])
/* initialize ospf6 */
ospf6_init(master);
+ /* Configuration processing callback initialization. */
+ cmd_init_config_callbacks(ospf6_config_start, ospf6_config_end);
+
frr_config_fork();
frr_run(master);