SHA256
1
0
forked from pool/dhcp
dhcp/0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch
Marius Tomaschewski d059c507b7 - Initially switched to use systemd service files under systemd
and enabled Restart=on-abort (fate#315133).
- Update to ISC dhcp-4.2.6 release. See RELNOTES file for the
  complete list of changes -- digest of fixes not in dhcp-4.2.5:
  - Tidy up receive packet processing.
    Thanks to Brad Plank of GTA for reporting the issue and
    suggesting a possible patch. [ISC-Bugs #34447]
  - Fix the socket handling for DHCPv6 clients to allow multiple
    instances of a client on a single machine to work properly.
    Previously only one client would receive the packets.
    Thanks to Jiri Popelka at Red Hat for the bug report and a
    potential patch. [ISC-Bugs #34784]
  - Added support for gentle shutdown after signal is received.
    [ISC-Bugs #32692] [ISC-Bugs 34945]
  - Enhance the DHCPv6 server logging to include the addresses
    that are assigned to the clients.  This can be enabled by
    defining LOG_V6_ADDRESSES in site.h. [ISC-Bugs #26377]
  - Fix an operation in the DDNS code to be a bitwise instead
    of logical or. [ISC-Bugs #35138]
- Merged patches for dhcp-4.2.6 version to apply without fuzzy,
  prepended patch number prefixes to match spec file patch nr,
  added patch markup tags / bug numbers to the spec file.
- Applied contrib-lease-path pach to contrib.tar.gz
  [- contrib-lease-path.diff]
- Changed to require automake and use its config.sub and guess
  files instead of maintaining a patch.
  [- config-guess-sub-update.patch]
- Enabled to log DHCPv6 addresses assigned by server to clients
  [+ 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch]
- Cleaned up documentation, rpmlint adjustments.

OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=121
2014-02-10 18:14:12 +00:00

71 lines
1.8 KiB
Diff

From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Thu, 20 Dec 2012 10:25:53 +0100
Subject: [PATCH] Ignore SIGPIPE to not die in socket code
Installed SIG_IGN handler for SIGPIPE to not die before
the errno==EPIPE checks in the socket code are reached.
Unlike isc_app_start(), the isc_app_ctxstart() used by
dhcp, does not set any signal handlers.
Reported upstream as [ISC-Bugs #32222], IMO regression
to [ISC-Bugs #22269] as the SO_NOSIGPIPE socket option
isn't available e.g. on Linux.
---
omapip/isclib.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/omapip/isclib.c b/omapip/isclib.c
index afab262..9b7ff5f 100644
--- a/omapip/isclib.c
+++ b/omapip/isclib.c
@@ -69,6 +69,23 @@ isclib_cleanup(void)
return;
}
+static isc_result_t
+handle_signal(int sig, void (*handler)(int)) {
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = handler;
+
+ if (sigfillset(&sa.sa_mask) != 0 ||
+ sigaction(sig, &sa, NULL) < 0) {
+ log_error("handle_signal() %d setup: %s",
+ sig, strerror(errno));
+ return (ISC_R_UNEXPECTED);
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
isc_result_t
dhcp_context_create(void) {
isc_result_t result;
@@ -106,7 +123,20 @@ dhcp_context_create(void) {
result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
if (result != ISC_R_SUCCESS)
- return (result);
+ goto cleanup;
+
+ /*
+ * Always ignore SIGPIPE.
+ * Otherwise we will die before the errno == EPIPE
+ * checks in the socket code are reached.
+ *
+ * Note: unlike isc_app_start(), isc_app_ctxstart()
+ * does not set any signal handlers.
+ */
+ result = handle_signal(SIGPIPE, SIG_IGN);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
dhcp_gbl_ctx.actx_started = ISC_TRUE;
result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx,
--
1.8.4