mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
openvpn: improve plugging further for #1157
This commit is contained in:
parent
1d73b3b59d
commit
1811e1d204
@ -82,6 +82,7 @@ function openvpn_create_key()
|
||||
function openvpn_vpnid_used($vpnid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['openvpn']['openvpn-server'])) {
|
||||
foreach ($config['openvpn']['openvpn-server'] as &$settings) {
|
||||
if ($vpnid == $settings['vpnid']) {
|
||||
@ -99,7 +100,7 @@ function openvpn_vpnid_used($vpnid)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function openvpn_vpnid_next()
|
||||
{
|
||||
|
||||
@ -73,15 +73,21 @@ function if_openvpn_interfaces()
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
if ((isset($config['openvpn']['openvpn-server']) && count($config['openvpn']['openvpn-server'])) ||
|
||||
(isset($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) {
|
||||
$oic = array("enable" => true);
|
||||
$oic['if'] = "openvpn";
|
||||
$oic['descr'] = 'OpenVPN';
|
||||
$oic['type'] = "none";
|
||||
$oic['virtual'] = true;
|
||||
$oic['networks'] = array();
|
||||
$interfaces['openvpn'] = $oic;
|
||||
foreach (array('server', 'client') as $mode) {
|
||||
if (isset($config['openvpn']["openvpn-{$mode}"])) {
|
||||
foreach ($config['openvpn']["openvpn-{$mode}"] as &$settings) {
|
||||
if (!isset($settings['disable'])) {
|
||||
$oic = array('enable' => true);
|
||||
$oic['if'] = 'openvpn';
|
||||
$oic['descr'] = 'OpenVPN';
|
||||
$oic['type'] = 'none';
|
||||
$oic['virtual'] = true;
|
||||
$oic['networks'] = array();
|
||||
$interfaces['openvpn'] = $oic;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $interfaces;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user