6 GHz: Fix secondary channel setting

center_idx_to_bw_6ghz() does not return the bandwidth in MHz and as
such, the check here against 20 (MHz) is never true. The returned value
is greater than 0 for the over 20 MHz cases.

Fixes: 15742566fd ("6 GHz: Fix operating class in Supported Operating Classes element")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-03-29 18:25:37 +03:00 committed by Jouni Malinen
parent 744295c8bc
commit 0059fa5bae

View file

@ -1765,7 +1765,7 @@ static void hostapd_set_6ghz_sec_chan(struct hostapd_iface *iface)
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 (bw > 0 && !iface->conf->secondary_channel) {
if (((iface->conf->channel - 1) / 4) % 2)
iface->conf->secondary_channel = -1;
else