summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Malinen <quic_jouni@quicinc.com>2023-04-25 17:29:46 +0300
committerJouni Malinen <j@w1.fi>2023-04-25 17:29:46 +0300
commitd930211bdd146c66660b60eca5f1ace4bf84fdc6 (patch)
tree520ae53db66e3ace506a045f51bcf7779ff3406d
parent927dbfb453ed712e4eea05eba44ea67b8a734fda (diff)
downloadhostap-d930211bdd146c66660b60eca5f1ace4bf84fdc6.tar.gz
Select 6 GHz mode correctly for ACS cases
Use the op_class configuration to determine whether to select the 5 GHz or 6 GHz mode for ACS. Without this, the first mode (5 GHz in most cases) would have been selected regardless of the op_class value. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
-rw-r--r--src/ap/hw_features.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 154449068..f836be488 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -1001,9 +1001,27 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
}
+static bool skip_mode(struct hostapd_iface *iface,
+ struct hostapd_hw_modes *mode)
+{
+ int chan;
+
+ if (iface->freq > 0 && !hw_mode_get_channel(mode, iface->freq, &chan))
+ return true;
+
+ if (is_6ghz_op_class(iface->conf->op_class) && iface->freq == 0 &&
+ (mode->mode != HOSTAPD_MODE_IEEE80211A ||
+ mode->num_channels == 0 ||
+ !is_6ghz_freq(mode->channels[0].freq)))
+ return true;
+
+ return false;
+}
+
+
static void hostapd_determine_mode(struct hostapd_iface *iface)
{
- int i, chan;
+ int i;
enum hostapd_hw_mode target_mode;
if (iface->current_mode ||
@@ -1022,8 +1040,7 @@ 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))
+ if (skip_mode(iface, mode))
continue;
iface->current_mode = mode;
@@ -1156,11 +1173,9 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
iface->current_mode = NULL;
for (i = 0; i < iface->num_hw_features; i++) {
struct hostapd_hw_modes *mode = &iface->hw_features[i];
- int chan;
if (mode->mode == iface->conf->hw_mode) {
- if (iface->freq > 0 &&
- !hw_mode_get_channel(mode, iface->freq, &chan))
+ if (skip_mode(iface, mode))
continue;
iface->current_mode = mode;