From 1ee31d9221727323d46b1594f64ac5dfa7dc301d Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 6 Nov 2023 07:28:50 +0000 Subject: [PATCH] Define HOSTAPD_5GHZ_CHANNEL_MIN, set VHT center frequency segment value --- config/config.php | 3 +++ includes/defaults.php | 6 ++++++ includes/hostapd.php | 10 +++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index 6a76b13c..74b75da3 100755 --- a/config/config.php +++ b/config/config.php @@ -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); diff --git a/includes/defaults.php b/includes/defaults.php index f8ddad07..ca2bfd04 100755 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -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, diff --git a/includes/hostapd.php b/includes/hostapd.php index b14add20..cda765cb 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -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;