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() ...@@ -1143,7 +1143,7 @@ function interfaces_configure()
/* restart dns servers (defering dhcp restart) */ /* restart dns servers (defering dhcp restart) */
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
services_unbound_configure(false); services_unbound_configure();
/* reload dhcpd (interface enabled/disabled status may have changed) */ /* reload dhcpd (interface enabled/disabled status may have changed) */
services_dhcpd_configure(); services_dhcpd_configure();
...@@ -2891,7 +2891,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven ...@@ -2891,7 +2891,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
/* restart dns servers (defering dhcp restart) */ /* restart dns servers (defering dhcp restart) */
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
services_unbound_configure(false); services_unbound_configure();
/* reload dhcpd (interface enabled/disabled status may have changed) */ /* reload dhcpd (interface enabled/disabled status may have changed) */
services_dhcpd_configure(); services_dhcpd_configure();
......
...@@ -1916,15 +1916,19 @@ function services_dnsmasq_configure($dhcp_reload = true) ...@@ -1916,15 +1916,19 @@ function services_dnsmasq_configure($dhcp_reload = true)
} }
} }
function services_unbound_configure($dhcp_reload = true, $verbose = false) function services_unbound_configure($verbose = false)
{ {
global $config; global $config;
killbypid('/var/run/unbound.pid', 'TERM', true); killbypid('/var/run/unbound.pid', 'TERM', true);
if (isset($config['unbound']['enable'])) { if (isset($config['unbound']['enable'])) {
return;
}
if ($verbose) { if ($verbose) {
echo "Starting DNS Resolver..."; echo "Starting DNS Resolver...";
flush();
} }
sync_unbound_service(); sync_unbound_service();
...@@ -1932,15 +1936,6 @@ function services_unbound_configure($dhcp_reload = true, $verbose = false) ...@@ -1932,15 +1936,6 @@ function services_unbound_configure($dhcp_reload = true, $verbose = false)
if ($verbose) { if ($verbose) {
echo "done.\n"; echo "done.\n";
} }
}
/*
* XXX this is overly convoluted, potentially
* restarting all of dhcp up to three times ;)
*/
if ($dhcp_reload) {
services_dhcpd_configure();
}
} }
function services_snmpd_configure() function services_snmpd_configure()
......
...@@ -138,7 +138,7 @@ function filter_configure_xmlrpc() ...@@ -138,7 +138,7 @@ function filter_configure_xmlrpc()
services_dhcpleases_configure(); services_dhcpleases_configure();
local_sync_accounts(); local_sync_accounts();
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
services_unbound_configure(false); services_unbound_configure();
services_dhcpd_configure(); services_dhcpd_configure();
relayd_configure_do(); relayd_configure_do();
openvpn_resync_all(); openvpn_resync_all();
......
...@@ -191,7 +191,7 @@ system_routing_enable(); ...@@ -191,7 +191,7 @@ system_routing_enable();
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
/* start unbound service */ /* start unbound service */
services_unbound_configure(false, true); services_unbound_configure(true);
/* Do an initial time sync */ /* Do an initial time sync */
echo "Starting NTP time client..."; echo "Starting NTP time client...";
......
...@@ -116,7 +116,7 @@ function reconfigure_dhcpd() ...@@ -116,7 +116,7 @@ function reconfigure_dhcpd()
clear_subsystem_dirty('hosts'); clear_subsystem_dirty('hosts');
} }
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) { if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
services_unbound_configure(false); services_unbound_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
} }
services_dhcpd_configure(); services_dhcpd_configure();
......
...@@ -47,7 +47,7 @@ function reconfigure_dhcpd() ...@@ -47,7 +47,7 @@ function reconfigure_dhcpd()
} }
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) { if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
services_unbound_configure(false); services_unbound_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
} }
......
...@@ -59,6 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -59,6 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) { if (!empty($pconfig['apply'])) {
services_unbound_configure(); services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
/* Update resolv.conf in case the interface bindings exclude localhost. */ /* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate(); system_resolvconf_generate();
......
...@@ -67,6 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -67,6 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) { if (!empty($pconfig['apply'])) {
services_unbound_configure(); services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_acls.php')); header(url_safe('Location: /services_unbound_acls.php'));
exit; exit;
......
...@@ -70,6 +70,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -70,6 +70,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['apply'])) { if (!empty($_POST['apply'])) {
services_unbound_configure(); services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_advanced.php')); header(url_safe('Location: /services_unbound_advanced.php'));
exit; exit;
......
...@@ -57,6 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -57,6 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pconfig = $_POST; $pconfig = $_POST;
if (!empty($pconfig['apply'])) { if (!empty($pconfig['apply'])) {
services_unbound_configure(); services_unbound_configure();
services_dhcpd_configure();
clear_subsystem_dirty('unbound'); clear_subsystem_dirty('unbound');
/* Update resolv.conf in case the interface bindings exclude localhost. */ /* Update resolv.conf in case the interface bindings exclude localhost. */
system_resolvconf_generate(); system_resolvconf_generate();
......
...@@ -254,7 +254,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -254,7 +254,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_hosts_generate(); system_hosts_generate();
services_dhcpleases_configure(); services_dhcpleases_configure();
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
services_unbound_configure(false); services_unbound_configure();
services_dhcpd_configure(); services_dhcpd_configure();
if ($restart_sshd) { if ($restart_sshd) {
......
...@@ -228,7 +228,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -228,7 +228,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
services_dhcpleases_configure(); services_dhcpleases_configure();
system_resolvconf_generate(); system_resolvconf_generate();
services_dnsmasq_configure(false); services_dnsmasq_configure(false);
services_unbound_configure(false); services_unbound_configure();
services_dhcpd_configure(); services_dhcpd_configure();
system_timezone_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