summaryrefslogtreecommitdiffstats
path: root/isisd/isisd.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
commit35cadacd2bb9383686753731e31bd7e145fb2506 (patch)
tree4489adbde75a837989533837185b2b8369a0bf68 /isisd/isisd.c
parentAdding debian version 9.1-0.1. (diff)
downloadfrr-35cadacd2bb9383686753731e31bd7e145fb2506.tar.xz
frr-35cadacd2bb9383686753731e31bd7e145fb2506.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'isisd/isisd.c')
-rw-r--r--isisd/isisd.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c
index b1064d8..772eb97 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -3346,35 +3346,19 @@ void isis_area_advertise_high_metrics_set(struct isis_area *area,
}
/*
- * Returns the path of the file (non-volatile memory) that contains restart
- * information.
- */
-char *isis_restart_filepath(void)
-{
- static char filepath[MAXPATHLEN];
- snprintf(filepath, sizeof(filepath), ISISD_RESTART, "");
- return filepath;
-}
-
-/*
* Record in non-volatile memory the overload on startup time.
*/
void isis_restart_write_overload_time(struct isis_area *isis_area,
uint32_t overload_time)
{
- char *filepath;
const char *area_name;
json_object *json;
json_object *json_areas;
json_object *json_area;
- filepath = isis_restart_filepath();
+ json = frr_daemon_state_load();
area_name = isis_area->area_tag;
- json = json_object_from_file(filepath);
- if (json == NULL)
- json = json_object_new_object();
-
json_object_object_get_ex(json, "areas", &json_areas);
if (!json_areas) {
json_areas = json_object_new_object();
@@ -3389,8 +3373,8 @@ void isis_restart_write_overload_time(struct isis_area *isis_area,
json_object_int_add(json_area, "overload_time",
isis_area->overload_on_startup_time);
- json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+
+ frr_daemon_state_save(&json);
}
/*
@@ -3398,7 +3382,6 @@ void isis_restart_write_overload_time(struct isis_area *isis_area,
*/
uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
{
- char *filepath;
const char *area_name;
json_object *json;
json_object *json_areas;
@@ -3406,12 +3389,9 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
json_object *json_overload_time;
uint32_t overload_time = 0;
- filepath = isis_restart_filepath();
area_name = isis_area->area_tag;
- json = json_object_from_file(filepath);
- if (json == NULL)
- json = json_object_new_object();
+ json = frr_daemon_state_load();
json_object_object_get_ex(json, "areas", &json_areas);
if (!json_areas) {
@@ -3433,8 +3413,7 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
json_object_object_del(json_areas, area_name);
- json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+ frr_daemon_state_save(&json);
return overload_time;
}