summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_gr.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-01-28 14:30:28 -0500
committerGitHub <noreply@github.com>2024-01-28 14:30:28 -0500
commit259e3d4dac2da37b9abad9f84e41f90c81325a60 (patch)
tree33292e442296b1b4a04b7753e3055706bfd6c7e5 /ospf6d/ospf6_gr.c
parent4d92badcde7573b97d2acc2228d0ca5fe7168e1e (diff)
parentbbd858935fad9a469b5b339948e1215b347b05c0 (diff)
Merge pull request #15243 from opensourcerouting/autoconf-dir-mess
*: fix a pile of directory and/or state retention related issues
Diffstat (limited to 'ospf6d/ospf6_gr.c')
-rw-r--r--ospf6d/ospf6_gr.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c
index 69230e572b..34cb9706bd 100644
--- a/ospf6d/ospf6_gr.c
+++ b/ospf6d/ospf6_gr.c
@@ -561,9 +561,7 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6, bool prepare)
inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
- json = json_object_from_file((char *)OSPF6D_GR_STATE);
- if (json == NULL)
- json = json_object_new_object();
+ json = frr_daemon_state_load();
json_object_object_get_ex(json, "instances", &json_instances);
if (!json_instances) {
@@ -591,9 +589,7 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6, bool prepare)
json_object_int_add(json_instance, "timestamp",
time(NULL) + ospf6->gr_info.grace_period);
- json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
- JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+ frr_daemon_state_save(&json);
}
/*
@@ -608,9 +604,7 @@ void ospf6_gr_nvm_delete(struct ospf6 *ospf6)
inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
- json = json_object_from_file((char *)OSPF6D_GR_STATE);
- if (json == NULL)
- json = json_object_new_object();
+ json = frr_daemon_state_load();
json_object_object_get_ex(json, "instances", &json_instances);
if (!json_instances) {
@@ -620,9 +614,7 @@ void ospf6_gr_nvm_delete(struct ospf6 *ospf6)
json_object_object_del(json_instances, inst_name);
- json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
- JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+ frr_daemon_state_save(&json);
}
/*
@@ -641,9 +633,7 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6)
inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
- json = json_object_from_file((char *)OSPF6D_GR_STATE);
- if (json == NULL)
- json = json_object_new_object();
+ json = frr_daemon_state_load();
json_object_object_get_ex(json, "instances", &json_instances);
if (!json_instances) {
@@ -687,11 +677,10 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6)
ospf6->gr_info.grace_period);
}
- json_object_object_del(json_instances, inst_name);
+ json_object_object_del(json_instance, "gracePeriod");
+ json_object_object_del(json_instance, "timestamp");
- json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
- JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+ frr_daemon_state_save(&json);
}
void ospf6_gr_unplanned_start_interface(struct ospf6_interface *oi)