Commit 2cb7662e authored by Franco Fichtner's avatar Franco Fichtner

plugins: clean up a bit, add temporary laucher for functions

(cherry picked from commit 93e47fac)
parent 73df7592
......@@ -29,3 +29,11 @@
foreach (glob('/usr/local/etc/inc/plugins.inc.d/*.inc') as $plugin) {
require_once $plugin;
}
/* XXX must be reworked to work dynamically, not by name */
function plugins_hook_xxx($name)
{
if (function_exists($name)) {
return $name();
}
}
......@@ -29,18 +29,6 @@
POSSIBILITY OF SUCH DAMAGE.
*/
function vpn_setup()
{
/* start pptpd */
vpn_pptpd_configure();
/* start pppoe server */
vpn_pppoes_configure();
/* setup l2tp */
vpn_l2tp_configure();
}
function vpn_netgraph_support() {
$iflist = get_configured_interface_list();
foreach ($iflist as $iface) {
......@@ -275,16 +263,19 @@ EOD;
return 0;
}
function vpn_pppoes_configure() {
function vpn_pppoes_configure()
{
global $config;
if (isset($config['pppoes']['pppoe']) && is_array($config['pppoes']['pppoe'])) {
foreach ($config['pppoes']['pppoe'] as $pppoe)
if (isset($config['pppoes']['pppoe'])) {
foreach ($config['pppoes']['pppoe'] as $pppoe) {
vpn_pppoe_configure($pppoe);
}
}
}
function vpn_pppoe_configure(&$pppoecfg) {
function vpn_pppoe_configure(&$pppoecfg)
{
global $config;
$syscfg = $config['system'];
......
......@@ -315,8 +315,14 @@ configd_run("dyndns reload");
/* Run a filter configure now that most all services have started */
filter_configure_sync();
/* setup pppoe and pptp */
vpn_setup();
/* start pptpd */
plugins_hook_xxx('vpn_pptpd_configure');
/* start pppoe server */
plugins_hook_xxx('vpn_pppoes_configure');
/* setup l2tp */
plugins_hook_xxx('vpn_l2tp_configure');
/* start IPsec tunnels */
$ipsec_dynamic_hosts = ipsec_configure();
......
......@@ -187,11 +187,8 @@ if ($_POST) {
}
write_config();
$retval = 0;
$retval = vpn_pptpd_configure();
$savemsg = get_std_save_message();
vpn_pptpd_configure();
filter_configure();
}
}
......
......@@ -39,15 +39,10 @@ if ($_POST) {
$pconfig = $_POST;
if ($_POST['apply']) {
$retval = 0;
$retval = vpn_setup();
vpn_pptpd_configure();
$savemsg = get_std_save_message();
if ($retval == 0) {
if (is_subsystem_dirty('pptpusers')) {
clear_subsystem_dirty('pptpusers');
}
}
}
}
if ($_GET['act'] == "del") {
......
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