aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Xu <pxu@qca.qualcomm.com>2017-02-22 22:05:35 (GMT)
committerJouni Malinen <j@w1.fi>2017-02-26 10:24:03 (GMT)
commit5b9f46df0e19111a64c6036df59076f879777988 (patch)
tree41614a6f2ed2f5f749533d9689dc6c21d2ef864a /src
parent4c8836f13985f2e3cfe26398de86065f8bcb3be3 (diff)
downloadhostap-5b9f46df0e19111a64c6036df59076f879777988.zip
hostap-5b9f46df0e19111a64c6036df59076f879777988.tar.gz
hostap-5b9f46df0e19111a64c6036df59076f879777988.tar.bz2
hostapd: Get channel number from frequency based on other modes as well
When getting the channel number from a frequency, all supported modes should be checked rather than just the current mode. This is needed when hostapd switches to a channel in different band. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src')
-rw-r--r--src/ap/hw_features.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 2d6cef1..93d923a 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -909,5 +909,19 @@ int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan)
int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
{
- return hw_get_chan(hapd->iface->current_mode, freq);
+ int i, channel;
+ struct hostapd_hw_modes *mode;
+
+ channel = hw_get_chan(hapd->iface->current_mode, freq);
+ if (channel)
+ return channel;
+ /* Check other available modes since the channel list for the current
+ * mode did not include the specified frequency. */
+ for (i = 0; i < hapd->iface->num_hw_features; i++) {
+ mode = &hapd->iface->hw_features[i];
+ channel = hw_get_chan(mode, freq);
+ if (channel)
+ return channel;
+ }
+ return 0;
}