mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 15:40:22 +00:00
Merge pull request #362 from glaszig/feature/ap-client-limit
make hostapd's max_num_sta configurable
This commit is contained in:
commit
e2f07044b4
1 changed files with 14 additions and 0 deletions
|
@ -217,6 +217,13 @@ if ($arrConfig['ignore_broadcast_ssid'] == 1 || $arrConfig['ignore_broadcast_ssi
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="max_num_sta"><?php echo _("Maximum number of clients") ?></label>
|
||||
<input type="text" id="max_num_sta" class="form-control" name="max_num_sta" placeholder="2007" value="<?php echo $arrConfig["max_num_sta"] ?>" aria-describedby="max_num_sta_help">
|
||||
<span id="max_num_sta_help" class="help-block"><?php echo _("Configures the <code>max_num_sta</code> option of hostapd. The default and maximum is 2007. If empty or 0, the default applies.") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cbxcountries"><?php echo _("Country Code"); ?></label>
|
||||
|
@ -600,6 +607,10 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||
$good_input = false;
|
||||
}
|
||||
|
||||
$_POST['max_num_sta'] = (int) $_POST['max_num_sta'];
|
||||
$_POST['max_num_sta'] = $_POST['max_num_sta'] > 2007 ? 2007 : $_POST['max_num_sta'];
|
||||
$_POST['max_num_sta'] = $_POST['max_num_sta'] < 1 ? null : $_POST['max_num_sta'];
|
||||
|
||||
if ($good_input) {
|
||||
// Fixed values
|
||||
$config = 'driver=nl80211'.PHP_EOL;
|
||||
|
@ -629,6 +640,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||
$config.= 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL;
|
||||
$config.= 'country_code='.$_POST['country_code'].PHP_EOL;
|
||||
$config.= 'ignore_broadcast_ssid='.$ignore_broadcast_ssid.PHP_EOL;
|
||||
if (isset($_POST['max_num_sta'])) {
|
||||
$config.= 'max_num_sta='.$_POST['max_num_sta'].PHP_EOL;
|
||||
}
|
||||
|
||||
file_put_contents("/tmp/hostapddata", $config);
|
||||
system("sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return);
|
||||
|
|
Loading…
Reference in a new issue