AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
*/
$omit_nocacheheaders = true;
require_once 'guiconfig.inc';
require_once 'interfaces.inc';
require_once 'pfsense-utils.inc';
//get interface IP and break up into an array
$real_interface = get_real_interface($_GET['if']);
if (!does_interface_exist($real_interface)) {
    echo gettext("Wrong Interface");
    exit;
} elseif (!empty($_GET['act']) && $_GET['act'] == "top") {
    //
    // find top bandwitdh users
    // (parts copied from bandwidth_by_ip.php)
    //
    //get interface subnet
    $netmask = find_interface_subnet($real_interface);
    $intsubnet = gen_subnet(find_interface_ip($real_interface), $netmask) . "/{$netmask}";
    $cmd_args = "";
    switch (!empty($_GET['filter']) ? $_GET['filter'] : "") {
        case "local":
            $cmd_args .= " -c " . $intsubnet . " ";
            break;
Beispiel #2
0
{
    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]);
        write_config();
        header("Location: interfaces_qinq.php");
Beispiel #3
0
function check_wireless_mode()
{
    global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
    if ($wancfg['wireless']['mode'] == $_POST['mode']) {
        return;
    }
    if (does_interface_exist(interface_get_wireless_clone($wlanbaseif))) {
        $clone_count = 1;
    } else {
        $clone_count = 0;
    }
    if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
        foreach ($config['wireless']['clone'] as $clone) {
            if ($clone['if'] == $wlanbaseif) {
                $clone_count++;
            }
        }
    }
    if ($clone_count > 1) {
        $old_wireless_mode = $wancfg['wireless']['mode'];
        $wancfg['wireless']['mode'] = $_POST['mode'];
        if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
            $input_errors[] = sprintf(gettext("Unable to change mode to %s.\t You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$wancfg['wireless']['mode']]);
        } else {
            mwexec("/sbin/ifconfig " . escapeshellarg($wlanif) . "_ destroy");
        }
        $wancfg['wireless']['mode'] = $old_wireless_mode;
    }
}
                     continue;
                 }
                 $members = explode(",", strtoupper($bridge['members']));
                 foreach ($members as $member) {
                     if ($member == $ifnames[0]) {
                         $input_errors[] = sprintf(gettext("You cannot set port %s to interface %s because this interface is a member of %s."), $portname, $member, $portname);
                         break;
                     }
                 }
             }
         }
     }
 }
 if (is_array($config['vlans']['vlan'])) {
     foreach ($config['vlans']['vlan'] as $vlan) {
         if (does_interface_exist($vlan['if']) == false) {
             $input_errors[] = "Vlan parent interface {$vlan['if']} does not exist anymore so vlan id {$vlan['tag']} cannot be created please fix the issue before continuing.";
         }
     }
 }
 if (!$input_errors) {
     /* No errors detected, so update the config */
     foreach ($_POST as $ifname => $ifport) {
         if ($ifname == 'lan' || $ifname == 'wan' || substr($ifname, 0, 3) == 'opt') {
             if (!is_array($ifport)) {
                 $reloadif = false;
                 if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] != $ifport) {
                     interface_bring_down($ifname);
                     /* Mark this to be reconfigured in any case. */
                     $reloadif = true;
                 }
Beispiel #5
0
        }
    }
    return false;
}
if ($_POST['act'] == "del") {
    if (!isset($_POST['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_vlans[$_POST['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
            /* check if still in use */
        } else {
            if (vlan_inuse($_POST['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[$_POST['id']]['vlanif'])) {
                    pfSense_interface_destroy($a_vlans[$_POST['id']]['vlanif']);
                }
                unset($a_vlans[$_POST['id']]);
                write_config();
                header("Location: interfaces_vlan.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("VLANs"));
$shortcut_section = "interfaces";
include 'head.inc';
if ($input_errors) {
    print_input_errors($input_errors);
    $pconfig['if'] = $a_vlans[$id]['if'];
    $pconfig['vlanif'] = $a_vlans[$id]['vlanif'];
    $pconfig['tag'] = $a_vlans[$id]['tag'];
    $pconfig['descr'] = $a_vlans[$id]['descr'];
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    $reqdfields = explode(" ", "if tag");
    $reqdfieldsn = array(gettext("Parent interface"), gettext("VLAN tag"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    if ($_POST['tag'] && (!is_numericint($_POST['tag']) || $_POST['tag'] < '1' || $_POST['tag'] > '4094')) {
        $input_errors[] = gettext("The VLAN tag must be an integer between 1 and 4094.");
    }
    if (!does_interface_exist($_POST['if'])) {
        $input_errors[] = gettext("Interface supplied as parent is invalid");
    }
    if (isset($id)) {
        if ($_POST['tag'] && $_POST['tag'] != $a_vlans[$id]['tag']) {
            if (!empty($a_vlans[$id]['vlanif']) && convert_real_interface_to_friendly_interface_name($a_vlans[$id]['vlanif']) != NULL) {
                $input_errors[] = gettext("Interface is assigned and you cannot change the VLAN tag while assigned.");
            }
        }
    }
    foreach ($a_vlans as $vlan) {
        if (isset($id) && $a_vlans[$id] && $a_vlans[$id] === $vlan) {
            continue;
        }
        if ($vlan['if'] == $_POST['if'] && $vlan['tag'] == $_POST['tag']) {
            $input_errors[] = sprintf(gettext("A VLAN with the tag %s is already defined on this interface."), $vlan['tag']);
Beispiel #7
0
            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;
            }
        }
    }
}
include "head.inc";
$main_buttons = array(array('href' => 'interfaces_bridge_edit.php', 'label' => gettext('Add')));
?>
    $pconfig['descr'] = isset($a_vlans[$id]['descr']) ? $a_vlans[$id]['descr'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // validate / save form data
    if (!empty($a_vlans[$_POST['id']])) {
        $id = $_POST['id'];
    }
    $input_errors = array();
    $pconfig = $_POST;
    /* input validation */
    $reqdfields = explode(" ", "if tag");
    $reqdfieldsn = array(gettext("Parent interface"), gettext("VLAN tag"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    if ($pconfig['tag'] && (!is_numericint($pconfig['tag']) || $pconfig['tag'] < '1' || $pconfig['tag'] > '4094')) {
        $input_errors[] = gettext("The VLAN tag must be an integer between 1 and 4094.");
    }
    if (!does_interface_exist($pconfig['if'])) {
        $input_errors[] = gettext("Interface supplied as parent is invalid");
    }
    if (isset($id) && $pconfig['tag'] && $pconfig['tag'] != $a_vlans[$id]['tag']) {
        if (!empty($a_vlans[$id]['vlanif']) && convert_real_interface_to_friendly_interface_name($a_vlans[$id]['vlanif']) != NULL) {
            $input_errors[] = gettext("Interface is assigned and you cannot change the VLAN tag while assigned.");
        }
    }
    foreach ($a_vlans as $vlan) {
        if (isset($id) && $a_vlans[$id] === $vlan) {
            continue;
        }
        if ($vlan['if'] == $pconfig['if'] && $vlan['tag'] == $_POST['tag']) {
            $input_errors[] = sprintf(gettext("A VLAN with the tag %s is already defined on this interface."), $vlan['tag']);
            break;
        }
Beispiel #9
0
 }
 /*
   Wireless interface
 */
 if (isset($a_interfaces[$if]['wireless'])) {
     $reqdfields = array("mode");
     $reqdfieldsn = array(gettext("Mode"));
     if ($pconfig['mode'] == 'hostap') {
         $reqdfields[] = "ssid";
         $reqdfieldsn[] = gettext("SSID");
     }
     do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
     // check_wireless_mode (more wireless weirness)
     // validations shouldn't perform actual actions, needs serious fixing at some point
     if ($a_interfaces[$if]['wireless']['mode'] != $pconfig['mode']) {
         if (does_interface_exist(interface_get_wireless_clone($wlanbaseif))) {
             $clone_count = 1;
         } else {
             $clone_count = 0;
         }
         if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
             foreach ($config['wireless']['clone'] as $clone) {
                 if ($clone['if'] == $wlanbaseif) {
                     $clone_count++;
                 }
             }
         }
         if ($clone_count > 1) {
             $wlanif = get_real_interface($if);
             $old_wireless_mode = $a_interfaces[$if]['wireless']['mode'];
             $a_interfaces[$if]['wireless']['mode'] = $pconfig['mode'];
 $pconfig = $_POST;
 if (is_array($_POST['members'])) {
     $pconfig['members'] = implode(',', $_POST['members']);
 }
 /* input validation */
 $reqdfields = explode(" ", "members proto");
 $reqdfieldsn = array(gettext("Member interfaces"), gettext("Lagg protocol"));
 do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
 if (is_array($_POST['members'])) {
     foreach ($_POST['members'] as $member) {
         if (!does_interface_exist($member)) {
             $input_errors[] = sprintf(gettext("Interface supplied as member (%s) is invalid"), $member);
         }
     }
 } else {
     if (!does_interface_exist($_POST['members'])) {
         $input_errors[] = gettext("Interface supplied as member is invalid");
     }
 }
 if (!in_array($_POST['proto'], $laggprotos)) {
     $input_errors[] = gettext("Protocol supplied is invalid");
 }
 if (!$input_errors) {
     $lagg = array();
     $lagg['members'] = implode(',', $_POST['members']);
     $lagg['descr'] = $_POST['descr'];
     $lagg['laggif'] = $_POST['laggif'];
     $lagg['proto'] = $_POST['proto'];
     if (isset($id) && $a_laggs[$id]) {
         $lagg['laggif'] = $a_laggs[$id]['laggif'];
     }
             if ($bridge['bridgeif'] != $portname) {
                 continue;
             }
             $members = explode(",", strtoupper($bridge['members']));
             foreach ($members as $member) {
                 if ($member == $ifnames[0]) {
                     $input_errors[] = sprintf(gettext("You cannot set port %s to interface %s because this interface is a member of %s."), $portname, $member, $portname);
                     break;
                 }
             }
         }
     }
 }
 if (isset($config['vlans']['vlan'])) {
     foreach ($config['vlans']['vlan'] as $vlan) {
         if (!does_interface_exist($vlan['if'])) {
             $input_errors[] = sprintf(gettext("VLAN parent interface %s does not exist."), $vlan['if']);
         }
     }
 }
 if (count($input_errors) == 0) {
     /* No errors detected, so update the config */
     $changes = 0;
     foreach ($_POST as $ifname => $ifport) {
         if (!is_array($ifport) && ($ifname == 'lan' || $ifname == 'wan' || substr($ifname, 0, 3) == 'opt')) {
             $reloadif = false;
             if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] != $ifport) {
                 interface_bring_down($ifname);
                 /* Mark this to be reconfigured in any case. */
                 $reloadif = true;
             }
 /* file upload? */
 if (is_uploaded_file($_FILES['htmlfile']['tmp_name'])) {
     $newcp['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
 }
 if (is_uploaded_file($_FILES['errfile']['tmp_name'])) {
     $newcp['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
 }
 if (is_uploaded_file($_FILES['logoutfile']['tmp_name'])) {
     $newcp['page']['logouttext'] = base64_encode(file_get_contents($_FILES['logoutfile']['tmp_name']));
 }
 write_config();
 if (!empty($oldifaces) && $oldifaces != $newcp['interface']) {
     $ocpinterfaces = explode(",", $oldifaces);
     foreach ($ocpinterfaces as $cpifgrp) {
         $listrealif = get_real_interface($cpifgrp);
         if (does_interface_exist($listrealif)) {
             pfSense_interface_flags($listrealif, -IFF_IPFW_FILTER);
             $carpif = link_ip_to_carp_interface(find_interface_ip($listrealif));
             if (!empty($carpif)) {
                 $carpsif = explode(" ", $carpif);
                 foreach ($carpsif as $cpcarp) {
                     pfSense_interface_flags($cpcarp, -IFF_IPFW_FILTER);
                 }
             }
         }
     }
 }
 captiveportal_configure_zone($newcp);
 filter_configure();
 header("Location: services_captiveportal_zones.php");
 exit;
Beispiel #13
0
    return false;
}
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>
    $pconfig['members'] = isset($a_laggs[$id]['members']) ? explode(",", $a_laggs[$id]['members']) : array();
    $pconfig['proto'] = isset($a_laggs[$id]['proto']) ? $a_laggs[$id]['proto'] : null;
    $pconfig['descr'] = isset($a_laggs[$id]['descr']) ? $a_laggs[$id]['descr'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // validate and save form data
    if (!empty($a_laggs[$_POST['id']])) {
        $id = $_POST['id'];
    }
    $input_errors = array();
    $pconfig = $_POST;
    /* input validation */
    $reqdfields = explode(" ", "members proto");
    $reqdfieldsn = array(gettext("Member interfaces"), gettext("Lagg protocol"));
    do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
    foreach ($pconfig['members'] as $member) {
        if (!does_interface_exist($member)) {
            $input_errors[] = gettext("Interface supplied as member is invalid");
        }
    }
    if (!in_array($pconfig['proto'], $laggprotos)) {
        $input_errors[] = gettext("Protocol supplied is invalid");
    }
    if (count($input_errors) == 0) {
        $lagg = array();
        $lagg['members'] = implode(',', $pconfig['members']);
        $lagg['descr'] = $pconfig['descr'];
        $lagg['laggif'] = $pconfig['laggif'];
        $lagg['proto'] = $pconfig['proto'];
        if (isset($id)) {
            $lagg['laggif'] = $a_laggs[$id]['laggif'];
        }
Beispiel #15
0
function restore_config_section_xmlrpc($raw_params)
{
    global $config, $xmlrpc_g;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        xmlrpc_authfail();
        return $xmlrpc_g['return']['authfail'];
    }
    // Some sections should just be copied and not merged or we end
    //   up unable to sync the deletion of the last item in a section
    $sync_full = array('ipsec', 'aliases', 'wol', 'load_balancer', 'openvpn', 'cert', 'ca', 'crl', 'schedules');
    $sync_full_done = array();
    foreach ($sync_full as $syncfull) {
        if (isset($params[0][$syncfull])) {
            $config[$syncfull] = $params[0][$syncfull];
            unset($params[0][$syncfull]);
            $sync_full_done[] = $syncfull;
        }
    }
    $vipbackup = array();
    $oldvips = array();
    if (isset($params[0]['virtualip'])) {
        if (is_array($config['virtualip']['vip'])) {
            foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
                if ($vip['mode'] == "carp") {
                    $oldvips["{$vip['interface']}_vip{$vip['vhid']}"] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
                } else {
                    if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip")) {
                        $oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
                    } else {
                        if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !strstr($vip['interface'], "_vip")) {
                            $vipbackup[] = $vip;
                        }
                    }
                }
            }
        }
    }
    // For vip section, first keep items sent from the master
    $config = array_merge_recursive_unique($config, $params[0]);
    /* Then add ipalias and proxyarp types already defined on the backup */
    if (is_array($vipbackup) && !empty($vipbackup)) {
        if (!is_array($config['virtualip'])) {
            $config['virtualip'] = array();
        }
        if (!is_array($config['virtualip']['vip'])) {
            $config['virtualip']['vip'] = array();
        }
        foreach ($vipbackup as $vip) {
            array_unshift($config['virtualip']['vip'], $vip);
        }
    }
    /* Log what happened */
    $mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done));
    write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys));
    /* 
     * The real work on handling the vips specially
     * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
     */
    if (isset($params[0]['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
        $carp_setuped = false;
        $anyproxyarp = false;
        foreach ($config['virtualip']['vip'] as $vip) {
            if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) {
                if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
                    if (does_vip_exist($vip)) {
                        unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
                        continue;
                        // Skip reconfiguring this vips since nothing has changed.
                    }
                }
                unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]);
            } else {
                if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) {
                    if ($oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
                        if (does_vip_exist($vip)) {
                            unset($oldvips[$vip['subnet']]);
                            continue;
                            // Skip reconfiguring this vips since nothing has changed.
                        }
                    }
                    unset($oldvips[$vip['subnet']]);
                }
            }
            switch ($vip['mode']) {
                case "proxyarp":
                    $anyproxyarp = true;
                    break;
                case "ipalias":
                    interface_ipalias_configure(&$vip);
                    break;
                case "carp":
                    if ($carp_setuped == false) {
                        $carp_setuped = true;
                    }
                    interface_carp_configure($vip);
                    break;
                case "carpdev-dhcp":
                    interface_carpdev_configure($vip);
                    break;
            }
        }
        /* Cleanup remaining old carps */
        foreach ($oldvips as $oldvipif => $oldvippar) {
            if (!is_ipaddr($oldvipif) && does_interface_exist($oldvipif)) {
                pfSense_interface_destroy($oldvipif);
            }
        }
        if ($carp_setuped == true) {
            interfaces_carp_setup();
        }
        if ($anyproxyarp == true) {
            interface_proxyarp_configure();
        }
    }
    return $xmlrpc_g['return']['true'];
}
    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";
legacy_html_escape_form_data($a_bridges);
$main_buttons = array(array('href' => 'interfaces_bridge_edit.php', 'label' => gettext('Add')));
?>