aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wnm_sta.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-02-05 15:06:06 (GMT)
committerJouni Malinen <j@w1.fi>2016-02-05 15:06:06 (GMT)
commit80ce804e88247bb0409d131c5882808a0ce9bba4 (patch)
tree437a2e76238a942da499078153fb630394d21b8a /wpa_supplicant/wnm_sta.c
parentaf060932deada3e0822f2a53a9ef6337b16af83b (diff)
downloadhostap-80ce804e88247bb0409d131c5882808a0ce9bba4.zip
hostap-80ce804e88247bb0409d131c5882808a0ce9bba4.tar.gz
hostap-80ce804e88247bb0409d131c5882808a0ce9bba4.tar.bz2
WNM: Workaround for broken AP operating class behavior
Some APs do not advertise operating classes correctly for BSS Transition Management. Try to determine the most likely operating frequency based on the channel number (1..14 --> 2.4 GHz; 36..169 --> 5 GHz) if invalid op_class == 0 is received in a BSS Transition Management Request. This speeds up the following operating by avoiding a full scan due to an unknown channel. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wnm_sta.c')
-rw-r--r--wpa_supplicant/wnm_sta.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index e1596cb..ffc9052 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -429,6 +429,7 @@ static int wnm_nei_get_chan(struct wpa_supplicant *wpa_s, u8 op_class, u8 chan)
{
struct wpa_bss *bss = wpa_s->current_bss;
const char *country = NULL;
+ int freq;
if (bss) {
const u8 *elem = wpa_bss_get_ie(bss, WLAN_EID_COUNTRY);
@@ -437,7 +438,21 @@ static int wnm_nei_get_chan(struct wpa_supplicant *wpa_s, u8 op_class, u8 chan)
country = (const char *) (elem + 2);
}
- return ieee80211_chan_to_freq(country, op_class, chan);
+ freq = ieee80211_chan_to_freq(country, op_class, chan);
+ if (freq <= 0 && op_class == 0) {
+ /*
+ * Some APs do not advertise correct operating class
+ * information. Try to determine the most likely operating
+ * frequency based on the channel number.
+ */
+ if (chan >= 1 && chan <= 13)
+ freq = 2407 + chan * 5;
+ else if (chan == 14)
+ freq = 2484;
+ else if (chan >= 36 && chan <= 169)
+ freq = 5000 + chan * 5;
+ }
+ return freq;
}