Commit 1811e1d2 authored by Franco Fichtner's avatar Franco Fichtner

openvpn: improve plugging further for #1157

parent 1d73b3b5
...@@ -82,6 +82,7 @@ function openvpn_create_key() ...@@ -82,6 +82,7 @@ function openvpn_create_key()
function openvpn_vpnid_used($vpnid) function openvpn_vpnid_used($vpnid)
{ {
global $config; global $config;
if (isset($config['openvpn']['openvpn-server'])) { if (isset($config['openvpn']['openvpn-server'])) {
foreach ($config['openvpn']['openvpn-server'] as &$settings) { foreach ($config['openvpn']['openvpn-server'] as &$settings) {
if ($vpnid == $settings['vpnid']) { if ($vpnid == $settings['vpnid']) {
...@@ -99,7 +100,7 @@ function openvpn_vpnid_used($vpnid) ...@@ -99,7 +100,7 @@ function openvpn_vpnid_used($vpnid)
} }
return false; return false;
} }
function openvpn_vpnid_next() function openvpn_vpnid_next()
{ {
......
...@@ -73,15 +73,21 @@ function if_openvpn_interfaces() ...@@ -73,15 +73,21 @@ function if_openvpn_interfaces()
$interfaces = array(); $interfaces = array();
if ((isset($config['openvpn']['openvpn-server']) && count($config['openvpn']['openvpn-server'])) || foreach (array('server', 'client') as $mode) {
(isset($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) { if (isset($config['openvpn']["openvpn-{$mode}"])) {
$oic = array("enable" => true); foreach ($config['openvpn']["openvpn-{$mode}"] as &$settings) {
$oic['if'] = "openvpn"; if (!isset($settings['disable'])) {
$oic['descr'] = 'OpenVPN'; $oic = array('enable' => true);
$oic['type'] = "none"; $oic['if'] = 'openvpn';
$oic['virtual'] = true; $oic['descr'] = 'OpenVPN';
$oic['networks'] = array(); $oic['type'] = 'none';
$interfaces['openvpn'] = $oic; $oic['virtual'] = true;
$oic['networks'] = array();
$interfaces['openvpn'] = $oic;
break 2;
}
}
}
} }
return $interfaces; return $interfaces;
......
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