From 93fbb30ecd2437c947f63e2751bd4958f59da5e5 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Fri, 10 Jun 2016 07:41:25 -0700 Subject: [PATCH] supplicant: Properly match 5/10Mhz rates. Kernel is still reporting 20Mhz encoding rates even though we may be configured for 5Mhz. So, divide the basic rates accordingly in order to properly match the beacon IE from the AP. And, fix some compile warnings from previous patches. Signed-off-by: Ben Greear --- src/drivers/driver_nl80211_event.c | 4 ++++ wpa_supplicant/events.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index c4bad89718..267d293341 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -483,8 +483,12 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, wpa_printf(MSG_DEBUG, "nl80211: Channel type: %d", ch_type); switch (ch_type) { case NL80211_CHAN_NO_HT: + case NL80211_CHAN_NO_HT5: + case NL80211_CHAN_NO_HT10: ht_enabled = 0; break; + case NL80211_CHAN_HT5: + case NL80211_CHAN_HT10: case NL80211_CHAN_HT20: break; case NL80211_CHAN_HT40PLUS: diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 2d2c29e64c..aa46af5ecb 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -762,7 +762,12 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) /* check for legacy basic rates */ for (k = 0; k < mode->num_rates; k++) { - if (mode->rates[k] == r) + int rk = mode->rates[k]; + if (wpa_s->conf->chan_width == 5) + rk = rk / 4; + else if (wpa_s->conf->chan_width == 10) + rk = rk / 2; + if (rk == r) break; } if (k == mode->num_rates) { @@ -772,9 +777,9 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) * have to be supported by the hardware. */ wpa_dbg(wpa_s, MSG_DEBUG, - " hardware does not support required rate %d.%d Mbps (freq=%d mode==%d num_rates=%d)", + " hardware does not support required rate %d.%d Mbps (freq=%d mode==%d num_rates=%d chan_width=%d)", r / 10, r % 10, - bss->freq, mode->mode, mode->num_rates); + bss->freq, mode->mode, mode->num_rates, wpa_s->conf->chan_width); return 0; } }