cleanup, move link_interface_to_vlans to interfaces_assign.php and remove unused code

This commit is contained in:
Ad Schellevis 2017-07-14 22:10:48 +02:00
parent 5525a08adb
commit 46c460bb3f
2 changed files with 15 additions and 26 deletions

View File

@ -4040,31 +4040,6 @@ function link_interface_to_track6($int, $action = '')
}
}
function link_interface_to_vlans($int, $action = '')
{
global $config;
if (empty($int)) {
return;
}
if (isset($config['vlans']['vlan'])) {
$ifaces = array();
foreach ($config['vlans']['vlan'] as $vlan) {
if ($int == $vlan['if']) {
if ($action == "update") {
interfaces_bring_up($int);
} elseif ($action == "") {
$ifaces[$vlan['tag']] = $vlan;
}
}
}
if (!empty($ifaces)) {
return $ifaces;
}
}
}
function link_interface_to_vips($int, $action = '')
{
global $config;

View File

@ -35,6 +35,20 @@ require_once("system.inc");
require_once("interfaces.inc");
require_once("services.inc");
function link_interface_to_vlans($int)
{
global $config;
if (isset($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $vlan) {
if ($int == $vlan['if']) {
interfaces_bring_up($int);
}
}
}
}
function list_interfaces() {
global $config;
$interfaces = array();
@ -202,7 +216,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if(!empty($config['interfaces']['lan']) && !empty($config['dhcpd']['wan']) && !empty($config['dhcpd']['wan']) ) {
unset($config['dhcpd']['wan']);
}
link_interface_to_vlans($realid, "update");
link_interface_to_vlans($realid);
header(url_safe('Location: /interfaces_assign.php'));
exit;
}