} } while ($clone_exists); } if (isset($id) && $a_clones[$id]) { if (clone_inuse($id)) { if ($clone['if'] != $a_clones[$id]['if']) { $input_errors[] = gettext("This wireless clone cannot be modified because it is still assigned as an interface."); } else { if ($clone['mode'] != $a_clones[$id]['mode']) { $input_errors[] = gettext("Use the configuration page for the assigned interface to change the mode."); } } } } if (!$input_errors) { if (!interface_wireless_clone($clone['cloneif'], $clone)) { $input_errors[] = sprintf(gettext('Error creating interface with mode %1$s. The %2$s interface may not support creating more clones with the selected mode.'), $wlan_modes[$clone['mode']], $clone['if']); } else { if (isset($id) && $a_clones[$id]) { if ($clone['if'] != $a_clones[$id]['if']) { mwexec("/sbin/ifconfig " . $a_clones[$id]['cloneif'] . " destroy"); } $input_errors[] = sprintf(gettext("Created with id %s"), $id); $a_clones[$id] = $clone; } else { $input_errors[] = gettext("Created without id"); $a_clones[] = $clone; } usort($a_clones, "clone_compare"); write_config(); header("Location: interfaces_wireless.php");
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; } }
$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']; if (!interface_wireless_clone("{$wlanif}_", $a_interfaces[$if])) { $input_errors[] = sprintf(gettext("Unable to change mode to %s. You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$a_interfaces[$if]['wireless']['mode']]); } else { mwexec("/sbin/ifconfig " . escapeshellarg($wlanif) . "_ destroy"); } } } /* loop through keys and enforce size */ for ($i = 1; $i <= 4; $i++) { if ($pconfig['key' . $i]) { if (strlen($pconfig['key' . $i]) == 5) { /* 64 bit */ continue; } elseif (strlen($pconfig['key' . $i]) == 10) { /* hex key */ if (stristr($pconfig['key' . $i], "0x") == false) {