wpa_supplicant: Enable HT for IBSS
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Wed, 1 Oct 2014 07:52:54 +0000 (09:52 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Oct 2014 15:54:22 +0000 (18:54 +0300)
Enable HT20 for IBSS when HT is supported by the driver.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index cf870c5..2d17aba 100644 (file)
@@ -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)) {
                /*
index 3c1d9ec..c1108b8 100644 (file)
@@ -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;
index f375486..cbe3e49 100644 (file)
@@ -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);