From 59e33b4a98a4ce72e8212ec0dc44860918b466a7 Mon Sep 17 00:00:00 2001 From: Ankita Bajaj Date: Wed, 27 Nov 2019 19:55:49 +0530 Subject: [PATCH] ACS: Select current hw_mode based on the selected frequency After receiving ACS offload results, select the current hw_mode based on the frequency selected by the ACS algorithm. The current hw_mode will be further used during other validation steps such as HT capability validations, DFS validation, etc. Signed-off-by: Jouni Malinen --- src/ap/drv_callbacks.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 49f4a0e36..8a4b0ef6a 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -944,12 +944,20 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd, return; } + hapd->iface->freq = acs_res->pri_freq; + if (!hapd->iface->current_mode) { for (i = 0; i < hapd->iface->num_hw_features; i++) { struct hostapd_hw_modes *mode = &hapd->iface->hw_features[i]; if (mode->mode == acs_res->hw_mode) { + if (hapd->iface->freq > 0 && + !hw_get_chan(mode->mode, + hapd->iface->freq, + hapd->iface->hw_features, + hapd->iface->num_hw_features)) + continue; hapd->iface->current_mode = mode; break; } @@ -963,8 +971,6 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd, } } - hapd->iface->freq = acs_res->pri_freq; - if (!acs_res->pri_freq) { hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_WARNING,