From dc152f32b4fd8af8ec055e3d551523e62792a585 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Wed, 1 Oct 2014 09:52:54 +0200 Subject: [PATCH] wpa_supplicant: Enable HT for IBSS Enable HT20 for IBSS when HT is supported by the driver. Signed-off-by: Janusz Dziedzic --- wpa_supplicant/events.c | 4 ++-- wpa_supplicant/wpa_supplicant.c | 17 ++++++++++++++++- wpa_supplicant/wpa_supplicant_i.h | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index cf870c51d..2d17aba3e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -582,7 +582,7 @@ static int freq_allowed(int *freqs, int freq) } -static int ht_supported(const struct hostapd_hw_modes *mode) +int ht_supported(const struct hostapd_hw_modes *mode) { if (!(mode->flags & HOSTAPD_MODE_FLAG_HT_INFO_KNOWN)) { /* @@ -600,7 +600,7 @@ static int ht_supported(const struct hostapd_hw_modes *mode) } -static int vht_supported(const struct hostapd_hw_modes *mode) +int vht_supported(const struct hostapd_hw_modes *mode) { if (!(mode->flags & HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN)) { /* diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 3c1d9ec12..c1108b84c 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1851,9 +1851,24 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) } if (ssid->mode == WPAS_MODE_IBSS && ssid->frequency > 0 && - params.freq.freq == 0) + params.freq.freq == 0) { + enum hostapd_hw_mode hw_mode; + u8 channel; + params.freq.freq = ssid->frequency; + hw_mode = ieee80211_freq_to_chan(ssid->frequency, &channel); + for (i = 0; wpa_s->hw.modes && i < wpa_s->hw.num_modes; i++) { + if (wpa_s->hw.modes[i].mode == hw_mode) { + struct hostapd_hw_modes *mode; + + mode = &wpa_s->hw.modes[i]; + params.freq.ht_enabled = ht_supported(mode); + break; + } + } + } + if (ssid->mode == WPAS_MODE_IBSS) { if (ssid->beacon_int) params.beacon_int = ssid->beacon_int; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index f375486c6..cbe3e49c5 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -989,6 +989,8 @@ void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s); int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s); struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s, struct wpa_ssid **selected_ssid); +int ht_supported(const struct hostapd_hw_modes *mode); +int vht_supported(const struct hostapd_hw_modes *mode); /* eap_register.c */ int eap_register_methods(void);