]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Set signal action to ingore for SIGPIPE
authorThomas Markwalder <tmark@isc.org>
Wed, 5 Nov 2014 12:31:17 +0000 (07:31 -0500)
committerThomas Markwalder <tmark@isc.org>
Wed, 5 Nov 2014 12:31:17 +0000 (07:31 -0500)
    Merges in rt32222.

RELNOTES
omapip/isclib.c

index a01b7d928e7c5b0c8f8b74ed635c4421d8e455c5..aad27532099c6b13e4a3ddf6933770a9d6eb9db6 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -129,6 +129,12 @@ by Eric Young (eay@cryptsoft.com).
   BOOTP request handling.
   [ISC-Bugs #36233]
 
+- 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.3.1b1
 
 - Modify the linux and openwrt dhclient scripts to process information
index 3e5e1c2b30e2eaec1d2ebb70270bd42a62e2ecfe..13f0d3ebca9c10203ccebc4d476563da0a954246 100644 (file)
@@ -120,6 +120,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(int flags,
                    struct in_addr  *local4,
@@ -176,6 +190,11 @@ dhcp_context_create(int flags,
                        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,