} } return false; } if ($_GET['act'] == "del") { if (!isset($_GET['id'])) { $input_errors[] = getext("Wrong parameters supplied"); } else { if (empty($a_vlans[$_GET['id']])) { $input_errors[] = getext("Wrong index supplied"); } else { if (vlan_inuse($_GET['id'])) { $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface."); } else { if (does_interface_exist($a_vlans[$_GET['id']]['vlanif'])) { legacy_interface_destroy($a_vlans[$_GET['id']]['vlanif']); } unset($a_vlans[$_GET['id']]); write_config(); header("Location: interfaces_vlan.php"); exit; } } } } $pgtitle = array(gettext("Interfaces"), gettext("VLAN")); $shortcut_section = "interfaces"; include "head.inc"; $main_buttons = array(array('href' => 'interfaces_vlan_edit.php', 'label' => 'Add')); ?>
if (isset($config['qinqs']['qinqentry'])) { foreach ($config['qinqs']['qinqentry'] as $qinq) { if ($qinq['tag'] == $pconfig['tag'] && $qinq['if'] == $pconfig['if']) { $input_errors[] = gettext("A QinQ VLAN exists with this tag please remove it to use this tag with."); } } } if (count($input_errors) == 0) { $confif = ""; if (isset($id)) { if ($a_vlans[$id]['if'] != $pconfig['if'] || $a_vlans[$id]['tag'] != $pconfig['tag']) { if (!empty($a_vlans[$id]['vlanif'])) { $confif = convert_real_interface_to_friendly_interface_name($a_vlans[$id]['vlanif']); legacy_interface_destroy($a_vlans[$id]['vlanif']); } else { legacy_interface_destroy("{$a_vlans[$id]['if']}_vlan{$a_vlans[$id]['tag']}"); $confif = convert_real_interface_to_friendly_interface_name("{$a_vlans[$id]['if']}_vlan{$a_vlans[$id]['tag']}"); } if ($confif != "") { $config['interfaces'][$confif]['if'] = "{$_POST['if']}_vlan{$_POST['tag']}"; } } } $vlan = array(); $vlan['if'] = $_POST['if']; $vlan['tag'] = $_POST['tag']; $vlan['descr'] = $_POST['descr']; $vlan['vlanif'] = "{$_POST['if']}_vlan{$_POST['tag']}"; $vlan['vlanif'] = interface_vlan_configure($vlan); if ($vlan['vlanif'] == "" || !stristr($vlan['vlanif'], "vlan")) { $input_errors[] = gettext("Error occurred creating interface, please retry.");
} if (!isset($config['vlans']['vlan']) || !is_array($config['vlans']['vlan'])) { $a_vlans = array(); } else { $a_vlans =& $config['vlans']['vlan']; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($a_vlans[$_POST['id']])) { $id = $_POST['id']; } if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) { if (vlan_inuse($a_vlans[$id])) { $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface."); } else { if (does_interface_exist($a_vlans[$id]['vlanif'])) { legacy_interface_destroy($a_vlans[$id]['vlanif']); } unset($a_vlans[$id]); write_config(); header("Location: interfaces_vlan.php"); exit; } } } include "head.inc"; legacy_html_escape_form_data($a_vlans); $main_buttons = array(array('href' => 'interfaces_vlan_edit.php', 'label' => gettext('Add'))); ?> <body> <script type="text/javascript">