mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
dhcpd: naming convention, plugins_configure() use
This commit is contained in:
parent
15ef1b10bc
commit
ba0c82dd54
@ -1082,8 +1082,7 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
|
||||
$track6 = link_interface_to_track6($interface);
|
||||
if (count($track6)) {
|
||||
/* bring down radvd and dhcp6 on these interfaces */
|
||||
require_once 'plugins.inc.d/dhcpd.inc'; /* XXX remove me */
|
||||
services_dhcpd_configure(false, 'inet6', $track6);
|
||||
plugins_configure('dhcp', false, array('inet6', $track6));
|
||||
}
|
||||
|
||||
switch ($ifcfg['ipaddrv6']) {
|
||||
@ -2572,9 +2571,8 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
if ($reload) {
|
||||
system_routing_configure($verbose, $interface);
|
||||
plugins_configure('ipsec', $verbose, array($interface));
|
||||
plugins_configure('dhcp', $verbose);
|
||||
plugins_configure('dns', $verbose);
|
||||
require_once 'plugins.inc.d/dhcpd.inc'; /* XXX remove me */
|
||||
services_dhcpd_configure($verbose);
|
||||
/* XXX move these up the call stack */
|
||||
configdp_run('dyndns reload', array($interface));
|
||||
configdp_run('rfc2136 reload', array($interface));
|
||||
|
||||
@ -29,6 +29,14 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function dhcpd_configure()
|
||||
{
|
||||
return array(
|
||||
'dhcp' => array('services_dhcpd_configure:3'),
|
||||
'dhcrelay' => array('dhcpd_dhcrelay_configure:2'),
|
||||
);
|
||||
}
|
||||
|
||||
function dhcpd_radvd_enabled()
|
||||
{
|
||||
global $config;
|
||||
@ -104,8 +112,8 @@ function dhcpd_services()
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "dhcrelay";
|
||||
$pconfig['description'] = gettext("DHCPv4 Relay");
|
||||
$pconfig['php']['restart'] = array('services_dhcrelay_configure');
|
||||
$pconfig['php']['start'] = array('services_dhcrelay_configure');
|
||||
$pconfig['php']['restart'] = array('dhcpd_dhcrelay4_configure');
|
||||
$pconfig['php']['start'] = array('dhcpd_dhcrelay4_configure');
|
||||
$pconfig['pidfile'] = '/var/run/dhcrelay.pid';
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
@ -114,8 +122,8 @@ function dhcpd_services()
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "dhcrelay6";
|
||||
$pconfig['description'] = gettext("DHCPv6 Relay");
|
||||
$pconfig['php']['restart'] = array('services_dhcrelay6_configure');
|
||||
$pconfig['php']['start'] = array('services_dhcrelay6_configure');
|
||||
$pconfig['php']['restart'] = array('dhcpd_dhcrelay6_configure');
|
||||
$pconfig['php']['start'] = array('dhcpd_dhcrelay6_configure');
|
||||
$pconfig['pidfile'] = '/var/run/dhcrelay6.pid';
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
@ -1534,7 +1542,18 @@ EOD;
|
||||
}
|
||||
}
|
||||
|
||||
function services_dhcrelay_configure($verbose = false)
|
||||
function dhcpd_dhcrelay_configure($verbose = false, $family = 'all')
|
||||
{
|
||||
if ($family == 'all' || $family == 'inet') {
|
||||
dhcpd_dhcrelay4_configure($verbose);
|
||||
}
|
||||
|
||||
if ($family == 'all' || $family == 'inet6') {
|
||||
dhcpd_dhcrelay6_configure($verbose);
|
||||
}
|
||||
}
|
||||
|
||||
function dhcpd_dhcrelay4_configure($verbose = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -1654,7 +1673,7 @@ function services_dhcrelay_configure($verbose = false)
|
||||
}
|
||||
}
|
||||
|
||||
function services_dhcrelay6_configure($verbose = false)
|
||||
function dhcpd_dhcrelay6_configure($verbose = false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
||||
@ -120,15 +120,14 @@ function filter_configure_xmlrpc()
|
||||
require_once("system.inc");
|
||||
require_once("util.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("plugins.inc.d/dhcpd.inc"); /* XXX */
|
||||
|
||||
system_routing_configure();
|
||||
plugins_configure('monitor');
|
||||
filter_configure();
|
||||
system_hosts_generate();
|
||||
local_sync_accounts();
|
||||
plugins_configure('dhcp');
|
||||
plugins_configure('dns');
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('remote');
|
||||
|
||||
return true;
|
||||
|
||||
@ -102,12 +102,10 @@ plugins_configure('earlybootup', true);
|
||||
system_cron_configure(true, true);
|
||||
system_routing_configure(true);
|
||||
|
||||
plugins_configure('dns', true);
|
||||
require_once 'plugins.inc.d/dhcpd.inc'; /* XXX */
|
||||
services_dhcpd_configure(true);
|
||||
system_hosts_generate(true);
|
||||
services_dhcrelay_configure(true);
|
||||
services_dhcrelay6_configure(true);
|
||||
plugins_configure('dhcp', true);
|
||||
plugins_configure('dhcrelay', true);
|
||||
plugins_configure('dns', true);
|
||||
|
||||
prefer_ipv4_or_ipv6();
|
||||
plugins_configure('monitor', true);
|
||||
|
||||
@ -115,8 +115,7 @@ if (!empty($grouptmp)) {
|
||||
}
|
||||
|
||||
if (count(link_interface_to_track6($interface, true))) {
|
||||
require_once 'plugins.inc.d/dhcpd.inc'; /* XXX */
|
||||
services_dhcpd_configure(false, 'inet6');
|
||||
plugins_configure('dhcp', false, array('inet6'));
|
||||
}
|
||||
|
||||
system_resolvconf_generate();
|
||||
|
||||
@ -35,7 +35,6 @@ require_once('rrd.inc');
|
||||
require_once("util.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once('plugins.inc.d/dhcpd.inc');
|
||||
|
||||
if (count($argv) > 1 && is_numeric($argv[1])) {
|
||||
// starting delayed.
|
||||
@ -52,7 +51,7 @@ system_resolvconf_generate(true);
|
||||
interfaces_configure(true);
|
||||
system_routing_configure(true);
|
||||
filter_configure_sync(true);
|
||||
services_dhcpd_configure(true);
|
||||
plugins_configure('dhcp', true);
|
||||
plugins_configure('local', true);
|
||||
plugins_configure('vpn', true);
|
||||
rrd_configure(true);
|
||||
|
||||
@ -562,10 +562,12 @@ plugins_configure('monitor', true);
|
||||
filter_configure_sync(true);
|
||||
|
||||
if ($restart_dhcpd) {
|
||||
/* XXX plugins_configure() */
|
||||
services_dhcpd_configure(true);
|
||||
}
|
||||
|
||||
if ($restart_webgui) {
|
||||
/* XXX plugins_configure() */
|
||||
webgui_configure_do(true);
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@ require_once("util.inc");
|
||||
require_once("rrd.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once('plugins.inc.d/dhcpd.inc');
|
||||
|
||||
system_console_mute();
|
||||
|
||||
@ -47,7 +46,7 @@ if (set_networking_interfaces_ports()) {
|
||||
interfaces_configure(true);
|
||||
system_routing_configure(true);
|
||||
filter_configure_sync(true);
|
||||
services_dhcpd_configure(true);
|
||||
plugins_configure('dhcp', true);
|
||||
plugins_configure('local', true);
|
||||
plugins_configure('vpn', true);
|
||||
rrd_configure(true);
|
||||
|
||||
@ -6,7 +6,7 @@ $logclog = true;
|
||||
function clear_hook()
|
||||
{
|
||||
killbyname('dhcpd');
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('dhcp');
|
||||
}
|
||||
|
||||
$service_hook = 'dhcpd';
|
||||
|
||||
@ -33,7 +33,6 @@ require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
require_once("system.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
function clear_all_log_files()
|
||||
{
|
||||
@ -80,7 +79,7 @@ function clear_all_log_files()
|
||||
|
||||
system_syslogd_start();
|
||||
killbyname('dhcpd');
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('dhcp');
|
||||
}
|
||||
|
||||
function is_valid_syslog_server($target) {
|
||||
|
||||
@ -176,9 +176,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
|
||||
|
||||
/* XXX what about DHCPv6? */
|
||||
if (isset($config['dhcpd'][$id])) {
|
||||
unset($config['dhcpd'][$id]);
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('dhcp');
|
||||
}
|
||||
if (isset($config['filter']['rule'])) {
|
||||
foreach ($config['filter']['rule'] as $x => $rule) {
|
||||
|
||||
@ -1,38 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2016 Deciso B.V.
|
||||
Copyright (C) 2010 Ermal Luçi
|
||||
Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>
|
||||
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) 2014-2016 Deciso B.V.
|
||||
* Copyright (C) 2010 Ermal Luçi
|
||||
* Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>
|
||||
* 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("services.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig['enable'] = isset($config['dhcrelay']['enable']);
|
||||
if (empty($config['dhcrelay']['interface'])) {
|
||||
@ -71,8 +70,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$config['dhcrelay']['agentoption'] = !empty($pconfig['agentoption']);
|
||||
$config['dhcrelay']['server'] = $pconfig['server'];
|
||||
write_config();
|
||||
// reconfigure
|
||||
services_dhcrelay_configure();
|
||||
plugins_configure('dhcrelay', false, array('inet'));
|
||||
header(url_safe('Location: /services_dhcp_relay.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -1,39 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2016 Deciso B.V.
|
||||
Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>
|
||||
Copyright (C) 2010 Ermal Luçi
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
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) 2014-2016 Deciso B.V.
|
||||
* Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>
|
||||
* Copyright (C) 2010 Ermal Luçi
|
||||
* Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>
|
||||
* 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("interfaces.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig['enable'] = isset($config['dhcrelay6']['enable']);
|
||||
if (empty($config['dhcrelay6']['interface'])) {
|
||||
@ -72,8 +71,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$config['dhcrelay6']['agentoption'] = !empty($pconfig['agentoption']);
|
||||
$config['dhcrelay6']['server'] = $pconfig['server'];
|
||||
write_config();
|
||||
// reconfigure
|
||||
services_dhcrelay6_configure();
|
||||
plugins_configure('dhcrelay', false, array('inet6'));
|
||||
header(url_safe('Location: /services_dhcpv6_relay.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("filter.inc");
|
||||
require_once("system.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
$a_group = &config_read_array('system', 'group');
|
||||
$a_authmode = auth_get_authserver_list();
|
||||
@ -297,7 +296,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
system_login_configure();
|
||||
system_hosts_generate();
|
||||
plugins_configure('dns');
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('dhcp');
|
||||
configd_run('openssh restart', true);
|
||||
|
||||
if ($restart_webgui) {
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("filter.inc");
|
||||
require_once("services.inc");
|
||||
require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
system_hosts_generate();
|
||||
system_resolvconf_generate();
|
||||
plugins_configure('dns');
|
||||
services_dhcpd_configure();
|
||||
plugins_configure('dhcp');
|
||||
filter_configure();
|
||||
|
||||
header(url_safe('Location: /system_general.php?savemsg=%s', array('The changes have been applied successfully.')));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user