From 78dda3b093b69f0c13773449dc732be5de40f620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Mon, 21 May 2012 14:10:05 +0200 Subject: [PATCH] core: unblock signals for child processes we spawn out of NM (rh #739836) 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. --- configure.ac | 1 + src/Makefile.am | 3 ++ src/NetworkManagerUtils.c | 5 +- src/dhcp-manager/Makefile.am | 3 ++ src/dhcp-manager/nm-dhcp-dhclient.c | 9 +++- src/dhcp-manager/nm-dhcp-dhcpcd.c | 7 +++ src/dns-manager/Makefile.am | 2 + src/dns-manager/nm-dns-manager.c | 9 +++- src/dns-manager/nm-dns-plugin.c | 9 +++- src/dnsmasq-manager/Makefile.am | 2 + src/dnsmasq-manager/nm-dnsmasq-manager.c | 9 +++- src/main.c | 6 ++- src/nm-activation-request.c | 3 ++ src/nm-device.c | 9 ++++ src/posix-signals/Makefile.am | 15 ++++++ src/posix-signals/nm-posix-signals.c | 62 +++++++++++++++++++++++ src/posix-signals/nm-posix-signals.h | 36 +++++++++++++ src/ppp-manager/Makefile.am | 4 +- src/ppp-manager/nm-ppp-manager.c | 9 +++- src/settings/plugins/ifcfg-rh/Makefile.am | 2 + src/settings/plugins/ifcfg-rh/reader.c | 7 +++ src/vpn-manager/Makefile.am | 2 + src/vpn-manager/nm-vpn-service.c | 9 +++- 23 files changed, 213 insertions(+), 10 deletions(-) create mode 100644 src/posix-signals/Makefile.am create mode 100644 src/posix-signals/nm-posix-signals.c create mode 100644 src/posix-signals/nm-posix-signals.h diff --git a/configure.ac b/configure.ac index 127314c7d9..654153dd27 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 0a83c88b8b..7930c286b7 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 6c2c0446b2..952b4e5d95 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 ce34c41664..11560fde83 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 09321396e8..2018cdeaf8 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 237661fe47..dc9bee130f 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 331f85c481..fd31b140cf 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 6272e3748e..b75aa92b50 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 e997948e9a..b26f2b9460 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 66bbdd83f8..8b7dd683cb 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 ca2f9dc433..0b3b629f35 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 412bd52f42..e8ff2e4c92 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 3fc7b538dc..0b957fd70e 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 69c3a770d2..8fa8a4fb3d 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 0000000000..88c3d8d427 --- /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 0000000000..22fed83103 --- /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 0000000000..81be5e1c4f --- /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 8df2f58457..36e54ec931 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 324ee0a1c0..57ff12d03b 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 8b5b0f24bb..68225ba1f2 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 dd17ffbc56..a2b08e4f98 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 c3c5b52526..12e316d89f 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 95e4f2b178..c8d05687fc 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