Skip to content

Commit

Permalink
unbound: check for valid interface-specific reload
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Aug 24, 2017
1 parent 5030189 commit c80da62
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/etc/inc/plugins.inc.d/unbound.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function unbound_configure()
return array(
'dns' => array('unbound_configure_do'),
'hosts' => array('unbound_hosts_generate:0'),
'newwanip' => array('unbound_configure_do'),
'newwanip' => array('unbound_configure_do:2'),
);
}

Expand Down Expand Up @@ -398,10 +398,45 @@ EOF;
}
}

function unbound_configure_do($verbose = false)
function unbound_interface($interface)
{
if (empty($interface)) {
/* emulate non-interface reload */
return true;
}

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

if (!empty($config['unbound']['outgoing_interface'])) {
foreach (explode(',', $config['unbound']['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 = '')
{
global $config;

if (!unbound_interface($interface)) {
return;
}

unbound_execute('stop');

if (!isset($config['unbound']['enable'])) {
Expand Down

0 comments on commit c80da62

Please sign in to comment.