summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authorhamnur <hamnur@protonmail.com>2017-06-30 10:41:18 +0200
committerhamnur <hamnur@protonmail.com>2017-06-30 10:41:18 +0200
commitab95d1fa87baa8b348faf789fe41c6ba660fda82 (patch)
tree0d9bbb8479c4a02642f2a3da26f9cdc0a891eaa3 /src/etc
parent1e0442e0612ecd289aa979bc945be0d8ead35f41 (diff)
parent38d110824c87ff60c6289c0432d55009586ceee4 (diff)
downloadpfsense-ab95d1fa87baa8b348faf789fe41c6ba660fda82.zip
pfsense-ab95d1fa87baa8b348faf789fe41c6ba660fda82.tar.gz
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/services.inc28
-rw-r--r--src/etc/inc/unbound.inc4
2 files changed, 24 insertions, 8 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index ffc4aa8..104a054 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -2235,12 +2235,24 @@ 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');
+
+ /* Attempt to stop unbound nicely */
+ do_as_unbound_user("stop");
+
+ /* kill Unbound if it did not stop cleanly */
+ 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 +2264,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", "TERM");
+ }
}
if (!platform_booting() && $restart_dhcp) {
diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc
index 428a523..e8adc89 100644
--- a/src/etc/inc/unbound.inc
+++ b/src/etc/inc/unbound.inc
@@ -465,10 +465,10 @@ function do_as_unbound_user($cmd, $param1 = "") {
mwexec("/usr/local/sbin/unbound -c {$g['unbound_chroot_path']}/unbound.conf");
break;
case "stop":
- mwexec("echo '/usr/local/sbin/unbound-control stop' | /usr/bin/su -m unbound", true);
+ mwexec("echo '/usr/local/sbin/unbound-control -c {$g['unbound_chroot_path']}/unbound.conf stop' | /usr/bin/su -m unbound", true);
break;
case "reload":
- mwexec("echo '/usr/local/sbin/unbound-control reload' | /usr/bin/su -m unbound", true);
+ mwexec("echo '/usr/local/sbin/unbound-control -c {$g['unbound_chroot_path']}/unbound.conf reload' | /usr/bin/su -m unbound", true);
break;
case "unbound-anchor":
$root_key_file = "{$g['unbound_chroot_path']}{$param1}/root.key";
OpenPOWER on IntegriCloud