Skip to content

Commit

Permalink
unbound: bring back 4a1bc9f to avoid dynamic reloads when possible; c…
Browse files Browse the repository at this point in the history
…loses #6802
  • Loading branch information
fichtner committed Sep 14, 2023
1 parent fe17f4f commit a086f40
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/etc/inc/plugins.inc.d/unbound.inc
Expand Up @@ -348,11 +348,50 @@ function unbound_cache_flush()
configd_run('unbound cache flush');
}

function unbound_configure_do($verbose = false, $unused = '')
function unbound_match_interface($interface)
{
$general = config_read_array('OPNsense', 'unboundplus', 'general');

if (empty($interface)) {
/* emulate non-interface reload */
return true;
}

if (!empty($general['active_interface'])) {
foreach (explode(',', $general['active_interface']) as $used) {
if ($used == $interface) {
return true;
}
}
}

if (!empty($general['outgoing_interface'])) {
foreach (explode(',', $general['outgoing_interface']) as $used) {
if ($used == $interface) {
return true;
}
}
}

/*
* We can ignore this request as we don't listen here
* or always listen on :: / 0.0.0.0 so that a reload
* is not necessary.
*/
return false;
}

function unbound_configure_do($verbose = false, $interface = null)
{
global $config;

$mdl = new \OPNsense\Unbound\Unbound();

/* try to avoid restarting, but make sure to let it start if it is not running */
if (!unbound_match_interface($interface) && isvalidpid('/var/run/unbound.pid')) {
return;
}

unbound_service_stop();

if (!unbound_enabled()) {
Expand Down

0 comments on commit a086f40

Please sign in to comment.