core: unblock signals for child processes we spawn out of NM (rh #739836)
authorJiří Klimeš <jklimes@redhat.com>
Mon, 21 May 2012 12:10:05 +0000 (14:10 +0200)
committerJiří Klimeš <jklimes@redhat.com>
Mon, 21 May 2012 13:00:51 +0000 (15:00 +0200)
Commit 217c5bf6ac2284261e5c868d393d4b7d02ca5569 fixed processing of unix
signals: signals are blocked in all threads and a dedicated thread handles the
signals using sigwait().
However, the commit forgot that child processes inherit signal mask as well.
That is why we have to unblock signals for child processes we spawn from NM, so
that they can receive signals.

23 files changed:
configure.ac
src/Makefile.am
src/NetworkManagerUtils.c
src/dhcp-manager/Makefile.am
src/dhcp-manager/nm-dhcp-dhclient.c
src/dhcp-manager/nm-dhcp-dhcpcd.c
src/dns-manager/Makefile.am
src/dns-manager/nm-dns-manager.c
src/dns-manager/nm-dns-plugin.c
src/dnsmasq-manager/Makefile.am
src/dnsmasq-manager/nm-dnsmasq-manager.c
src/main.c
src/nm-activation-request.c
src/nm-device.c
src/posix-signals/Makefile.am [new file with mode: 0644]
src/posix-signals/nm-posix-signals.c [new file with mode: 0644]
src/posix-signals/nm-posix-signals.h [new file with mode: 0644]
src/ppp-manager/Makefile.am
src/ppp-manager/nm-ppp-manager.c
src/settings/plugins/ifcfg-rh/Makefile.am
src/settings/plugins/ifcfg-rh/reader.c
src/vpn-manager/Makefile.am
src/vpn-manager/nm-vpn-service.c

index 127314c..654153d 100644 (file)
@@ -735,6 +735,7 @@ src/Makefile
 src/tests/Makefile
 src/generated/Makefile
 src/logging/Makefile
+src/posix-signals/Makefile
 src/dns-manager/Makefile
 src/vpn-manager/Makefile
 src/dhcp-manager/Makefile
index 0a83c88..7930c28 100644 (file)
@@ -1,6 +1,7 @@
 SUBDIRS= \
        generated \
        logging \
+       posix-signals \
        dns-manager \
        vpn-manager \
        dhcp-manager \
@@ -27,6 +28,7 @@ INCLUDES = -I${top_srcdir} \
            -I${top_srcdir}/src/generated \
            -I${top_builddir}/src/generated \
            -I${top_srcdir}/src/logging \
+           -I${top_srcdir}/src/posix-signals \
            -I${top_srcdir}/src/dns-manager \
            -I${top_srcdir}/src/vpn-manager \
            -I${top_srcdir}/src/dhcp-manager \
@@ -304,6 +306,7 @@ endif
 NetworkManager_LDADD = \
        ./generated/libnm-generated.la \
        ./logging/libnm-logging.la \
+       ./posix-signals/libnm-posix-signals.la \
        ./dns-manager/libdns-manager.la \
        ./vpn-manager/libvpn-manager.la \
        ./dhcp-manager/libdhcp-manager.la \
index 6c2c044..952b4e5 100644 (file)
@@ -15,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2004 - 2011 Red Hat, Inc.
+ * Copyright (C) 2004 - 2012 Red Hat, Inc.
  * Copyright (C) 2005 - 2008 Novell, Inc.
  */
 
@@ -41,6 +41,7 @@
 #include "nm-setting-wireless.h"
 #include "nm-setting-wireless-security.h"
 #include "nm-manager-auth.h"
+#include "nm-posix-signals.h"
 
 /*
  * nm_ethernet_address_is_valid
@@ -94,7 +95,7 @@ nm_spawn_process (const char *args)
                return -1;
        }
 
-       if (!g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, NULL, NULL, &status, &error)) {
+       if (!g_spawn_sync ("/", argv, NULL, 0, nm_unblock_posix_signals, NULL, NULL, NULL, &status, &error)) {
                nm_log_warn (LOGD_CORE, "could not spawn process '%s': %s", args, error->message);
                g_error_free (error);
        }
index ce34c41..11560fd 100644 (file)
@@ -7,6 +7,7 @@ INCLUDES = \
        -I${top_srcdir}/src/generated \
        -I${top_builddir}/src/generated \
        -I${top_srcdir}/src/logging \
+       -I${top_srcdir}/src/posix-signals \
        -I${top_srcdir}/libnm-util \
        -I${top_builddir}/libnm-util \
        -I${top_srcdir}/src
@@ -33,6 +34,7 @@ libdhcp_dhclient_la_CPPFLAGS = \
 
 libdhcp_dhclient_la_LIBADD = \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(top_builddir)/libnm-util/libnm-util.la \
        $(DBUS_LIBS) \
        $(GLIB_LIBS)
@@ -58,6 +60,7 @@ libdhcp_manager_la_CPPFLAGS = \
 
 libdhcp_manager_la_LIBADD = \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(builddir)/libdhcp-dhclient.la \
        $(DBUS_LIBS) \
        $(GLIB_LIBS)
index 0932139..2018cde 100644 (file)
@@ -15,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2005 - 2010 Red Hat, Inc.
+ * Copyright (C) 2005 - 2012 Red Hat, Inc.
  */
 
 #define _XOPEN_SOURCE
@@ -40,6 +40,7 @@
 #include "nm-utils.h"
 #include "nm-logging.h"
 #include "nm-dhcp-dhclient-utils.h"
+#include "nm-posix-signals.h"
 
 G_DEFINE_TYPE (NMDHCPDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
 
@@ -407,6 +408,12 @@ dhclient_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for dhclient here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static GPid
index 237661f..dc9bee1 100644 (file)
@@ -35,6 +35,7 @@
 #include "nm-dhcp-dhcpcd.h"
 #include "nm-utils.h"
 #include "nm-logging.h"
+#include "nm-posix-signals.h"
 
 G_DEFINE_TYPE (NMDHCPDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
 
@@ -83,6 +84,12 @@ dhcpcd_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for dhcpcd here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static GPid
index 331f85c..fd31b14 100644 (file)
@@ -1,5 +1,6 @@
 INCLUDES = \
        -I${top_srcdir}/src/logging \
+       -I${top_srcdir}/src/posix-signals \
        -I${top_srcdir}/libnm-util \
        -I${top_builddir}/libnm-util \
        -I${top_srcdir}/src \
@@ -28,6 +29,7 @@ libdns_manager_la_CPPFLAGS = \
 
 libdns_manager_la_LIBADD = \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(LIBNL_LIBS) \
        $(DBUS_LIBS) \
        $(GLIB_LIBS)
index 6272e37..b75aa92 100644 (file)
@@ -16,7 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Copyright (C) 2004 - 2005 Colin Walters <walters@redhat.com>
- * Copyright (C) 2004 - 2011 Red Hat, Inc.
+ * Copyright (C) 2004 - 2012 Red Hat, Inc.
  * Copyright (C) 2005 - 2008 Novell, Inc.
  *   and others
  */
@@ -42,6 +42,7 @@
 #include "nm-logging.h"
 #include "backends/nm-backend.h"
 #include "NetworkManagerUtils.h"
+#include "nm-posix-signals.h"
 
 #include "nm-dns-plugin.h"
 #include "nm-dns-dnsmasq.h"
@@ -218,6 +219,12 @@ netconfig_child_setup (gpointer user_data G_GNUC_UNUSED)
 {
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for netconfig here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static GPid
index e997948..b26f2b9 100644 (file)
@@ -13,7 +13,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010 - 2012 Red Hat, Inc.
  *
  */
 
@@ -27,6 +27,7 @@
 
 #include "nm-dns-plugin.h"
 #include "nm-logging.h"
+#include "nm-posix-signals.h"
 
 typedef struct {
        gboolean disposed;
@@ -141,6 +142,12 @@ child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for DNS plugin here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 GPid
index 66bbdd8..8b7dd68 100644 (file)
@@ -1,6 +1,7 @@
 INCLUDES = \
        -I${top_srcdir}/libnm-util \
        -I${top_srcdir}/src/logging \
+       -I${top_srcdir}/src/posix-signals \
        -I${top_srcdir}/src \
        -I${top_srcdir}/include
 
@@ -16,4 +17,5 @@ libdnsmasq_manager_la_CPPFLAGS = \
 
 libdnsmasq_manager_la_LIBADD = \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(GLIB_LIBS)
index ca2f9dc..0b3b629 100644 (file)
@@ -15,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2008 - 2010 Red Hat, Inc.
+ * Copyright (C) 2008 - 2012 Red Hat, Inc.
  */
 
 #include <config.h>
@@ -30,6 +30,7 @@
 #include "nm-dnsmasq-manager.h"
 #include "nm-logging.h"
 #include "nm-glib-compat.h"
+#include "nm-posix-signals.h"
 
 typedef struct {
        char *iface;
@@ -356,6 +357,12 @@ dm_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for dnsmasq here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static void
index 412bd52..e8ff2e4 100644 (file)
@@ -54,6 +54,7 @@
 #include "nm-logging.h"
 #include "nm-policy-hosts.h"
 #include "nm-config.h"
+#include "nm-posix-signals.h"
 
 #if !defined(NM_DIST_VERSION)
 # define NM_DIST_VERSION VERSION
@@ -135,6 +136,7 @@ static gboolean
 setup_signals (void)
 {
        pthread_t signal_thread_id;
+       sigset_t old_sig_mask;
        int status;
 
        sigemptyset (&signal_set);
@@ -151,11 +153,13 @@ setup_signals (void)
        sigaddset (&signal_set, SIGUSR1);
 
        /* Block all signals of interest. */
-       status = pthread_sigmask (SIG_BLOCK, &signal_set, NULL);
+       status = pthread_sigmask (SIG_BLOCK, &signal_set, &old_sig_mask);
        if (status != 0) {
                fprintf (stderr, _("Failed to set signal mask: %d"), status);
                return FALSE;
        }
+       /* Save original mask so that we could use it for child processes. */
+       nm_save_original_signal_mask (old_sig_mask);
 
        /* Create the signal handling thread. */
        status = pthread_create (&signal_thread_id, NULL, signal_handling_thread, NULL);
index 3fc7b53..0b957fd 100644 (file)
@@ -36,6 +36,7 @@
 #include "nm-device.h"
 #include "nm-active-connection.h"
 #include "nm-settings-connection.h"
+#include "nm-posix-signals.h"
 
 
 G_DEFINE_TYPE (NMActRequest, nm_act_request, NM_TYPE_ACTIVE_CONNECTION)
@@ -261,6 +262,8 @@ share_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       nm_unblock_posix_signals (NULL);
 }
 
 void
index 69c3a77..8fa8a4f 100644 (file)
@@ -62,6 +62,7 @@
 #include "nm-enum-types.h"
 #include "nm-settings-connection.h"
 #include "nm-connection-provider.h"
+#include "nm-posix-signals.h"
 
 static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
 
@@ -1379,6 +1380,12 @@ aipd_child_setup (gpointer user_data G_GNUC_UNUSED)
         */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for avahi-autoipd here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static NMActStageReturn
@@ -2600,6 +2607,8 @@ share_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       nm_unblock_posix_signals (NULL);
 }
 
 static gboolean
diff --git a/src/posix-signals/Makefile.am b/src/posix-signals/Makefile.am
new file mode 100644 (file)
index 0000000..88c3d8d
--- /dev/null
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = libnm-posix-signals.la
+
+libnm_posix_signals_la_SOURCES = \
+       nm-posix-signals.c \
+       nm-posix-signals.h
+
+libnm_posix_signals_la_CPPFLAGS = \
+       $(GLIB_CFLAGS) \
+       -DLIBEXECDIR=\"$(libexecdir)\" \
+       -DG_DISABLE_DEPRECATED
+
+libnm_posix_signals_la_LIBADD = \
+       -ldl \
+       $(GLIB_LIBS)
+
diff --git a/src/posix-signals/nm-posix-signals.c b/src/posix-signals/nm-posix-signals.c
new file mode 100644 (file)
index 0000000..22fed83
--- /dev/null
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ */
+
+#include "config.h"
+
+#include <signal.h>
+
+#include "nm-posix-signals.h"
+
+
+/* Stores the original signal mask of NetworkManager process */
+static sigset_t nm_original_signal_mask;
+
+void
+nm_save_original_signal_mask (sigset_t sig_mask)
+{
+       nm_original_signal_mask = sig_mask;
+}
+
+const sigset_t *
+nm_get_original_signal_mask (void)
+{
+       return &nm_original_signal_mask;
+}
+
+/* 
+ * Unblock signals.
+ * If a signal set is passed, those signals are unblocked. If user_data is NULL
+ * the process' signal mask is set to the saved original mask.
+ * Note: This function can be used in g_spawn_* as GSpawnChildSetupFunc()
+ *       callback.
+ */
+void
+nm_unblock_posix_signals (gpointer user_data)
+{
+       sigset_t *user_sigset = (sigset_t *) user_data;
+
+       if (user_sigset != NULL) {
+               pthread_sigmask (SIG_UNBLOCK, user_sigset, NULL);
+       } else {
+               const sigset_t *orig_sig_mask = nm_get_original_signal_mask ();
+               pthread_sigmask (SIG_SETMASK, orig_sig_mask, NULL);
+       }
+}
+
diff --git a/src/posix-signals/nm-posix-signals.h b/src/posix-signals/nm-posix-signals.h
new file mode 100644 (file)
index 0000000..81be5e1
--- /dev/null
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ */
+
+#ifndef NM_POSIX_SIGNALS_H
+#define NM_POSIX_SIGNALS_H
+
+#include <glib.h>
+#include <signal.h>
+
+/*
+ * This function can be used in g_spawn_* as GSpawnChildSetupFunc()
+ * callback.
+ */
+void nm_unblock_posix_signals (gpointer user_data);
+
+void nm_save_original_signal_mask (sigset_t sig_mask);
+const sigset_t *nm_get_original_signal_mask (void);
+
+#endif /* NM_POSIX_SIGNALS_H */
index 8df2f58..36e54ec 100644 (file)
@@ -7,7 +7,8 @@ INCLUDES = \
        -I${top_srcdir}/src \
        -I${top_srcdir}/src/generated \
        -I${top_builddir}/src/generated \
-       -I${top_srcdir}/src/logging
+       -I${top_srcdir}/src/logging \
+       -I${top_srcdir}/src/posix-signals
 
 noinst_LTLIBRARIES = libppp-manager.la
 
@@ -33,6 +34,7 @@ libppp_manager_la_CPPFLAGS = \
 libppp_manager_la_LIBADD = \
        $(top_builddir)/src/generated/libnm-generated.la \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(DBUS_LIBS) \
        $(GLIB_LIBS)
 
index 324ee0a..57ff12d 100644 (file)
@@ -16,7 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Copyright (C) 2008 Novell, Inc.
- * Copyright (C) 2008 - 2011 Red Hat, Inc.
+ * Copyright (C) 2008 - 2012 Red Hat, Inc.
  */
 
 #include <config.h>
@@ -53,6 +53,7 @@
 #include "nm-dbus-manager.h"
 #include "nm-logging.h"
 #include "nm-marshal.h"
+#include "nm-posix-signals.h"
 
 static void impl_ppp_manager_need_secrets (NMPPPManager *manager,
                                            DBusGMethodInvocation *context);
@@ -959,6 +960,12 @@ pppd_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for pppd here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static void
index 8b5b0f2..68225ba 100644 (file)
@@ -25,6 +25,7 @@ libifcfg_rh_io_la_SOURCES = \
 INCLUDES = \
        -I$(top_srcdir)/src/wifi \
        -I$(top_srcdir)/src/settings \
+       -I$(top_srcdir)/src/posix-signals \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/libnm-glib \
@@ -40,6 +41,7 @@ libifcfg_rh_io_la_CPPFLAGS = \
 
 libifcfg_rh_io_la_LIBADD = \
        $(top_builddir)/src/wifi/libwifi-utils.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(top_builddir)/libnm-util/libnm-util.la \
        $(GLIB_LIBS) \
        $(NSS_LIBS)
index dd17ffb..a2b08e4 100644 (file)
@@ -48,6 +48,7 @@
 #include <nm-utils.h>
 
 #include "wifi-utils.h"
+#include "nm-posix-signals.h"
 
 #include "common.h"
 #include "shvar.h"
@@ -208,6 +209,12 @@ iscsiadm_child_setup (gpointer user_data G_GNUC_UNUSED)
         */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for iscsiadm here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static char *
index c3c5b52..12e316d 100644 (file)
@@ -7,6 +7,7 @@ INCLUDES = \
        -I${top_srcdir}/src/generated \
        -I${top_builddir}/src/generated \
        -I${top_srcdir}/src/logging \
+       -I${top_srcdir}/src/posix-signals \
        -I${top_srcdir}/src \
        -I${top_srcdir}/src/dns-manager \
        -DVPN_NAME_FILES_DIR=\""$(sysconfdir)/NetworkManager/VPN"\"
@@ -31,6 +32,7 @@ libvpn_manager_la_CPPFLAGS =  \
 libvpn_manager_la_LIBADD = \
        $(top_builddir)/src/generated/libnm-generated.la \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/src/posix-signals/libnm-posix-signals.la \
        $(top_builddir)/libnm-util/libnm-util.la \
        $(LIBNL_LIBS) \
        $(DBUS_LIBS) \
index 95e4f2b..c8d0568 100644 (file)
@@ -15,7 +15,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2005 - 2011 Red Hat, Inc.
+ * Copyright (C) 2005 - 2012 Red Hat, Inc.
  * Copyright (C) 2005 - 2008 Novell, Inc.
  */
 
@@ -31,6 +31,7 @@
 #include "nm-vpn-service.h"
 #include "nm-dbus-manager.h"
 #include "nm-logging.h"
+#include "nm-posix-signals.h"
 #include "nm-vpn-manager.h"
 #include "nm-glib-compat.h"
 
@@ -168,6 +169,12 @@ nm_vpn_service_child_setup (gpointer user_data G_GNUC_UNUSED)
        /* We are in the child process at this point */
        pid_t pid = getpid ();
        setpgid (pid, pid);
+
+       /*
+        * We blocked signals in main(). We need to restore original signal
+        * mask for VPN service here so that it can receive signals.
+        */
+       nm_unblock_posix_signals (NULL);
 }
 
 static void