summaryrefslogtreecommitdiffstats
path: root/watchfrr
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 /watchfrr
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 'watchfrr')
-rw-r--r--watchfrr/watchfrr.c40
-rw-r--r--watchfrr/watchfrr_vty.c4
2 files changed, 28 insertions, 16 deletions
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index 228b7ff..acc612c 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -6,6 +6,11 @@
*/
#include <zebra.h>
+
+#include <signal.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include "frrevent.h"
#include <log.h>
#include <network.h>
@@ -27,6 +32,8 @@
#include "watchfrr.h"
#include "watchfrr_errors.h"
+#include "lib/config_paths.h"
+
#ifndef MIN
#define MIN(X,Y) (((X) <= (Y)) ? (X) : (Y))
#endif
@@ -115,7 +122,7 @@ static struct global_state {
int numdown; /* # of daemons that are not UP or UNRESPONSIVE */
} gs = {
.phase = PHASE_INIT,
- .vtydir = frr_vtydir,
+ .vtydir = frr_runstatedir,
.period = 1000 * DEFAULT_PERIOD,
.timeout = DEFAULT_TIMEOUT,
.restart_timeout = DEFAULT_RESTART_TIMEOUT,
@@ -292,11 +299,11 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n",
passing command-line arguments with embedded spaces.\n\
-v, --version Print program version\n\
-h, --help Display this help and exit\n",
- frr_vtydir, DEFAULT_LOGLEVEL, LOG_EMERG, LOG_DEBUG, LOG_DEBUG,
- DEFAULT_MIN_RESTART, DEFAULT_MAX_RESTART,
+ frr_runstatedir, DEFAULT_LOGLEVEL, LOG_EMERG, LOG_DEBUG,
+ LOG_DEBUG, DEFAULT_MIN_RESTART, DEFAULT_MAX_RESTART,
DEFAULT_OPERATIONAL_TIMEOUT, DEFAULT_PERIOD, DEFAULT_TIMEOUT,
DEFAULT_RESTART_TIMEOUT, DEFAULT_RESTART_CMD, DEFAULT_START_CMD,
- DEFAULT_STOP_CMD, frr_vtydir);
+ DEFAULT_STOP_CMD, frr_runstatedir);
}
static pid_t run_background(char *shell_cmd)
@@ -723,7 +730,7 @@ static void daemon_send_ready(int exitcode)
frr_detach();
- snprintf(started, sizeof(started), "%s/%s", frr_vtydir,
+ snprintf(started, sizeof(started), "%s/%s", frr_runstatedir,
"watchfrr.started");
fp = fopen(started, "w");
if (fp)
@@ -911,7 +918,7 @@ static void phase_check(void)
"Phased restart: all routing daemon stop jobs have completed.");
set_phase(PHASE_WAITING_DOWN);
- /*FALLTHRU*/
+ fallthrough;
case PHASE_WAITING_DOWN:
if (gs.numdown + IS_UP(gs.special) < gs.numdaemons)
break;
@@ -921,7 +928,7 @@ static void phase_check(void)
1);
set_phase(PHASE_ZEBRA_RESTART_PENDING);
- /*FALLTHRU*/
+ fallthrough;
case PHASE_ZEBRA_RESTART_PENDING:
if (gs.special->restart.pid)
break;
@@ -930,7 +937,7 @@ static void phase_check(void)
gs.special->name);
set_phase(PHASE_WAITING_ZEBRA_UP);
- /*FALLTHRU*/
+ fallthrough;
case PHASE_WAITING_ZEBRA_UP:
if (!IS_UP(gs.special))
break;
@@ -1347,19 +1354,20 @@ static struct frr_signal_t watchfrr_signals[] = {
},
};
+/* clang-format off */
FRR_DAEMON_INFO(watchfrr, WATCHFRR,
- .flags = FRR_NO_PRIVSEP | FRR_NO_TCPVTY | FRR_LIMITED_CLI
- | FRR_NO_CFG_PID_DRY | FRR_NO_ZCLIENT
- | FRR_DETACH_LATER,
+ .flags = FRR_NO_PRIVSEP | FRR_NO_TCPVTY | FRR_LIMITED_CLI
+ | FRR_NO_CFG_PID_DRY | FRR_NO_ZCLIENT | FRR_DETACH_LATER,
- .printhelp = printhelp,
- .copyright = "Copyright 2004 Andrew J. Schorr",
+ .printhelp = printhelp,
+ .copyright = "Copyright 2004 Andrew J. Schorr",
- .signals = watchfrr_signals,
- .n_signals = array_size(watchfrr_signals),
+ .signals = watchfrr_signals,
+ .n_signals = array_size(watchfrr_signals),
- .privs = &watchfrr_privs,
+ .privs = &watchfrr_privs,
);
+/* clang-format on */
#define DEPRECATED_OPTIONS "aAezR:"
diff --git a/watchfrr/watchfrr_vty.c b/watchfrr/watchfrr_vty.c
index 3afc767..95a7962 100644
--- a/watchfrr/watchfrr_vty.c
+++ b/watchfrr/watchfrr_vty.c
@@ -6,6 +6,8 @@
*/
#include <zebra.h>
+
+#include <signal.h>
#include <sys/wait.h>
#include "memory.h"
@@ -16,6 +18,8 @@
#include "watchfrr.h"
+#include "lib/config_paths.h"
+
pid_t integrated_write_pid;
static int integrated_result_fd;