summaryrefslogtreecommitdiff
path: root/watchfrr
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2018-08-25 17:50:03 +0200
committerChristian Franke <chris@opensourcerouting.org>2018-08-25 18:17:24 +0200
commit7c265f7de17481148c52897251793856d9173714 (patch)
tree890da10a3d83db9c724fa85cb8cfbce0c2d46a1a /watchfrr
parent18d93bbb5a2d6acc791726ad6de7f11d6818d32d (diff)
watchfrr: fix global restart
watchfrr needs to handle a SIGCHLD also when it calls a global restart command. Before this patch, it would lead to the following behavior: 15:44:28: zebra state -> down : unexpected read error: Connection reset by peer 15:44:33: Forked background command [pid 6392]: /usr/sbin/frr.init watchrestart all 15:44:53: Warning: restart all child process 6392 still running after 20 seconds, sending signal 15 15:44:53: waitpid returned status for an unknown child process 6392 15:44:53: background (unknown) process 6392 terminated due to signal 15 15:45:13: Warning: restart all child process 6392 still running after 40 seconds, sending signal 9 15:45:33: Warning: restart all child process 6392 still running after 60 seconds, sending signal 9 15:45:53: Warning: restart all child process 6392 still running after 80 seconds, sending signal 9 15:46:13: Warning: restart all child process 6392 still running after 100 seconds, sending signal 9 15:46:33: Warning: restart all child process 6392 still running after 120 seconds, sending signal 9 15:46:53: Warning: restart all child process 6392 still running after 140 seconds, sending signal 9 This is obviously incorrect and can be fixed by comparing the pid to the global restart object as well. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'watchfrr')
-rw-r--r--watchfrr/watchfrr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index c6e7505979..07a29ca6d5 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -314,6 +314,9 @@ static int restart_kill(struct thread *t_kill)
static struct restart_info *find_child(pid_t child)
{
struct daemon *dmn;
+ if (gs.restart.pid == child)
+ return &gs.restart;
+
for (dmn = gs.daemons; dmn; dmn = dmn->next) {
if (dmn->restart.pid == child)
return &dmn->restart;