diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-03-02 22:35:36 -0700 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-03-02 22:35:36 -0700 |
commit | 597330aa2149f57d456f38704aea417a86af543c (patch) | |
tree | 995e85753e0add6ddf885176f96f8b36629677cc /usr | |
parent | 6ba138b0f5c96948eacdc824520ded39552b3f57 (diff) | |
download | pfsense-597330aa2149f57d456f38704aea417a86af543c.zip pfsense-597330aa2149f57d456f38704aea417a86af543c.tar.gz |
When more than a single wireless clone exists, verify that it is possible to change the mode.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/interfaces.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 7249d73..34919a0 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -415,6 +415,7 @@ if ($_POST) { $reqdfields = explode(" ", "mode ssid"); $reqdfieldsn = explode(",", "Mode,SSID"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + check_wireless_mode(); /* loop through keys and enforce size */ for ($i = 1; $i <= 4; $i++) { if ($_POST['key' . $i]) { @@ -780,6 +781,34 @@ function handle_wireless_post() { interface_sync_wireless_clones($wancfg, true); } +function check_wireless_mode() { + global $_POST, $config, $g, $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 (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[] = "Unable to change mode to {$wancfg['wireless']['mode']}. You may already have the maximum number of wireless clones supported in this mode."; + } else { + mwexec("/sbin/ifconfig {$wlanif}_ destroy"); + } + $wancfg['wireless']['mode'] = $old_wireless_mode; + } +} + $pgtitle = array("Interfaces", $pconfig['descr']); $closehead = false; include("head.inc"); |