[PATCH 2/2] wpa_supplicant: Enable HT for IBSS

Janusz Dziedzic janusz.dziedzic
Wed Oct 1 00:52:54 PDT 2014


Enable HT20 for IBSS when HT supported by driver.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/drivers/driver.h            |  3 +++
 wpa_supplicant/events.c         |  4 ++--
 wpa_supplicant/wpa_supplicant.c | 13 ++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 499038a..e60935d 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -4200,4 +4200,7 @@ const char * channel_width_to_string(enum chan_width width);
 /* NULL terminated array of linked in driver wrappers */
 extern struct wpa_driver_ops *wpa_drivers[];
 
+int ht_supported(const struct hostapd_hw_modes *mode);
+int vht_supported(const struct hostapd_hw_modes *mode);
+
 #endif /* DRIVER_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index cf870c5..2d17aba 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 24d04a2..a389ba5 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1838,8 +1838,19 @@ 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) {
+		struct hostapd_hw_modes *mode;
+		enum hostapd_hw_mode hw_mode;
+		u8 channel;
+		int ht_enabled;
+
+		hw_mode = ieee80211_freq_to_chan(ssid->frequency, &channel);
+		mode = &wpa_s->hw.modes[hw_mode];
+		ht_enabled = ht_supported(mode);
+
 		params.freq.freq = ssid->frequency;
+		params.freq.ht_enabled = ht_enabled;
+	}
 
 	if (ssid->mode == WPAS_MODE_IBSS) {
 		if (ssid->beacon_int)
-- 
1.9.1




More information about the Hostap mailing list