Commit 6e7f8e50 authored by Ad Schellevis's avatar Ad Schellevis

(plugins, interfaces) move legacy vpn interfaces to plugins

parent d082febd
This diff is collapsed.
......@@ -4104,7 +4104,7 @@ function convert_real_interface_to_friendly_interface_name($interface = 'wan')
return null;
}
foreach ($config['interfaces'] as $if => $ifname) {
foreach (legacy_config_get_interfaces() as $if => $ifname) {
if ($if == $interface || $ifname['if'] == $interface) {
return $if;
}
......@@ -4295,25 +4295,14 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface =
$wanif = null;
switch ($interface) {
case "l2tp":
$wanif = "l2tp";
break;
case "pptp":
$wanif = "pptp";
break;
case "pppoe":
$wanif = "pppoe";
break;
case "openvpn":
$wanif = "openvpn";
case "ppp":
$wanif = $interface;
break;
case "ipsec":
case "enc0":
$wanif = "enc0";
break;
case "ppp":
$wanif = "ppp";
break;
default:
// If a real interface was alread passed simply
// pass the real interface back. This encourages
......@@ -4482,7 +4471,7 @@ function link_interface_to_track6($int, $action = '')
if (isset($config['interfaces'])) {
$list = array();
foreach ($config['interfaces'] as $ifname => $ifcfg) {
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifname => $ifcfg) {
if (!isset($ifcfg['enable'])) {
continue;
}
......
......@@ -657,3 +657,71 @@ EOD;
return 0;
}
function vpn_interface()
{
global $config;
$interfaces = array();
if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == 'server') {
$oic = array("enable" => true);
$oic['if'] = 'pptp';
$oic['descr'] = 'pptp';
$oic['ip'] = $config['pptpd']['localip'];
$oic['sa'] = $config['pptpd']['remoteip'];
if (!empty($config['pptpd']['pptp_subnet'])) {
$oic['sn'] = $config['pptpd']['pptp_subnet'];
} else {
$oic['sn'] = "32";
}
$oic['mode'] = $config['pptpd']['mode'];
$oic['virtual'] = true;
$interfaces['pptp'] = $oic;
}
if (isset($config['l2tp']['mode']) && $config['l2tp']['mode'] == 'server') {
$oic = array("enable" => true);
$oic['if'] = 'l2tp';
$oic['descr'] = 'L2TP';
$oic['ip'] = $config['l2tp']['localip'];
$oic['sa'] = $config['l2tp']['remoteip'];
if (!empty($config['l2tp']['l2tp_subnet'])) {
$oic['sn'] = $config['l2tp']['l2tp_subnet'];
} else {
$oic['sn'] = "32";
}
$oic['mode'] = $config['l2tp']['mode'];
$oic['virtual'] = true;
$interfaces['l2tp'] = $oic;
}
if (isset($config['pppoes']['pppoe'])) {
$pppoeifs = array('networks' => array());
foreach($config['pppoes']['pppoe'] as $pppoe) {
if ($pppoe['mode'] == "server") {
$oic = array();
$oic['sa'] = $pppoe['remoteip'];
if ($pppoe['pppoe_subnet'] <> "") {
$oic['sn'] = $pppoe['pppoe_subnet'];
} else {
$oic['sn'] = "32";
}
$oic['ip'] = $pppoe['localip'];
$pppoeifs['networks'][] = $oic;
}
}
if (count($pppoeifs['networks'])) {
$pppoeifs['enable'] = true;
$pppoeifs['if'] = 'pppoe';
$pppoeifs['descr'] = 'pppoe';
$pppoeifs['ip'] = "";
$pppoeifs['sa'] = "";
$pppoeifs['sn'] = "32";
$pppoeifs['mode'] = "";
$pppoeifs['virtual'] = true;
$interfaces['pppoe'] = $pppoeifs;
}
}
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