Commit 20b39395 authored by Franco Fichtner's avatar Franco Fichtner

unbound: straighten out the dhcp reload mess, loosely refs #1256

This was done in early 16.7, seems to work fine so finish the
transition, dnsmasq is next...
parent a9b8f965
......@@ -1143,7 +1143,7 @@ function interfaces_configure()
/* restart dns servers (defering dhcp restart) */
services_dnsmasq_configure(false);
services_unbound_configure(false);
services_unbound_configure();
/* reload dhcpd (interface enabled/disabled status may have changed) */
services_dhcpd_configure();
......@@ -2891,7 +2891,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
/* restart dns servers (defering dhcp restart) */
services_dnsmasq_configure(false);
services_unbound_configure(false);
services_unbound_configure();
/* reload dhcpd (interface enabled/disabled status may have changed) */
services_dhcpd_configure();
......
......@@ -1916,30 +1916,25 @@ function services_dnsmasq_configure($dhcp_reload = true)
}
}
function services_unbound_configure($dhcp_reload = true, $verbose = false)
function services_unbound_configure($verbose = false)
{
global $config;
killbypid('/var/run/unbound.pid', 'TERM', true);
if (isset($config['unbound']['enable'])) {
if ($verbose) {
echo "Starting DNS Resolver...";
}
sync_unbound_service();
return;
}
if ($verbose) {
echo "done.\n";
}
if ($verbose) {
echo "Starting DNS Resolver...";
flush();
}
/*
* XXX this is overly convoluted, potentially
* restarting all of dhcp up to three times ;)
*/
if ($dhcp_reload) {
services_dhcpd_configure();
sync_unbound_service();
if ($verbose) {
echo "done.\n";
}
}
......
......@@ -138,7 +138,7 @@ function filter_configure_xmlrpc()
services_dhcpleases_configure();
local_sync_accounts();
services_dnsmasq_configure(false);
services_unbound_configure(false);
services_unbound_configure();
services_dhcpd_configure();
relayd_configure_do();
openvpn_resync_all();
......
......@@ -191,7 +191,7 @@ system_routing_enable();
services_dnsmasq_configure(false);
/* start unbound service */
services_unbound_configure(false, true);
services_unbound_configure(true);
/* Do an initial time sync */
echo "Starting NTP time client...";
......
......@@ -116,7 +116,7 @@ function reconfigure_dhcpd()
clear_subsystem_dirty('hosts');
}
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
services_unbound_configure(false);
services_unbound_configure();
clear_subsystem_dirty('unbound');
}
services_dhcpd_configure();
......
......@@ -47,7 +47,7 @@ function reconfigure_dhcpd()
}
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
services_unbound_configure(false);
services_unbound_configure();
clear_subsystem_dirty('unbound');
}
......
......@@ -59,6 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) {
services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound');
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
......
......@@ -67,6 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) {
services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_acls.php'));
exit;
......
......@@ -70,6 +70,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['apply'])) {
services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_advanced.php'));
exit;
......
......@@ -57,6 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pconfig = $_POST;
if (!empty($pconfig['apply'])) {
services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound');
/* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate();
......
......@@ -254,7 +254,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_hosts_generate();
services_dhcpleases_configure();
services_dnsmasq_configure(false);
services_unbound_configure(false);
services_unbound_configure();
services_dhcpd_configure();
if ($restart_sshd) {
......
......@@ -228,7 +228,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
services_dhcpleases_configure();
system_resolvconf_generate();
services_dnsmasq_configure(false);
services_unbound_configure(false);
services_unbound_configure();
services_dhcpd_configure();
system_timezone_configure();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment