mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
vpn: plug pppoe servers into services
This commit is contained in:
parent
3b42ee7e80
commit
6d7d0bc357
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user