From 063ae7af68dc545c46316f34833dca7d26875d9d Mon Sep 17 00:00:00 2001 From: Suraj P Kizhakkethil Date: Thu, 24 Jul 2025 11:15:10 +0530 Subject: [PATCH] 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 --- src/ap/acs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.47.3