summaryrefslogtreecommitdiffstats
path: root/src/etc
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:46:57 -0400
commit782453b4dbb77e5bc97a43f56b95a006c5434d65 (patch)
treec5701ca965654056a6d41b4063bfc5cd75b1e30f /src/etc
parentcc9b0f76da4936ac7510eee6cb5e0574d11b5973 (diff)
downloadpfsense-782453b4dbb77e5bc97a43f56b95a006c5434d65.zip
pfsense-782453b4dbb77e5bc97a43f56b95a006c5434d65.tar.gz
Use an alternate method to stop unbound and fix #7326
Diffstat (limited to 'src/etc')
-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 18bba0f..b17b088 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -2235,12 +2235,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 {
@@ -2252,13 +2261,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