2012-07-24 23:07:25 +00:00
|
|
|
From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Antonio Quartulli <ordex@autistici.org>
|
|
|
|
Date: Tue, 3 Jul 2012 00:36:24 +0200
|
|
|
|
Subject: [PATCH] wpa_s: support htmode param
|
|
|
|
|
|
|
|
possible values are HT20, HT40-, HT40+ and NOHT
|
|
|
|
|
|
|
|
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
|
|
|
|
---
|
|
|
|
src/drivers/driver.h | 2 ++
|
|
|
|
src/drivers/driver_nl80211.c | 16 ++++++++++
|
|
|
|
wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++
|
|
|
|
wpa_supplicant/config_ssid.h | 2 ++
|
|
|
|
wpa_supplicant/wpa_supplicant.c | 2 ++
|
|
|
|
5 files changed, 88 insertions(+)
|
|
|
|
|
|
|
|
--- a/src/drivers/driver.h
|
|
|
|
+++ b/src/drivers/driver.h
|
2016-06-15 15:11:43 +00:00
|
|
|
@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
|
2015-03-26 23:33:47 +00:00
|
|
|
|
2016-06-15 17:28:48 +00:00
|
|
|
unsigned char rates[WLAN_SUPP_RATES_MAX];
|
2012-07-24 23:07:25 +00:00
|
|
|
int mcast_rate;
|
|
|
|
+ int ht_set;
|
|
|
|
+ unsigned int htmode;
|
|
|
|
|
|
|
|
/**
|
2014-04-06 12:13:55 +00:00
|
|
|
* bssid_hint - BSSID of a proposed AP
|
2012-07-24 23:07:25 +00:00
|
|
|
--- a/src/drivers/driver_nl80211.c
|
|
|
|
+++ b/src/drivers/driver_nl80211.c
|
2016-09-06 08:53:17 +00:00
|
|
|
@@ -4779,6 +4779,22 @@ retry:
|
2015-03-26 23:33:47 +00:00
|
|
|
nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
|
2012-07-24 23:07:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ if (params->ht_set) {
|
|
|
|
+ switch(params->htmode) {
|
|
|
|
+ case NL80211_CHAN_HT20:
|
|
|
|
+ wpa_printf(MSG_DEBUG, " * ht=HT20");
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_CHAN_HT40PLUS:
|
|
|
|
+ wpa_printf(MSG_DEBUG, " * ht=HT40+");
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_CHAN_HT40MINUS:
|
|
|
|
+ wpa_printf(MSG_DEBUG, " * ht=HT40-");
|
|
|
|
+ break;
|
|
|
|
+ }
|
2015-03-26 23:33:47 +00:00
|
|
|
+ nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
|
2012-07-24 23:07:25 +00:00
|
|
|
+ params->htmode);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
ret = nl80211_set_conn_keys(params, msg);
|
|
|
|
if (ret)
|
2015-03-26 23:33:47 +00:00
|
|
|
goto fail;
|
2012-07-24 23:07:25 +00:00
|
|
|
--- a/wpa_supplicant/config.c
|
|
|
|
+++ b/wpa_supplicant/config.c
|
2016-06-15 15:11:43 +00:00
|
|
|
@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
|
2012-07-24 23:07:25 +00:00
|
|
|
}
|
|
|
|
#endif /* NO_CONFIG_WRITE */
|
|
|
|
|
|
|
|
+static int wpa_config_parse_htmode(const struct parse_data *data,
|
|
|
|
+ struct wpa_ssid *ssid, int line,
|
|
|
|
+ const char *value)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+ static const struct {
|
|
|
|
+ const char *name;
|
|
|
|
+ unsigned int val;
|
|
|
|
+ } htmap[] = {
|
|
|
|
+ { .name = "HT20", .val = NL80211_CHAN_HT20, },
|
|
|
|
+ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
|
|
|
|
+ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
|
|
|
|
+ { .name = "NOHT", .val = NL80211_CHAN_NO_HT, },
|
|
|
|
+ };
|
|
|
|
+ ssid->ht_set = 0;;
|
|
|
|
+ for (i = 0; i < 4; i++) {
|
|
|
|
+ if (strcasecmp(htmap[i].name, value) == 0) {
|
|
|
|
+ ssid->htmode = htmap[i].val;
|
|
|
|
+ ssid->ht_set = 1;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifndef NO_CONFIG_WRITE
|
|
|
|
+static char * wpa_config_write_htmode(const struct parse_data *data,
|
|
|
|
+ struct wpa_ssid *ssid)
|
|
|
|
+{
|
|
|
|
+ char *value;
|
|
|
|
+ int res;
|
|
|
|
+
|
|
|
|
+ value = os_malloc(6); /* longest: HT40+ */
|
|
|
|
+ if (value == NULL)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ switch(ssid->htmode) {
|
|
|
|
+ case NL80211_CHAN_HT20:
|
|
|
|
+ res = os_snprintf(value, 4, "HT20");
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_CHAN_HT40PLUS:
|
|
|
|
+ res = os_snprintf(value, 5, "HT40+");
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_CHAN_HT40MINUS:
|
|
|
|
+ res = os_snprintf(value, 5, "HT40-");
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_CHAN_NO_HT:
|
|
|
|
+ res = os_snprintf(value, 4, "NOHT");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ os_free(value);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (res < 0) {
|
|
|
|
+ os_free(value);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return value;
|
|
|
|
+}
|
|
|
|
+#endif /* NO_CONFIG_WRITE */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
static int wpa_config_parse_rates(const struct parse_data *data,
|
|
|
|
struct wpa_ssid *ssid, int line,
|
|
|
|
const char *value)
|
2016-09-06 08:53:17 +00:00
|
|
|
@@ -2143,6 +2208,7 @@ static const struct parse_data ssid_fiel
|
2013-03-04 17:16:38 +00:00
|
|
|
{ INT_RANGE(fixed_freq, 0, 1) },
|
2012-07-24 23:07:25 +00:00
|
|
|
{ FUNC(rates) },
|
|
|
|
{ FUNC(mcast_rate) },
|
|
|
|
+ { FUNC(htmode) },
|
2014-06-05 15:58:01 +00:00
|
|
|
#ifdef CONFIG_MACSEC
|
|
|
|
{ INT_RANGE(macsec_policy, 0, 1) },
|
|
|
|
#endif /* CONFIG_MACSEC */
|
2012-07-24 23:07:25 +00:00
|
|
|
--- a/wpa_supplicant/config_ssid.h
|
|
|
|
+++ b/wpa_supplicant/config_ssid.h
|
2016-09-06 08:53:17 +00:00
|
|
|
@@ -723,6 +723,8 @@ struct wpa_ssid {
|
2015-03-26 23:33:47 +00:00
|
|
|
|
2016-06-15 17:28:48 +00:00
|
|
|
unsigned char rates[WLAN_SUPP_RATES_MAX];
|
2012-07-24 23:07:25 +00:00
|
|
|
double mcast_rate;
|
|
|
|
+ int ht_set;
|
|
|
|
+ unsigned int htmode;
|
|
|
|
|
2014-06-05 15:58:01 +00:00
|
|
|
#ifdef CONFIG_MACSEC
|
|
|
|
/**
|
2012-07-24 23:07:25 +00:00
|
|
|
--- a/wpa_supplicant/wpa_supplicant.c
|
|
|
|
+++ b/wpa_supplicant/wpa_supplicant.c
|
2016-09-06 08:53:17 +00:00
|
|
|
@@ -2534,6 +2534,8 @@ static void wpas_start_assoc_cb(struct w
|
2012-07-24 23:07:25 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
params.mcast_rate = ssid->mcast_rate;
|
|
|
|
+ params.ht_set = ssid->ht_set;
|
|
|
|
+ params.htmode = ssid->htmode;
|
|
|
|
}
|
|
|
|
|
|
|
|
params.wpa_ie = wpa_ie;
|