@@ -1383,10 +1383,40 @@ static void hostapd_notify_bad_chans(struct hostapd_iface *iface)
int hostapd_acs_completed(struct hostapd_iface *iface, int err)
{
int ret = -1;
+ int i;
if (err)
goto out;
+ if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G ||
+ iface->conf->ieee80211n || iface->conf->ieee80211ac ||
+ iface->conf->ieee80211ax || iface->conf->ieee80211be) &&
+ iface->conf->channel == 14) {
+ wpa_printf(MSG_INFO, "Disable OFDM/HT/VHT/HE/EHT on channel 14");
+ iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B;
+ iface->conf->ieee80211n = 0;
+ iface->conf->ieee80211ac = 0;
+ iface->conf->ieee80211ax = 0;
+ iface->conf->ieee80211be = 0;
+
+ iface->current_mode = NULL;
+ for (i = 0; i < iface->num_hw_features; i++) {
+ struct hostapd_hw_modes *mode = &iface->hw_features[i];
+
+ if (mode->mode == iface->conf->hw_mode) {
+ if (skip_mode(iface, mode))
+ continue;
+
+ iface->current_mode = mode;
+ break;
+ }
+ }
+
+ if (!iface->current_mode)
+ wpa_printf(MSG_ERROR,
+ "No hw mode available for channel 14");
+ }
+
switch (hostapd_check_chans(iface)) {
case HOSTAPD_CHAN_VALID:
iface->is_no_ir = false;
The channel 14 downgrade (force IEEE 802.11b mode and disable HT, VHT, HE, and EHT) is done only in hostapd_select_hw_mode(). In the ACS offload case, the selected channel is applied through hostapd_acs_channel_selected() and hostapd_acs_completed() without calling hostapd_select_hw_mode(), so channel 14 (2484 MHz) gets configured with HT/VHT/HE enabled. The kernel rejects that since channel 14 is allowed only for IEEE 802.11b without HT (NL80211_CHAN_WIDTH_20_NOHT), and AP setup fails with -EINVAL. Apply the same channel 14 downgrade in hostapd_acs_completed() before validating the selected channels, and reselect current_mode based on the downgraded mode so that the rate set and ERP information element are generated for IEEE 802.11b. This is idempotent for the internal ACS and fixed channel cases where hostapd_select_hw_mode() has already applied the same downgrade. Signed-off-by: chao.meng <chao.meng@unisoc.com> --- src/ap/hw_features.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.43.0.windows.1