about summary refs log tree commit diff
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog7
-rw-r--r--debian/patches/0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch80
-rw-r--r--debian/patches/0014-log-DHCLIENT-exit-status-better.patch62
-rw-r--r--debian/patches/series2
4 files changed, 149 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index c8cdefc6..466e2774 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,11 @@
 network-manager (0.9.10.0-4) UNRELEASED; urgency=medium
 
-  * Fix arping patch and add iputils-arping to the Recommends (Closes:#755039)
+  * Fix arping path and add iputils-arping to the Recommends (Closes:#755039)
+  * Add d/p/0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch,
+    d/p/0014-log-DHCLIENT-exit-status-better.patch: Prevent dhclient to crash
+    when journald is restarted (Closes: #756144)
 
- -- Laurent Bigonville <bigon@debian.org>  Mon, 27 Oct 2014 11:06:47 +0100
+ -- Laurent Bigonville <bigon@debian.org>  Sat, 13 Dec 2014 12:13:00 +0100
 
 network-manager (0.9.10.0-3) unstable; urgency=medium
 
diff --git a/debian/patches/0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch b/debian/patches/0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch
new file mode 100644
index 00000000..edf5f58e
--- /dev/null
+++ b/debian/patches/0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch
@@ -0,0 +1,80 @@
+From 151058b870970b2c0488e37047c86c0e599731d4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
+Date: Tue, 9 Sep 2014 13:32:46 +0200
+Subject: [PATCH 1/2] dhcp: fix dhclient abnormal exit due to SIGPIPE (bgo
+ #735962)
+
+DHCP client may be killed by SIGPIPE when attempting to write to a broken pipe.
+This can be observed, for example, when journald is restarted.
+
+Fix that by redirecting both stdout and stderr to /dev/null. The client logs
+into syslog anyway. When NetworkManager is run with '--debug' we duplicate
+syslog to stderr, so the messages goes to terminal as well.
+
+Testcase:
+- start a NetworkManager service by systemd
+- activate an DHCP ethernet connection
+- sudo systemctl restart systemd-journald.service
+- reactive the ethernet connection (nmcli con up <my-eth>)
+- DHCP client is killed by SIGPIPE right after its startup:
+    <info> (enp0s25): DHCPv4 client pid 13959 exited with status -1
+    <warn> DHCP client died abnormally
+
+Another possible fix would be ignoring SIGPIPE in the DHCP client as it is not
+useful in most cases. E.g. systemd ignores SIGPIPE for its services, by
+default:
+http://cgit.freedesktop.org/systemd/systemd/commit/?id=353e12c2f4a9e96a47eb80b80d2ffb7bc1d44a1b
+
+https://bugzilla.gnome.org/show_bug.cgi?id=735962
+
+Conflicts:
+	src/dhcp-manager/nm-dhcp-dhclient.c
+	src/dhcp-manager/nm-dhcp-dhcpcd.c
+---
+ src/dhcp-manager/nm-dhcp-dhclient.c | 8 +++++++-
+ src/dhcp-manager/nm-dhcp-dhcpcd.c   | 3 ++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
+index 4232ee0..595a0ac 100644
+--- a/src/dhcp-manager/nm-dhcp-dhclient.c
++++ b/src/dhcp-manager/nm-dhcp-dhclient.c
+@@ -413,6 +413,11 @@ dhclient_start (NMDHCPClient *client,
+ 
+ 	g_ptr_array_add (argv, (gpointer) "-d");
+ 
++	/* Be quiet. dhclient logs to syslog anyway. And we duplicate the syslog
++	 * to stderr in case of NM running with --debug.
++	 */
++	g_ptr_array_add (argv, (gpointer) "-q");
++
+ 	if (release)
+ 		g_ptr_array_add (argv, (gpointer) "-r");
+ 
+@@ -456,7 +461,8 @@ dhclient_start (NMDHCPClient *client,
+ 	nm_log_dbg (log_domain, "running: %s", cmd_str);
+ 	g_free (cmd_str);
+ 
+-	if (!g_spawn_async (NULL, (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
++	if (!g_spawn_async (NULL, (char **) argv->pdata, NULL,
++	                    G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
+ 	                    &dhclient_child_setup, NULL, &pid, &error)) {
+ 		nm_log_warn (log_domain, "dhclient failed to start: '%s'", error->message);
+ 		g_error_free (error);
+diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c
+index c0877a6..b295ae9 100644
+--- a/src/dhcp-manager/nm-dhcp-dhcpcd.c
++++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c
+@@ -155,7 +155,8 @@ ip4_start (NMDHCPClient *client,
+ 	nm_log_dbg (LOGD_DHCP4, "running: %s", cmd_str);
+ 	g_free (cmd_str);
+ 
+-	if (!g_spawn_async (NULL, (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
++	if (!g_spawn_async (NULL, (char **) argv->pdata, NULL,
++	                    G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
+ 	                    &dhcpcd_child_setup, NULL, &pid, &error)) {
+ 		nm_log_warn (LOGD_DHCP4, "dhcpcd failed to start.  error: '%s'", error->message);
+ 		g_error_free (error);
+-- 
+2.1.3
+
diff --git a/debian/patches/0014-log-DHCLIENT-exit-status-better.patch b/debian/patches/0014-log-DHCLIENT-exit-status-better.patch
new file mode 100644
index 00000000..cfb47f30
--- /dev/null
+++ b/debian/patches/0014-log-DHCLIENT-exit-status-better.patch
@@ -0,0 +1,62 @@
+From 1571e19f81f3ac1ce646d77ffb2fa730dd8b35d8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
+Date: Wed, 3 Sep 2014 12:45:58 +0200
+Subject: [PATCH 2/2] dhcp: log DHCP client exit status better
+
+Conflicts:
+	src/dhcp-manager/nm-dhcp-client.c
+---
+ src/dhcp-manager/nm-dhcp-client.c | 35 ++++++++++++++++++++++-------------
+ 1 file changed, 22 insertions(+), 13 deletions(-)
+
+diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
+index 0a541a0..759bd49 100644
+--- a/src/dhcp-manager/nm-dhcp-client.c
++++ b/src/dhcp-manager/nm-dhcp-client.c
+@@ -255,21 +255,30 @@ daemon_watch_cb (GPid pid, gint status, gpointer user_data)
+ 	NMDHCPClient *self = NM_DHCP_CLIENT (user_data);
+ 	NMDHCPClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
+ 	NMDHCPState new_state;
++	guint64 log_domain;
++	guint ip_ver;
++
++	log_domain = priv->ipv6 ? LOGD_DHCP6 : LOGD_DHCP4;
++	ip_ver = priv->ipv6 ? 6 : 4;
++
++	if (WIFEXITED (status))
++		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d exited with status %d",
++		             priv->iface, ip_ver, pid, WEXITSTATUS (status));
++	else if (WIFSIGNALED (status))
++		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d killed by signal %d",
++		             priv->iface, ip_ver, pid, WTERMSIG (status));
++	else if (WIFSTOPPED(status))
++		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d stopped by signal %d",
++		             priv->iface, ip_ver, pid, WSTOPSIG (status));
++	else if (WIFCONTINUED (status))
++		nm_log_info (log_domain, "(%s): DHCPv%d client pid %d resumed (by SIGCONT)",
++		             priv->iface, ip_ver, pid);
++	else
++		nm_log_warn (LOGD_DHCP, "DHCP client died abnormally");
+ 
+-	if (priv->ipv6) {
+-		nm_log_info (LOGD_DHCP6, "(%s): DHCPv6 client pid %d exited with status %d",
+-		             priv->iface, pid,
+-		             WIFEXITED (status) ? WEXITSTATUS (status) : -1);
+-	} else {
+-		nm_log_info (LOGD_DHCP4, "(%s): DHCPv4 client pid %d exited with status %d",
+-		             priv->iface, pid,
+-		             WIFEXITED (status) ? WEXITSTATUS (status) : -1);
+-	}
+-
+-	if (!WIFEXITED (status)) {
++	if (!WIFEXITED (status))
+ 		new_state = DHC_ABEND;
+-		nm_log_warn (LOGD_DHCP, "DHCP client died abnormally");
+-	} else
++	else
+ 		new_state = DHC_END;
+ 
+ 	watch_cleanup (self);
+-- 
+2.1.3
+
diff --git a/debian/patches/series b/debian/patches/series
index ffb76316..345726d6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,5 @@
 0010-tui-fix-requesting-and-displaying-secrets.patch
 0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch
 0012-fix-arping-path.patch
+0013-fix-dhclient-abnormal-exit-due-to-SIGPIPE.patch
+0014-log-DHCLIENT-exit-status-better.patch