예제 #1
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;
    }
}
예제 #2
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'];