dhcpd: finish pluginification by renaming services_dhcpd_configure()

While here let v4 and v6 DHCP steer what we're reloading.  That
should be wee bit quicker...
This commit is contained in:
Franco Fichtner 2019-05-04 13:18:24 +02:00
parent 8279f28288
commit ce68d5a547
12 changed files with 42 additions and 50 deletions

View File

@ -32,9 +32,9 @@
function dhcpd_configure()
{
return array(
'dhcp' => array('services_dhcpd_configure:3'),
'dhcp' => array('dhcpd_dhcp_configure:3'),
'dhcrelay' => array('dhcpd_dhcrelay_configure:2'),
'local' => array('services_dhcpd_configure', 'dhcpd_dhcrelay_configure'),
'local' => array('dhcpd_dhcp_configure', 'dhcpd_dhcrelay_configure'),
);
}
@ -503,8 +503,7 @@ function dhcpd_dhcpv6_leasesfile()
return '/var/dhcpd/var/db/dhcpd6.leases';
}
/* XXX dhcpd_dhcp_configure() */
function services_dhcpd_configure($verbose = false, $family = 'all', $blacklist = array())
function dhcpd_dhcp_configure($verbose = false, $family = 'all', $blacklist = array())
{
$dirs = array('/dev', '/etc', '/lib', '/run', '/usr', '/usr/local/sbin', '/var/db', '/var/run');

View File

@ -81,9 +81,6 @@ function validate_partial_mac_list($maclist) {
return true;
}
/**
* restart dhcp service
*/
function reconfigure_dhcpd()
{
/* Stop DHCP so we can cleanup leases */
@ -91,7 +88,7 @@ function reconfigure_dhcpd()
dhcp_clean_leases();
system_hosts_generate();
clear_subsystem_dirty('hosts');
services_dhcpd_configure();
dhcpd_dhcp_configure(false, 'inet');
clear_subsystem_dirty('staticmaps');
}

View File

@ -34,14 +34,11 @@ require_once("system.inc");
require_once("interfaces.inc");
require_once("services.inc");
/**
* restart dhcp service
*/
function reconfigure_dhcpd()
{
system_hosts_generate();
clear_subsystem_dirty('hosts');
services_dhcpd_configure();
dhcpd_dhcp_configure(false, 'inet6');
clear_subsystem_dirty('staticmaps');
}

View File

@ -116,7 +116,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config();
dnsmasq_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
header(url_safe('Location: /services_dnsmasq.php'));
exit;
}
@ -125,7 +125,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_resolvconf_generate();
system_hosts_generate();
dnsmasq_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
clear_subsystem_dirty('hosts');
header(url_safe('Location: /services_dnsmasq.php'));
exit;

View File

@ -113,7 +113,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$a_domainOverrides[] = $doment;
}
dnsmasq_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
write_config();
header(url_safe('Location: /services_dnsmasq.php'));
exit;

View File

@ -1,35 +1,34 @@
<?php
/*
Copyright (c) 2015 Franco Fichtner <franco@opnsense.org>
Copyright (c) 2008 Tellnet AG
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (c) 2015 Franco Fichtner <franco@opnsense.org>
* Copyright (c) 2008 Tellnet AG
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
require_once("guiconfig.inc");
require_once("system.inc");
require_once("services.inc");
require_once("interfaces.inc");
config_read_array('opendns');
@ -101,7 +100,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config('OpenDNS filter configuration change');
system_resolvconf_generate();
services_dhcpd_configure();
plugins_configure('dhcp');
$savemsg = get_std_save_message();
}
}

View File

@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) {
system_resolvconf_generate();
unbound_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound.php'));
exit;

View File

@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['apply'])) {
unbound_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_acls.php'));
exit;

View File

@ -78,7 +78,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['apply'])) {
unbound_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_advanced.php'));
exit;

View File

@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($pconfig['apply'])) {
system_resolvconf_generate();
unbound_configure_do();
services_dhcpd_configure();
plugins_configure('dhcp');
clear_subsystem_dirty('unbound');
header(url_safe('Location: /services_unbound_overrides.php'));
exit;

View File

@ -286,8 +286,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
fclose($fout);
@unlink($leasesfile);
@rename($leasesfile.".new", $leasesfile);
/* Restart DHCP Service */
services_dhcpd_configure();
dhcpd_dhcp_configure(false, 'inet');
}
}
exit;

View File

@ -356,8 +356,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
fclose($fout);
@unlink($leasesfile);
@rename($leasesfile.".new", $leasesfile);
/* Restart DHCP Service */
services_dhcpd_configure();
dhcpd_dhcp_configure(false, 'inet6');
}
}
exit;