Exemplo n.º 1
0
    }
    for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        if ($config['interfaces']['opt' . $i]['if'] === $ifn) {
            return true;
        }
    }
    return false;
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    if (FALSE === ($cnid = array_search_ex($_GET['uuid'], $config['vinterfaces']['bridge'], "uuid"))) {
        header("Location: interfaces_bridge.php");
        exit;
    }
    $bridge = $a_bridge[$cnid];
    // Check if still in use.
    if (bridge_inuse($bridge['if'])) {
        $input_errors[] = gettext("This Bridge cannot be deleted because it is still being used as an interface.");
    } else {
        mwexec("/usr/local/sbin/rconf attribute remove 'ifconfig_{$bridge['if']}'");
        unset($a_bridge[$cnid]);
        write_config();
        touch($d_sysrebootreqd_path);
        header("Location: interfaces_bridge.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td class="tabnavtbl">
Exemplo n.º 2
0
    $iflist = get_configured_interface_list(false, true);
    foreach ($iflist as $if) {
        if ($config['interfaces'][$if]['if'] == $a_bridges[$num]['bridgeif']) {
            return true;
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    if (!isset($_GET['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_bridges[$_GET['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
        } else {
            if (bridge_inuse($_GET['id'])) {
                $input_errors[] = gettext("This bridge cannot be deleted because it is assigned as an interface.");
            } else {
                if (!does_interface_exist($a_bridges[$_GET['id']]['bridgeif'])) {
                    log_error("Bridge interface does not exist, skipping ifconfig destroy.");
                } else {
                    mwexec("/sbin/ifconfig " . $a_bridges[$_GET['id']]['bridgeif'] . " destroy");
                }
                unset($a_bridges[$_GET['id']]);
                write_config();
                header("Location: interfaces_bridge.php");
                exit;
            }
        }
    }
}
Exemplo n.º 3
0
function bridge_inuse($bridge_if)
{
    global $config;
    foreach ($config['interfaces'] as $if => $intf) {
        if ($intf['if'] == $bridge_if) {
            return true;
        }
    }
    return false;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($a_bridges[$_POST['id']])) {
        $id = $_POST['id'];
    }
    if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) {
        if (bridge_inuse($a_bridges[$id]['bridgeif'])) {
            $input_errors[] = gettext("This bridge cannot be deleted because it is assigned as an interface.");
        } else {
            if (!does_interface_exist($a_bridges[$id]['bridgeif'])) {
                log_error("Bridge interface does not exist, skipping ifconfig destroy.");
            } else {
                mwexec("/sbin/ifconfig " . escapeshellarg($a_bridges[$id]['bridgeif']) . " destroy");
            }
            unset($a_bridges[$id]);
            write_config();
            header("Location: interfaces_bridge.php");
            exit;
        }
    }
}
include "head.inc";