[PATCH] Fix ACS when using 20MHz channels in 6GHz

Nicolas Escande nico.escande at gmail.com
Tue Mar 25 08:54:59 PDT 2025


On Tue Mar 25, 2025 at 2:25 PM CET, Matej Vrba wrote:
> When configured to use ACS with 20MHz channels, hostapd incorrectly rejects
> half of the available channels with an error messages "Channel XX: not
> allowed as primary channel for 40 MHz bandwidth." This includes all PSC
> channels.
>

Hello,

If I read the code right, it seems that your problem comes from the fact that
in acs_find_ideal_chan_mode() around line 92 

		if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
		    ((iface->conf->ieee80211n &&
		      iface->conf->secondary_channel) ||
		     is_6ghz_freq(chan->freq)) &&
		    !acs_usable_bw_chan(chan, ACS_BW40)) {

we assume that on 6GHz we try at least to do 40MHz wide operation.

Even though the code iterates over each channel, we then wrongly discard all
channels that are not the first ones of a 40MHZ block (so all PSC channels)

So for me there are two good possible fixes:

  - either we change the above mentionned check to actually check the configured
  operational bandwidth with hostapd_get_oper_chwidth() (like in the
  other cases after this one that handles 80/160/320)

  - or we stop using this hostapd_get_oper_chwidth() nonsense and use the 'bw'
  argument (which as been validated before) and just check for that instead in
  all cases

Anyway for me your way of doing things is horrible. We complexify
acs_usable_bw_chan(), add special cases to acs_find_ideal_chan_mode() and make
the ACS code more spaghetti / less generic.

Thanks



More information about the Hostap mailing list