[strongSwan-dev] SIGPIPE makes charon restart

Emeric POUPON emeric.poupon at stormshield.eu
Thu May 7 09:56:17 CEST 2015


I am developing an external monitoring application using vici and I noticed that the PIPE signal is not handled as expected in charon (5.2.2, FreeBSD 9.3)
Indeed when the application unexpectedly quits, a SIGPIPE makes charon restart.

It seems we have to set the signal handler for this signal before instantiating the pool of threads.
This simple naive patch does the job:

diff --git a/src/charon/charon.c b/src/charon/charon.c
index 081e494..cd4562e 100644
--- a/src/charon/charon.c
+++ b/src/charon/charon.c
@@ -298,6 +298,12 @@ int main(int argc, char *argv[])
        /* logging for library during initialization, as we have no bus yet */
        dbg = dbg_stderr;
+       action.sa_flags = 0;
+       sigemptyset(&action.sa_mask);
+       action.sa_handler = SIG_IGN;
+       sigaction(SIGPIPE, &action, NULL);
        /* initialize library */
        if (!library_init(NULL, "charon"))

(maybe we should set the signal handler for all signals first?)



More information about the Dev mailing list