summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinyue Ling <quic_xinyling@quicinc.com>2023-04-14 00:58:03 -0700
committerJouni Malinen <j@w1.fi>2023-04-21 21:15:00 +0300
commitf54ce743353f14a5007c7e908b6374ef703b77e3 (patch)
tree84f14a1754db72590dbf022f72fa51be4f2b29c9
parent5b568b21ae2762af5f50cabe202e81c1b9179abc (diff)
downloadhostap-f54ce743353f14a5007c7e908b6374ef703b77e3.tar.gz
Fix determining mode for 6 GHz band when using hw_mode=any
When 6 GHz band is specified and hw_mode parameter is set to any, hostapd_determine_mode() may determine the wrong mode because there are two hw modes (5 GHz and 6 GHz) with HOSTAPD_MODE_IEEE80211A. This will cause 6 GHz AP to fail to start. Fix this by adding a check similar to the changes in commit 99cd453720d6 ("hw_feature: Correctly select mode in case of the 6 GHz band") into hostapd_determine_mode(). Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
-rw-r--r--src/ap/hw_features.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 842d9f5ba..154449068 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -1003,7 +1003,7 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
static void hostapd_determine_mode(struct hostapd_iface *iface)
{
- int i;
+ int i, chan;
enum hostapd_hw_mode target_mode;
if (iface->current_mode ||
@@ -1022,6 +1022,10 @@ static void hostapd_determine_mode(struct hostapd_iface *iface)
mode = &iface->hw_features[i];
if (mode->mode == target_mode) {
+ if (iface->freq > 0 &&
+ !hw_mode_get_channel(mode, iface->freq, &chan))
+ continue;
+
iface->current_mode = mode;
iface->conf->hw_mode = mode->mode;
break;