diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-01-25 16:47:31 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2024-01-27 19:01:19 +0100 |
| commit | a97d0c5875a562a16a9e3cbae03e615c16e47c87 (patch) | |
| tree | 0e2290137a99141de9f3eb683c8f7b3fe13687d6 /lib/libfrr.c | |
| parent | 0f79e6b876ef99b5be722a2038f519fbbf3a4a67 (diff) | |
lib: set up `frr_libstatedir`
This needs to be used for persistent state, which currently is misplaced
into `/var/run` / `/run` where it gets deleted across reboots.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/libfrr.c')
| -rw-r--r-- | lib/libfrr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index 8f655eab0d..85a906a7bc 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -46,6 +46,7 @@ DEFINE_KOOH(frr_fini, (), ()); const char frr_sysconfdir[] = SYSCONFDIR; char frr_runstatedir[256] = FRR_RUNSTATE_PATH; +char frr_libstatedir[256] = FRR_LIBSTATE_PATH; #ifdef HAVE_SQLITE3 const char frr_dbdir[] = DAEMON_DB_DIR; #endif @@ -497,6 +498,8 @@ static int frr_opt(int opt) snprintf(frr_runstatedir, sizeof(frr_runstatedir), FRR_RUNSTATE_PATH "/%s", di->pathspace); + snprintf(frr_libstatedir, sizeof(frr_libstatedir), + FRR_LIBSTATE_PATH "/%s", di->pathspace); snprintf(pidfile_default, sizeof(pidfile_default), "%s/%s.pid", frr_runstatedir, di->name); if (!di->zpathspace) @@ -754,6 +757,7 @@ struct event_loop *frr_init(void) /* don't mkdir these as root... */ if (!(di->flags & FRR_NO_PRIVSEP)) { + frr_mkdir(frr_libstatedir, false); if (!di->pid_file || !di->vty_path) frr_mkdir(frr_runstatedir, false); if (di->pid_file) |
