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 @@ ...@@ -29,3 +29,11 @@
foreach (glob('/usr/local/etc/inc/plugins.inc.d/*.inc') as $plugin) { foreach (glob('/usr/local/etc/inc/plugins.inc.d/*.inc') as $plugin) {
require_once $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 @@ ...@@ -29,18 +29,6 @@
POSSIBILITY OF SUCH DAMAGE. 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() { function vpn_netgraph_support() {
$iflist = get_configured_interface_list(); $iflist = get_configured_interface_list();
foreach ($iflist as $iface) { foreach ($iflist as $iface) {
...@@ -275,16 +263,19 @@ EOD; ...@@ -275,16 +263,19 @@ EOD;
return 0; return 0;
} }
function vpn_pppoes_configure() { function vpn_pppoes_configure()
global $config; {
global $config;
if (isset($config['pppoes']['pppoe']) && is_array($config['pppoes']['pppoe'])) { if (isset($config['pppoes']['pppoe'])) {
foreach ($config['pppoes']['pppoe'] as $pppoe) foreach ($config['pppoes']['pppoe'] as $pppoe) {
vpn_pppoe_configure($pppoe); vpn_pppoe_configure($pppoe);
} }
}
} }
function vpn_pppoe_configure(&$pppoecfg) { function vpn_pppoe_configure(&$pppoecfg)
{
global $config; global $config;
$syscfg = $config['system']; $syscfg = $config['system'];
......
...@@ -315,8 +315,14 @@ configd_run("dyndns reload"); ...@@ -315,8 +315,14 @@ configd_run("dyndns reload");
/* Run a filter configure now that most all services have started */ /* Run a filter configure now that most all services have started */
filter_configure_sync(); filter_configure_sync();
/* setup pppoe and pptp */ /* start pptpd */
vpn_setup(); 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 */ /* start IPsec tunnels */
$ipsec_dynamic_hosts = ipsec_configure(); $ipsec_dynamic_hosts = ipsec_configure();
......
...@@ -187,11 +187,8 @@ if ($_POST) { ...@@ -187,11 +187,8 @@ if ($_POST) {
} }
write_config(); write_config();
$retval = 0;
$retval = vpn_pptpd_configure();
$savemsg = get_std_save_message(); $savemsg = get_std_save_message();
vpn_pptpd_configure();
filter_configure(); filter_configure();
} }
} }
......
...@@ -39,14 +39,9 @@ if ($_POST) { ...@@ -39,14 +39,9 @@ if ($_POST) {
$pconfig = $_POST; $pconfig = $_POST;
if ($_POST['apply']) { if ($_POST['apply']) {
$retval = 0; vpn_pptpd_configure();
$retval = vpn_setup();
$savemsg = get_std_save_message(); $savemsg = get_std_save_message();
if ($retval == 0) { clear_subsystem_dirty('pptpusers');
if (is_subsystem_dirty('pptpusers')) {
clear_subsystem_dirty('pptpusers');
}
}
} }
} }
......
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