stop strongswan if integrity check of libstrongswan or daemon fails

This commit is contained in:
Andreas Steffen
2009-07-17 20:33:19 +02:00
parent 6b04ba288d
commit eab241fb56
8 changed files with 49 additions and 25 deletions
+13 -10
View File
@@ -36,18 +36,23 @@
static int _charon_pid = 0;
static int _stop_requested;
pid_t
starter_charon_pid(void)
pid_t starter_charon_pid(void)
{
return _charon_pid;
}
void
starter_charon_sigchild(pid_t pid)
void starter_charon_sigchild(pid_t pid, int status)
{
if (pid == _charon_pid)
if (pid == _charon_pid)
{
_charon_pid = 0;
_charon_pid = 0;
if (status == SS_RC_LIBSTRONGSWAN_INTEGRITY ||
status == SS_RC_DAEMON_INTEGRITY)
{
plog("charon has quit: integrity test of %s failed",
(status == 64) ? "libstrongswan" : "charon");
_stop_requested = 1;
}
if (!_stop_requested)
{
plog("charon has died -- restart scheduled (%dsec)"
@@ -58,8 +63,7 @@ starter_charon_sigchild(pid_t pid)
}
}
int
starter_stop_charon (void)
int starter_stop_charon (void)
{
int i;
pid_t pid = _charon_pid;
@@ -106,8 +110,7 @@ starter_stop_charon (void)
}
int
starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
int starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
{
struct stat stb;
int pid, i;