From e701b476ceed801fe5c921045cb919e2a714039c Mon Sep 17 00:00:00 2001 From: Pavel Zhukov Date: Nov 13 2017 08:17:50 +0000 Subject: proper signal handling with shared context --- diff --git a/dhcp-handle_ctx_signals.patch b/dhcp-handle_ctx_signals.patch new file mode 100644 index 0000000..9bbe548 --- /dev/null +++ b/dhcp-handle_ctx_signals.patch @@ -0,0 +1,44 @@ +diff --git a/omapip/isclib.c b/omapip/isclib.c +index 9ec1a0f..42d82ff 100644 +--- a/omapip/isclib.c ++++ b/omapip/isclib.c +@@ -185,16 +185,6 @@ dhcp_context_create(int flags, + if (result != ISC_R_SUCCESS) + goto cleanup; + +- result = isc_app_ctxstart(dhcp_gbl_ctx.actx); +- if (result != ISC_R_SUCCESS) +- 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, +@@ -217,6 +207,21 @@ dhcp_context_create(int flags, + result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task); + if (result != ISC_R_SUCCESS) + goto cleanup; ++ ++ result = isc_app_ctxstart(dhcp_gbl_ctx.actx); ++ if (result != ISC_R_SUCCESS) ++ 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); ++ ++ /* Reset handlers installed by isc_app_ctxstart() ++ * to default for control-c and kill */ ++ handle_signal(SIGINT, SIG_DFL); ++ handle_signal(SIGTERM, SIG_DFL); + } + + #if defined (NSUPDATE) + diff --git a/dhcp.spec b/dhcp.spec index 12c762f..a8c2a62 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -20,7 +20,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.6 %global VERSION %%{version}%%{prever} -Release: 6%{?dist} +Release: 7%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -76,6 +76,7 @@ Patch34: dhcp-sd_notify.patch Patch36: dhcp-option97-pxe-client-id.patch Patch37: dhcp-stateless-DUID-LLT.patch Patch38: dhcp-dhclient-preinit6s.patch +Patch39: dhcp-handle_ctx_signals.patch BuildRequires: autoconf @@ -335,6 +336,9 @@ rm bind/bind.tar.gz # dhclient: make sure link-local address is ready in stateless mode (#1263466) %patch38 -p1 -b .preinit6s +# add signal handlers for proper work with share context +%patch39 -p1 -b .signals + # DHCLIENT_DEFAULT_PREFIX_LEN 64 -> 128 # https://bugzilla.gnome.org/show_bug.cgi?id=656610 sed -i -e 's|DHCLIENT_DEFAULT_PREFIX_LEN 64|DHCLIENT_DEFAULT_PREFIX_LEN 128|g' includes/site.h @@ -661,6 +665,9 @@ done %endif %changelog +* Thu Nov 9 2017 Pavel Zhukov - 12:4.3.6-7 +- Add patch for proper signal handling with shared context (#1457871) + * Wed Sep 20 2017 Pavel Zhukov - 12:4.3.6-6 - Do now override hostname variable in script