summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-01-25 18:09:17 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2024-01-27 19:01:19 +0100
commitcd35ecc575a7b4b1a7ad134ccb3c76011ff5a347 (patch)
treeed248e858bb785c4e8cb728ac0dde24284b36b57 /lib/command.c
parenta97d0c5875a562a16a9e3cbae03e615c16e47c87 (diff)
lib: create `frr_daemon_state_{load,save}`
These functions load daemon-specific persistent state from `/var/lib/frr` and supersede open-coded variants of similar calls in ospfd, ospf6d and isisd to save GR state and/or sequence numbers. Unlike the open-coded variants, the save call correctly `fsync()`s the saved data to ensure disk contents are consistent. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index becba8452b..244bf86e8e 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1633,6 +1633,10 @@ static int vty_write_config(struct vty *vty)
return CMD_SUCCESS;
}
+/* cross-reference frr_daemon_state_save in libfrr.c
+ * the code there is similar but not identical (state files always use the same
+ * name for the new write, and don't keep a backup of previous state.)
+ */
static int file_write_config(struct vty *vty)
{
int fd, dirfd;