]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ACS: Fix incorrect index calculation for primary channel
authorSuraj P Kizhakkethil <suraj.kizhakkethil@oss.qualcomm.com>
Thu, 24 Jul 2025 05:45:10 +0000 (11:15 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 12 Aug 2025 20:20:54 +0000 (23:20 +0300)
Currently, in the calculation of the index of the primary channel,
the best frequency, which is the primary channel frequency, is
always greater than the frequency of the first channel in
the bandwidth. As a result, the computed value of the index of
the primary channel would be negative, which is incorrect.

Fix bug in the calculation of the index of the primary channel.

Fixes: 627b67f29b1e ("ACS: Fix primary channel puncturing in ACS")
Signed-off-by: Suraj P Kizhakkethil <suraj.kizhakkethil@oss.qualcomm.com>
src/ap/acs.c

index 5dd57225cb97e6f2aaeeeac2b8c5f96c114ff82f..2a43da48ff0ffb829119edb1e5cfbc17753e23a3 100644 (file)
@@ -979,7 +979,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
                                   chan->interference_factor,
                                   best->interference_factor);
 #ifdef CONFIG_IEEE80211BE
-                       index_primary = (chan->freq - best->freq) / 20;
+                       index_primary = (best->freq - chan->freq) / 20;
 #endif /* CONFIG_IEEE80211BE */
                        chan = best;
                }