} } return false; } if (!isset($config['qinqs']['qinqentry']) || !is_array($config['qinqs']['qinqentry'])) { $a_qinqs = array(); } else { $a_qinqs =& $config['qinqs']['qinqentry']; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($a_qinqs[$_POST['id']])) { $id = $_POST['id']; } if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) { /* check if still in use */ if (qinq_inuse($a_qinqs[$id]['qinqif'])) { $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) { $input_errors[] = gettext("QinQ interface does not exist"); } else { $qinq =& $a_qinqs[$id]; $delmembers = explode(" ", $qinq['members']); if (count($delmembers) > 0) { foreach ($delmembers as $tag) { mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:"); } } mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:"); mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:"); mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy"); unset($a_qinqs[$id]);
$a_qinqs =& $config['qinqs']['qinqentry']; function qinq_inuse($num) { global $config, $a_qinqs; $iflist = get_configured_interface_list(false, true); foreach ($iflist as $if) { if ($config['interfaces'][$if]['if'] == $a_qinqs[$num]['qinqif']) { return true; } } return false; } if ($_GET['act'] == "del") { $id = $_GET['id']; /* check if still in use */ if (qinq_inuse($id)) { $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) { $input_errors[] = gettext("QinQ interface does not exist"); } else { $qinq =& $a_qinqs[$id]; $delmembers = explode(" ", $qinq['members']); if (count($delmembers) > 0) { foreach ($delmembers as $tag) { mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:"); } } mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:"); mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:"); mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy"); unset($a_qinqs[$id]);
} $a_qinqs =& $config['qinqs']['qinqentry']; function qinq_inuse($num) { global $config, $a_qinqs; $iflist = get_configured_interface_list(false, true); foreach ($iflist as $if) { if ($config['interfaces'][$if]['if'] == $a_qinqs[$num]['qinqif']) { return true; } } return false; } if ($_GET['act'] == "del") { /* check if still in use */ if (qinq_inuse($_GET['id'])) { $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); } else { $id = $_GET['id']; $qinq =& $a_qinqs[$id]; $delmembers = explode(" ", $qinq['members']); if (count($delmembers) > 0) { foreach ($delmembers as $tag) { mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:"); } } mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:"); mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:"); mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy"); unset($a_qinqs[$id]); write_config();