summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-07-14 14:46:57 -0400
committerjim-p <jimp@pfsense.org>2017-07-14 14:48:21 -0400
commitdb3b3afb055c5a9f7f53b45984e585fcbeff1cb5 (patch)
tree4e700e416b4e25d0fdab1357c2569ebab488ae93
parent7505efe78431c4415dfd49d30c6035caf511b460 (diff)
downloadpfsense-db3b3afb055c5a9f7f53b45984e585fcbeff1cb5.zip
pfsense-db3b3afb055c5a9f7f53b45984e585fcbeff1cb5.tar.gz
Use an alternate method to stop unbound and fix #7326
(cherry picked from commit 782453b4dbb77e5bc97a43f56b95a006c5434d65) (cherry picked from commit 67fea036201f5af338338f6113033574ec25777e)
-rw-r--r--src/etc/inc/services.inc25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index 8081e81..94e1ad8 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -2289,12 +2289,21 @@ function services_unbound_configure($restart_dhcp = true) {
echo "services_unbound_configure() being called $mt\n";
}
- // kill any running Unbound instance
- if (file_exists("{$g['varrun_path']}/unbound.pid")) {
- sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
- }
-
if (isset($config['unbound']['enable'])) {
+ require_once('/etc/inc/unbound.inc');
+
+ /* Stop Unbound using TERM */
+ if (file_exists("{$g['varrun_path']}/unbound.pid")) {
+ sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
+ }
+
+ /* If unbound is still running, wait up to 30 seconds for it to terminate. */
+ for ($i=1; $i <= 30; $i++) {
+ if (is_process_running('unbound')) {
+ sleep(1);
+ }
+ }
+
if (platform_booting()) {
echo gettext("Starting DNS Resolver...");
} else {
@@ -2306,13 +2315,17 @@ function services_unbound_configure($restart_dhcp = true) {
$return = 1;
}
- require_once('/etc/inc/unbound.inc');
sync_unbound_service();
if (platform_booting()) {
echo gettext("done.") . "\n";
}
system_dhcpleases_configure();
+ } else {
+ /* kill Unbound since it should not be enabled */
+ if (file_exists("{$g['varrun_path']}/unbound.pid")) {
+ sigkillbypid("{$g['varrun_path']}/unbound.pid", "KILL");
+ }
}
if (!platform_booting() && $restart_dhcp) {
OpenPOWER on IntegriCloud