1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Merge pull request #668 from billz/hostapd-opts

Add beacon_int & disassoc_low_ack options to hostapd
This commit is contained in:
Bill Zimmerman 2020-09-12 18:34:45 +02:00 committed by GitHub
commit 199f83777b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 4 deletions

View File

@ -77,7 +77,14 @@ function DisplayHostAPDConfig()
$arrConfig[$arrLine[0]]=$arrLine[1]; $arrConfig[$arrLine[0]]=$arrLine[1];
} }
}; };
// assign beacon_int boolean if value is set
if (isset($arrConfig['beacon_int'])) {
$arrConfig['beacon_interval_bool'] = 1;
}
// assign disassoc_low_ack boolean if value is set
if (isset($arrConfig['disassoc_low_ack'])) {
$arrConfig['disassoc_low_ack_bool'] = 1;
}
// assign country_code from iw reg if not set in config // assign country_code from iw reg if not set in config
if (!isset($arrConfig['country_code']) && isset($country_code[0])) { if (!isset($arrConfig['country_code']) && isset($country_code[0])) {
$arrConfig['country_code'] = $country_code[0]; $arrConfig['country_code'] = $country_code[0];
@ -213,12 +220,19 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$status->addMessage('Unknown interface '.htmlspecialchars($_POST['interface'], ENT_QUOTES), 'danger'); $status->addMessage('Unknown interface '.htmlspecialchars($_POST['interface'], ENT_QUOTES), 'danger');
$good_input = false; $good_input = false;
} }
if (strlen($_POST['country_code']) !== 0 && strlen($_POST['country_code']) != 2) { if (strlen($_POST['country_code']) !== 0 && strlen($_POST['country_code']) != 2) {
$status->addMessage('Country code must be blank or two characters', 'danger'); $status->addMessage('Country code must be blank or two characters', 'danger');
$good_input = false; $good_input = false;
} }
if (isset($_POST['beaconintervalEnable'])) {
if (!is_numeric($_POST['beacon_interval'])) {
$status->addMessage('Beacon interval must be a numeric value', 'danger');
$good_input = false;
} elseif ($_POST['beacon_interval'] < 15 || $_POST['beacon_interval'] > 65535) {
$status->addMessage('Beacon interval must be between 15 and 65535', 'danger');
$good_input = false;
}
}
$_POST['max_num_sta'] = (int) $_POST['max_num_sta']; $_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'] > 2007 ? 2007 : $_POST['max_num_sta'];
$_POST['max_num_sta'] = $_POST['max_num_sta'] < 1 ? null : $_POST['max_num_sta']; $_POST['max_num_sta'] = $_POST['max_num_sta'] < 1 ? null : $_POST['max_num_sta'];
@ -231,7 +245,12 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config.= 'ctrl_interface_group=0'.PHP_EOL; $config.= 'ctrl_interface_group=0'.PHP_EOL;
$config.= 'auth_algs=1'.PHP_EOL; $config.= 'auth_algs=1'.PHP_EOL;
$config.= 'wpa_key_mgmt=WPA-PSK'.PHP_EOL; $config.= 'wpa_key_mgmt=WPA-PSK'.PHP_EOL;
$config.= 'beacon_int=100'.PHP_EOL; if (isset($_POST['beaconintervalEnable'])) {
$config.= 'beacon_int='.$_POST['beacon_interval'].PHP_EOL;
}
if (isset($_POST['disassoc_low_ackEnable'])) {
$config.= 'disassoc_low_ack=0'.PHP_EOL;
}
$config.= 'ssid='.$_POST['ssid'].PHP_EOL; $config.= 'ssid='.$_POST['ssid'].PHP_EOL;
$config.= 'channel='.$_POST['channel'].PHP_EOL; $config.= 'channel='.$_POST['channel'].PHP_EOL;
if ($_POST['hw_mode'] === 'n') { if ($_POST['hw_mode'] === 'n') {

Binary file not shown.

View File

@ -447,6 +447,15 @@ msgstr "Maximum number of clients"
msgid "Configures the max_num_sta option of hostapd. The default and maximum is 2007. If empty or 0, the default applies." msgid "Configures the max_num_sta option of hostapd. The default and maximum is 2007. If empty or 0, the default applies."
msgstr "Configures the max_num_sta option of hostapd. The default and maximum is 2007. If empty or 0, the default applies." msgstr "Configures the max_num_sta option of hostapd. The default and maximum is 2007. If empty or 0, the default applies."
msgid "Beacon interval"
msgstr "Beacon interval"
msgid "Disable <code>disassoc_low_ack</code>"
msgstr "Disable <code>disassoc_low_ack</code>"
msgid "Do not disassociate stations based on excessive transmission failures."
msgstr "Do not disassociate stations based on excessive transmission failures."
#: includes/networking.php #: includes/networking.php
msgid "Summary" msgid "Summary"
msgstr "Summary" msgstr "Summary"

View File

@ -37,6 +37,30 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-xs-3 col-sm-3">
<div class="custom-control custom-switch">
<?php $checked = $arrConfig['beacon_interval_bool'] == 1 ? 'checked="checked"' : '' ?>
<input class="custom-control-input" id="chxbeaconinterval" name="beaconintervalEnable" type="checkbox" value="1" <?php echo $checked ?> />
<label class="custom-control-label" for="chxbeaconinterval"><?php echo _("Beacon interval"); ?></label>
</div>
</div>
<div class="col-xs-3 col-sm-3">
<input type="text" class="form-control" name="beacon_interval" value="<?php echo $arrConfig['beacon_int'] ?>">
</div>
</div>
<div class="row">
<div class="col-md-6 mb-2">
<div class="custom-control custom-switch">
<?php $checked = $arrConfig['disassoc_low_ack_bool'] == 1 ? 'checked="checked"' : '' ?>
<input class="custom-control-input" id="chxdisassoclowack" name="disassoc_low_ackEnable" type="checkbox" value="1" <?php echo $checked ?> />
<label class="custom-control-label" for="chxdisassoclowack"><?php echo _("Disable <code>disassoc_low_ack</code>"); ?></label>
</div>
<p id="disassoc_low_ack_help" class="mb-1 mt-0">
<small id="disassoc_low_ack_help" class="text-muted"><?php echo _("Do not disassociate stations based on excessive transmission failures.") ?></small></label>
</p>
</div>
</div>
<div class="row"> <div class="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="max_num_sta"><?php echo _("Maximum number of clients") ?></label> <label for="max_num_sta"><?php echo _("Maximum number of clients") ?></label>