]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
6 GHz: Fix operating class in Supported Operating Classes element
authorPradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Thu, 22 Apr 2021 18:30:09 +0000 (11:30 -0700)
committerJouni Malinen <j@w1.fi>
Mon, 3 May 2021 20:04:55 +0000 (23:04 +0300)
Previously, the secondary channel was set only in presence of HT
capabilities based on HT40+ or HT40-. As HT capabilities and
secondary_channel are not present for the 6 GHz bamd, this causes
incorrect operating class indication in the Supported Operating Classes
element.

Fix this by assigning the secondary channel for bandwidths greater than
20 MHz in the 6 GHz band.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
src/ap/hostapd.c

index e9aae6dcf2f57ea0e0b1403cebb5fc5e65227ef0..913a8e29e16d3232268c700a97449fafa13d75d7 100644 (file)
@@ -1674,6 +1674,26 @@ static int configured_fixed_chan_to_freq(struct hostapd_iface *iface)
 }
 
 
+static void hostapd_set_6ghz_sec_chan(struct hostapd_iface *iface)
+{
+       int bw, seg0;
+
+       if (!is_6ghz_op_class(iface->conf->op_class))
+               return;
+
+       seg0 = hostapd_get_oper_centr_freq_seg0_idx(iface->conf);
+       bw = center_idx_to_bw_6ghz(seg0);
+       /* Assign the secondary channel if absent in config for
+        * bandwidths > 20 MHz */
+       if (bw > 20 && !iface->conf->secondary_channel) {
+               if (((iface->conf->channel - 1) / 4) % 2)
+                       iface->conf->secondary_channel = -1;
+               else
+                       iface->conf->secondary_channel = 1;
+       }
+}
+
+
 static int setup_interface2(struct hostapd_iface *iface)
 {
        iface->wait_channel_update = 0;
@@ -1693,6 +1713,7 @@ static int setup_interface2(struct hostapd_iface *iface)
 
                        ch_width = op_class_to_ch_width(iface->conf->op_class);
                        hostapd_set_oper_chwidth(iface->conf, ch_width);
+                       hostapd_set_6ghz_sec_chan(iface);
                }
 
                ret = hostapd_select_hw_mode(iface);