Commit 6d7d0bc3 authored by Franco Fichtner's avatar Franco Fichtner

vpn: plug pppoe servers into services

parent 3b42ee7e
......@@ -69,7 +69,23 @@ function vpn_services()
);
}
/* XXX pppoe server instances too */
if (isset($config['pppoes']['pppoe'])) {
foreach ($config['pppoes']['pppoe'] as $pppoecfg) {
if (isset($pppoecfg['mode']) || $pppoecfg['mode'] != 'off') {
$services[] = array(
'description' => gettext('PPPoE Server') . ': ' . htmlspecialchars($pppoecfg['descr']),
'php' => array(
'restart' => array('vpn_pppoe_configure_by_id'),
'start' => array('vpn_pppoe_configure_by_id'),
'args' => array('pppoeid'),
),
'pidfile' => "/var/run/pppoe{$pppoecfg['pppoeid']}-vpn.pid",
'pppoeid' => $pppoecfg['pppoeid'],
'name' => 'pppoed',
);
}
}
}
return $services;
}
......@@ -319,6 +335,31 @@ function vpn_pppoes_configure()
}
}
function vpn_pppoe_configure_by_id($id)
{
global $config;
$found = null;
if (isset($config['pppoes']['pppoe'])) {
foreach ($config['pppoes']['pppoe'] as $pppoe) {
if (!isset($pppoe['mode']) || $pppoe['mode'] == 'off') {
continue;
}
if ($id != 0 && $id == $pppoe['pppoeid']) {
$found = $pppoe;
break;
}
}
}
if ($found == null) {
return;
}
vpn_pppoe_configure($found);
}
function vpn_pppoe_configure(&$pppoecfg)
{
global $config;
......
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