charon-nm: Terminate if signaled by NetworkManager
This only happens during shutdown, not after terminating a connection. Fixes #3579.
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "nm_service.h"
|
#include "nm_service.h"
|
||||||
#include "nm_creds.h"
|
#include "nm_creds.h"
|
||||||
#include "nm_handler.h"
|
#include "nm_handler.h"
|
||||||
@@ -54,12 +57,21 @@ struct nm_backend_t {
|
|||||||
*/
|
*/
|
||||||
static nm_backend_t *nm_backend = NULL;
|
static nm_backend_t *nm_backend = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminate the daemon if signaled by NM
|
||||||
|
*/
|
||||||
|
static void terminate(void *plugin, void *arg)
|
||||||
|
{
|
||||||
|
kill(getpid(), SIGTERM);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NM plugin processing routine, creates and handles NMVpnServicePlugin
|
* NM plugin processing routine, creates and handles NMVpnServicePlugin
|
||||||
*/
|
*/
|
||||||
static job_requeue_t run(nm_backend_t *this)
|
static job_requeue_t run(nm_backend_t *this)
|
||||||
{
|
{
|
||||||
this->loop = g_main_loop_new(NULL, FALSE);
|
this->loop = g_main_loop_new(NULL, FALSE);
|
||||||
|
g_signal_connect(this->plugin, "quit", G_CALLBACK(terminate), NULL);
|
||||||
g_main_loop_run(this->loop);
|
g_main_loop_run(this->loop);
|
||||||
return JOB_REQUEUE_NONE;
|
return JOB_REQUEUE_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user