diff --git a/configure.ac b/configure.ac index 127314c7d..654153dd2 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 0a83c88b8..7930c286b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 6c2c0446b..952b4e5d9 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -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); } diff --git a/src/dhcp-manager/Makefile.am b/src/dhcp-manager/Makefile.am index ce34c4166..11560fde8 100644 --- a/src/dhcp-manager/Makefile.am +++ b/src/dhcp-manager/Makefile.am @@ -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) diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c index 09321396e..2018cdeaf 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient.c +++ b/src/dhcp-manager/nm-dhcp-dhclient.c @@ -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 diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c index 237661fe4..dc9bee130 100644 --- a/src/dhcp-manager/nm-dhcp-dhcpcd.c +++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c @@ -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 diff --git a/src/dns-manager/Makefile.am b/src/dns-manager/Makefile.am index 331f85c48..fd31b140c 100644 --- a/src/dns-manager/Makefile.am +++ b/src/dns-manager/Makefile.am @@ -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) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 6272e3748..b75aa92b5 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2004 - 2005 Colin Walters - * 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 diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c index e997948e9..b26f2b946 100644 --- a/src/dns-manager/nm-dns-plugin.c +++ b/src/dns-manager/nm-dns-plugin.c @@ -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 diff --git a/src/dnsmasq-manager/Makefile.am b/src/dnsmasq-manager/Makefile.am index 66bbdd83f..8b7dd683c 100644 --- a/src/dnsmasq-manager/Makefile.am +++ b/src/dnsmasq-manager/Makefile.am @@ -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) diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index ca2f9dc43..0b3b629f3 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -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 @@ -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 diff --git a/src/main.c b/src/main.c index 412bd52f4..e8ff2e4c9 100644 --- a/src/main.c +++ b/src/main.c @@ -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); diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c index 3fc7b538d..0b957fd70 100644 --- a/src/nm-activation-request.c +++ b/src/nm-activation-request.c @@ -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 diff --git a/src/nm-device.c b/src/nm-device.c index 69c3a770d..8fa8a4fb3 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -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 index 000000000..88c3d8d42 --- /dev/null +++ b/src/posix-signals/Makefile.am @@ -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 index 000000000..22fed8310 --- /dev/null +++ b/src/posix-signals/nm-posix-signals.c @@ -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 + +#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 index 000000000..81be5e1c4 --- /dev/null +++ b/src/posix-signals/nm-posix-signals.h @@ -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 +#include + +/* + * 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 */ diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am index 8df2f5845..36e54ec93 100644 --- a/src/ppp-manager/Makefile.am +++ b/src/ppp-manager/Makefile.am @@ -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) diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 324ee0a1c..57ff12d03 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -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 @@ -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 diff --git a/src/settings/plugins/ifcfg-rh/Makefile.am b/src/settings/plugins/ifcfg-rh/Makefile.am index 8b5b0f24b..68225ba1f 100644 --- a/src/settings/plugins/ifcfg-rh/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/Makefile.am @@ -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) diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index dd17ffbc5..a2b08e4f9 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -48,6 +48,7 @@ #include #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 * diff --git a/src/vpn-manager/Makefile.am b/src/vpn-manager/Makefile.am index c3c5b5252..12e316d89 100644 --- a/src/vpn-manager/Makefile.am +++ b/src/vpn-manager/Makefile.am @@ -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) \ diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 95e4f2b17..c8d05687f 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -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