From: Suraj P Kizhakkethil Date: Thu, 24 Jul 2025 05:45:10 +0000 (+0530) Subject: ACS: Fix incorrect index calculation for primary channel X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=063ae7af68dc545c46316f34833dca7d26875d9d;p=thirdparty%2Fhostap.git ACS: Fix incorrect index calculation for primary channel 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 --- diff --git a/src/ap/acs.c b/src/ap/acs.c index 5dd57225c..2a43da48f 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -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; }