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()
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;
......
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