From 46c460bb3f7d7bb2d69daf1e692b7e37c6d57167 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 14 Jul 2017 22:10:48 +0200 Subject: [PATCH] cleanup, move link_interface_to_vlans to interfaces_assign.php and remove unused code --- src/etc/inc/interfaces.inc | 25 ------------------------- src/www/interfaces_assign.php | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index a9b8987e4..e2f847b65 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -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; diff --git a/src/www/interfaces_assign.php b/src/www/interfaces_assign.php index e1c12f7e0..04c9277f0 100644 --- a/src/www/interfaces_assign.php +++ b/src/www/interfaces_assign.php @@ -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; }