This is mainly adding any center frequencies when the user manually
choses a channel.

Signed-off-by: Michael Tremer <[email protected]>
---
 config/hostapd/config            |   4 +-
 src/initscripts/packages/hostapd | 129 ++++++++++++++++++++++++++++---
 2 files changed, 120 insertions(+), 13 deletions(-)

diff --git a/config/hostapd/config b/config/hostapd/config
index 8bf19375b..7bda725a7 100644
--- a/config/hostapd/config
+++ b/config/hostapd/config
@@ -375,9 +375,9 @@ CONFIG_MBO=y
 CONFIG_TAXONOMY=y
 
 # Fast Initial Link Setup (FILS) (IEEE 802.11ai)
-#CONFIG_FILS=y
+CONFIG_FILS=y
 # FILS shared key authentication with PFS
-#CONFIG_FILS_SK_PFS=y
+CONFIG_FILS_SK_PFS=y
 
 # Include internal line edit mode in hostapd_cli. This can be used to provide
 # limited command line editing and history support.
diff --git a/src/initscripts/packages/hostapd b/src/initscripts/packages/hostapd
index 0bd90bda2..c8d3ffce1 100644
--- a/src/initscripts/packages/hostapd
+++ b/src/initscripts/packages/hostapd
@@ -125,6 +125,7 @@ write_config() {
        local he_phy_flags=0
        local eht_mac_flags=0
        local eht_phy_flags=0
+       local channel_offset
 
        # Set some default BAND if none is set
        if [ -z "${CONFIG["BAND"]}" ]; then
@@ -332,6 +333,16 @@ write_config() {
                esac
        fi
 
+       # Set channel offset
+       case "${CONFIG["BAND"]}" in
+               6g)
+                       channel_offset=1
+                       ;;
+               *)
+                       channel_offset=0
+                       ;;
+       esac
+
        # Header
        echo "# Automatically generated configuration"
        echo "# DO NOT EDIT"
@@ -391,7 +402,7 @@ write_config() {
 
                        # Compute the channel segment index
                        if [ "${CONFIG["CHANNEL"]}" -gt 0 ]; then
-                               case "$(( (${CONFIG["CHANNEL"]} / 4) % 2 ))" in
+                               case "$(( ((${CONFIG["CHANNEL"]} / 4) + 
channel_offset) % 2 ))" in
                                        0)
                                                
vht_oper_centr_freq_seg0_idx="$(( ${CONFIG["CHANNEL"]} - 2 ))"
                                                ;;
@@ -409,7 +420,7 @@ write_config() {
 
                        # Compute the channel segment index
                        if [ "${CONFIG["CHANNEL"]}" -gt 0 ]; then
-                               case "$(( (${CONFIG["CHANNEL"]} / 4) % 4 ))" in
+                               case "$(( ((${CONFIG["CHANNEL"]} / 4) + 
channel_offset) % 4 ))" in
                                        0)
                                                
vht_oper_centr_freq_seg0_idx="$(( ${CONFIG["CHANNEL"]} - 6 ))"
                                                ;;
@@ -433,15 +444,46 @@ write_config() {
 
                        # Compute the channel segment index
                        if [ "${CONFIG["CHANNEL"]}" -gt 0 ]; then
-                               case "${CONFIG["CHANNEL"]}" in
-                                       36|40|44|48|52|56|60|64)
-                                               vht_oper_centr_freq_seg0_idx=50
-                                               ;;
-                                       100|104|108|112|116|120|124|128)
-                                               vht_oper_centr_freq_seg0_idx=114
+                               case "${CONFIG["BAND"]}" in
+                                       # 6 GHz
+                                       6g)
+                                               case "${CONFIG["CHANNEL"]}" in
+                                                       1|5|9|13|17|21|25|29)
+                                                               
vht_oper_centr_freq_seg0_idx=15
+                                                               ;;
+                                                       33|37|41|45|49|53|57|61)
+                                                               
vht_oper_centr_freq_seg0_idx=47
+                                                               ;;
+                                                       65|69|73|77|81|85|89|93)
+                                                               
vht_oper_centr_freq_seg0_idx=79
+                                                               ;;
+                                                       
97|101|105|109|113|117|121|125)
+                                                               
vht_oper_centr_freq_seg0_idx=111
+                                                               ;;
+                                                       
129|133|137|141|145|149|153|157)
+                                                               
vht_oper_centr_freq_seg0_idx=143
+                                                               ;;
+                                                       
161|165|169|173|177|181|185|189)
+                                                               
vht_oper_centr_freq_seg0_idx=175
+                                                               ;;
+                                                       
193|197|201|205|209|213|217|221)
+                                                               
vht_oper_centr_freq_seg0_idx=207
+                                                               ;;
+                                               esac
                                                ;;
-                                       149|153|157|161|165|169|173|177)
-                                               vht_oper_centr_freq_seg0_idx=163
+                                       # 5 GHz
+                                       5g)
+                                               case "${CONFIG["CHANNEL"]}" in
+                                                       36|40|44|48|52|56|60|64)
+                                                               
vht_oper_centr_freq_seg0_idx=50
+                                                               ;;
+                                                       
100|104|108|112|116|120|124|128)
+                                                               
vht_oper_centr_freq_seg0_idx=114
+                                                               ;;
+                                                       
149|153|157|161|165|169|173|177)
+                                                               
vht_oper_centr_freq_seg0_idx=163
+                                                               ;;
+                                               esac
                                                ;;
                                esac
                        fi
@@ -465,6 +507,31 @@ write_config() {
        local eht_oper_centr_freq_seg0_idx="${he_oper_centr_freq_seg0_idx}"
 
        case "${CONFIG["MODE"]}" in
+               EHT320)
+                       enable_be=1
+                       eht_oper_chwidth=9
+
+                       # Compute the channel segment index
+                       case "${CONFIG["BAND"]}" in
+                               6g)
+                                       case "${CONFIG["CHANNEL"]}" in
+                                               
1|5|9|13|17|21|25|29|33|37|41|45|49|53|57|61)
+                                                       
eht_oper_centr_freq_seg0_idx=31
+                                                       ;;
+                                               
65|69|73|77|81|85|89|93|97|101|105|109|113|117|121|125)
+                                                       
eht_oper_centr_freq_seg0_idx=95
+                                                       ;;
+                                               
129|133|137|141|145|149|153|157|161|165|169|173|177|181|185|189)
+                                                       
eht_oper_centr_freq_seg0_idx=159
+                                                       ;;
+                                               193|197|201|205|209|213|217|221)
+                                                       
eht_oper_centr_freq_seg0_idx=191
+                                                       ;;
+                                       esac
+                                       ;;
+                       esac
+                       ;;
+
                EHT*)
                        enable_be=1
                        ;;
@@ -472,7 +539,7 @@ write_config() {
 
        # Set hardware mode
        case "${CONFIG["BAND"]}" in
-               5g)
+               6g|5g)
                        echo "hw_mode=a"
                        ;;
                2g)
@@ -480,6 +547,46 @@ write_config() {
                        ;;
        esac
 
+       # Adjust settings for 6 GHz
+       case "${CONFIG["BAND"]}" in
+               6g)
+                       # Disable 802.11ac
+                       enable_ac=0
+
+                       # Enable 802.11w management frame protection
+                       CONFIG["IEEE80211W"]="on"
+
+                       # Send FILS Discovery frames every 20 TUs (~20 ms)
+                       # for faster AP detection by the clients
+                       echo "fils_discovery_min_interval=20"
+                       echo "fils_discovery_max_interval=20"
+                       ;;
+       esac
+
+       local op_class=
+
+       # Configure global operating class
+       case "${CONFIG["BAND"]}" in
+               6g)
+                       case "${CONFIG["MODE"]}" in
+                               EHT320)
+                                       op_class=137
+                                       ;;
+                               HE20|EHT20)
+                                       op_class=131
+                                       ;;
+                               HE*|EHT*)
+                                       op_class="$(( 132 + vht_oper_chwidth ))"
+                                       ;;
+                       esac
+                       ;;
+       esac
+
+       # Set global operating class
+       if [ -n "${op_class}" ]; then
+               echo "op_class=${op_class}"
+       fi
+
        # Enable 802.11be?
        if [ "${enable_be}" -eq 1 ]; then
                echo "ieee80211be=1"
-- 
2.47.3


Reply via email to