1 From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <ordex@autistici.org>
3 Date: Tue, 3 Jul 2012 00:36:24 +0200
4 Subject: [PATCH] wpa_s: support htmode param
6 possible values are HT20, HT40-, HT40+ and NOHT
8 Signed-off-by: Antonio Quartulli <ordex@autistici.org>
10 src/drivers/driver.h | 2 ++
11 src/drivers/driver_nl80211.c | 16 ++++++++++
12 wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++
13 wpa_supplicant/config_ssid.h | 2 ++
14 wpa_supplicant/wpa_supplicant.c | 2 ++
15 5 files changed, 88 insertions(+)
17 --- a/src/drivers/driver.h
18 +++ b/src/drivers/driver.h
19 @@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
21 unsigned char rates[NL80211_MAX_SUPP_RATES];
24 + unsigned int htmode;
27 * bssid_hint - BSSID of a proposed AP
28 --- a/src/drivers/driver_nl80211.c
29 +++ b/src/drivers/driver_nl80211.c
30 @@ -4702,6 +4702,22 @@ retry:
31 nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
34 + if (params->ht_set) {
35 + switch(params->htmode) {
36 + case NL80211_CHAN_HT20:
37 + wpa_printf(MSG_DEBUG, " * ht=HT20");
39 + case NL80211_CHAN_HT40PLUS:
40 + wpa_printf(MSG_DEBUG, " * ht=HT40+");
42 + case NL80211_CHAN_HT40MINUS:
43 + wpa_printf(MSG_DEBUG, " * ht=HT40-");
46 + nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
50 ret = nl80211_set_conn_keys(params, msg);
53 --- a/wpa_supplicant/config.c
54 +++ b/wpa_supplicant/config.c
55 @@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
57 #endif /* NO_CONFIG_WRITE */
59 +static int wpa_config_parse_htmode(const struct parse_data *data,
60 + struct wpa_ssid *ssid, int line,
64 + static const struct {
68 + { .name = "HT20", .val = NL80211_CHAN_HT20, },
69 + { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
70 + { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
71 + { .name = "NOHT", .val = NL80211_CHAN_NO_HT, },
74 + for (i = 0; i < 4; i++) {
75 + if (strcasecmp(htmap[i].name, value) == 0) {
76 + ssid->htmode = htmap[i].val;
85 +#ifndef NO_CONFIG_WRITE
86 +static char * wpa_config_write_htmode(const struct parse_data *data,
87 + struct wpa_ssid *ssid)
92 + value = os_malloc(6); /* longest: HT40+ */
96 + switch(ssid->htmode) {
97 + case NL80211_CHAN_HT20:
98 + res = os_snprintf(value, 4, "HT20");
100 + case NL80211_CHAN_HT40PLUS:
101 + res = os_snprintf(value, 5, "HT40+");
103 + case NL80211_CHAN_HT40MINUS:
104 + res = os_snprintf(value, 5, "HT40-");
106 + case NL80211_CHAN_NO_HT:
107 + res = os_snprintf(value, 4, "NOHT");
121 +#endif /* NO_CONFIG_WRITE */
124 static int wpa_config_parse_rates(const struct parse_data *data,
125 struct wpa_ssid *ssid, int line,
127 @@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
128 { INT_RANGE(fixed_freq, 0, 1) },
130 { FUNC(mcast_rate) },
133 { INT_RANGE(macsec_policy, 0, 1) },
134 #endif /* CONFIG_MACSEC */
135 --- a/wpa_supplicant/config_ssid.h
136 +++ b/wpa_supplicant/config_ssid.h
137 @@ -714,6 +714,8 @@ struct wpa_ssid {
139 unsigned char rates[NL80211_MAX_SUPP_RATES];
142 + unsigned int htmode;
146 --- a/wpa_supplicant/wpa_supplicant.c
147 +++ b/wpa_supplicant/wpa_supplicant.c
148 @@ -2517,6 +2517,8 @@ static void wpas_start_assoc_cb(struct w
151 params.mcast_rate = ssid->mcast_rate;
152 + params.ht_set = ssid->ht_set;
153 + params.htmode = ssid->htmode;
156 params.wpa_ie = wpa_ie;