Skip to content

Commit

Permalink
supplicant: Properly match 5/10Mhz rates.
Browse files Browse the repository at this point in the history
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 <greearb@candelatech.com>
  • Loading branch information
greearb committed Jun 10, 2016
1 parent aff9253 commit 93fbb30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/drivers/driver_nl80211_event.c
Expand Up @@ -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:
Expand Down
11 changes: 8 additions & 3 deletions wpa_supplicant/events.c
Expand Up @@ -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) {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 93fbb30

Please sign in to comment.