summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2014-11-05 09:48:51 -0500
committerThomas Markwalder <tmark@isc.org>2014-11-05 09:48:51 -0500
commitd73c62c52326cf3e4aceb793952bfcf1d0a7d0cb (patch)
tree2b3e816fd2ed401ebaba8ab28f437b21d49d15e9
parent9b25f2e56d6d185e370b41ca70c01f842a16d6d5 (diff)
downloadisc-dhcp-d73c62c52326cf3e4aceb793952bfcf1d0a7d0cb.tar.gz
[v4_2] Set signal action to ingore for SIGPIPE
Merges in rt32222.
-rw-r--r--RELNOTES6
-rw-r--r--omapip/isclib.c19
2 files changed, 25 insertions, 0 deletions
diff --git a/RELNOTES b/RELNOTES
index fae497d5..726d7ef7 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -125,6 +125,12 @@ by Eric Young (eay@cryptsoft.com).
and no other value is available.
[ISC-Bugs #21323]
+- Added logic to ignore the signal, SIGPIPE, which ensures write failures
+ will be delivered as errors rather than as SIGPIPE signals on all OSs.
+ Thanks to Marius Tomaschewski from SUSE who reported the issue and provided
+ the patch upon which the fix is based.
+ [ISC-Bugs #32222]
+
Changes since 4.2.7rc1
- None
diff --git a/omapip/isclib.c b/omapip/isclib.c
index 486f70c2..ce42e45f 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -69,6 +69,20 @@ isclib_cleanup(void)
return;
}
+/* Installs a handler for a signal using sigaction */
+static void
+handle_signal(int sig, void (*handler)(int)) {
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = handler;
+ sigfillset(&sa.sa_mask);
+ if (sigaction(sig, &sa, NULL) != 0) {
+ log_debug("handle_signal() failed for signal %d error: %s",
+ sig, strerror(errno));
+ }
+}
+
isc_result_t
dhcp_context_create(void) {
isc_result_t result;
@@ -119,6 +133,11 @@ dhcp_context_create(void) {
return (result);
dhcp_gbl_ctx.actx_started = ISC_TRUE;
+ /* Not all OSs support suppressing SIGPIPE through socket
+ * options, so set the sigal action to be ignore. This allows
+ * broken connections to fail gracefully with EPIPE on writes */
+ handle_signal(SIGPIPE, SIG_IGN);
+
result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
dhcp_gbl_ctx.actx,
1, 0,