Define HOSTAPD_5GHZ_CHANNEL_MIN, set VHT center frequency segment value

This commit is contained in:
billz 2023-11-06 07:28:50 +00:00
parent 40dc86cc21
commit 1ee31d9221
3 changed files with 18 additions and 1 deletions

View file

@ -31,6 +31,9 @@ define('RASPI_LIGHTTPD_CONFIG', '/etc/lighttpd/lighttpd.conf');
define('RASPI_ACCESS_CHECK_IP', '1.1.1.1');
define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one');
// Constant for the 5GHz wireless regulatory domain
define("HOSTAPD_5GHZ_CHANNEL_MIN", 100);
// Enable basic authentication for the web admin.
define('RASPI_AUTH_ENABLED', true);

View file

@ -36,6 +36,12 @@ $defaults = [
'RASPI_ACCESS_CHECK_IP' => '1.1.1.1',
'RASPI_ACCESS_CHECK_DNS' => 'one.one.one.one',
// Constant for the 5GHz wireless regulatory domain
'HOSTAPD_5GHZ_CHANNEL_MIN' => 100,
// Enable basic authentication for the web admin.
'RASPI_AUTH_ENABLED' => true,
// Optional services, set to true to enable.
'RASPI_WIFICLIENT_ENABLED' => true,
'RASPI_HOTSPOT_ENABLED' => true,

View file

@ -443,6 +443,14 @@ function updateHostapdConfig($ignore_broadcast_ssid,$wifiAPEnable,$bridgedEnable
}
$config.= 'ssid='.$_POST['ssid'].PHP_EOL;
$config.= 'channel='.$_POST['channel'].PHP_EOL;
// Set VHT center frequency segment value
if ((int)$_POST['channel'] < HOSTAPD_5GHZ_CHANNEL_MIN) {
$vht_freq_idx = 42;
} else {
$vht_freq_idx = 155;
}
if ($_POST['hw_mode'] === 'n') {
$config.= 'hw_mode=g'.PHP_EOL;
$config.= 'ieee80211n=1'.PHP_EOL;
@ -461,7 +469,7 @@ function updateHostapdConfig($ignore_broadcast_ssid,$wifiAPEnable,$bridgedEnable
$config.= 'ieee80211h=0'.PHP_EOL;
$config.= 'vht_capab=[MAX-AMSDU-3839][SHORT-GI-80]'.PHP_EOL;
$config.= 'vht_oper_chwidth=1'.PHP_EOL;
$config.= 'vht_oper_centr_freq_seg0_idx=42'.PHP_EOL.PHP_EOL;
$config.= 'vht_oper_centr_freq_seg0_idx='.$vht_freq_idx.PHP_EOL.PHP_EOL;
} elseif ($_POST['hw_mode'] === 'w') {
$config.= 'ieee80211w=2'.PHP_EOL;
$config.= 'wpa_key_mgmt=WPA-EAP-SHA256'.PHP_EOL;