1 From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <ordex@autistici.org>
3 Date: Sun, 3 Jun 2012 18:22:56 +0200
4 Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used
5 with the ibss join command
7 Signed-hostap: Antonio Quartulli <ordex@autistici.org>
9 src/drivers/driver.h | 6 +++
10 wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++
11 wpa_supplicant/config_ssid.h | 6 +++
12 wpa_supplicant/wpa_supplicant.c | 23 +++++++---
13 4 files changed, 124 insertions(+), 7 deletions(-)
15 --- a/src/drivers/driver.h
16 +++ b/src/drivers/driver.h
19 #define WPA_SUPPLICANT_DRIVER_VERSION 4
21 +#include "ap/sta_info.h"
22 #include "common/defs.h"
23 #include "common/ieee802_11_defs.h"
24 #include "common/wpa_common.h"
25 @@ -762,6 +763,9 @@ struct wpa_driver_associate_params {
26 * responsible for selecting with which BSS to associate. */
29 + unsigned char rates[WLAN_SUPP_RATES_MAX];
33 * bssid_hint - BSSID of a proposed AP
35 --- a/wpa_supplicant/config.c
36 +++ b/wpa_supplicant/config.c
38 #include "eap_peer/eap.h"
41 +#include "ap/sta_info.h"
45 @@ -2037,6 +2038,97 @@ static char * wpa_config_write_peerkey(c
46 #endif /* NO_CONFIG_WRITE */
49 +static int wpa_config_parse_mcast_rate(const struct parse_data *data,
50 + struct wpa_ssid *ssid, int line,
53 + ssid->mcast_rate = (int)(strtod(value, NULL) * 10);
58 +#ifndef NO_CONFIG_WRITE
59 +static char * wpa_config_write_mcast_rate(const struct parse_data *data,
60 + struct wpa_ssid *ssid)
65 + if (!ssid->mcast_rate == 0)
68 + value = os_malloc(6); /* longest: 300.0 */
71 + res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10);
78 +#endif /* NO_CONFIG_WRITE */
80 +static int wpa_config_parse_rates(const struct parse_data *data,
81 + struct wpa_ssid *ssid, int line,
85 + char *pos, *r, *sptr, *end;
88 + pos = (char *)value;
89 + r = strtok_r(pos, ",", &sptr);
91 + while (pos && i < WLAN_SUPP_RATES_MAX) {
94 + rate = strtod(r, &end);
95 + ssid->rates[i] = rate * 2;
96 + if (*end != '\0' || rate * 2 != ssid->rates[i])
100 + r = strtok_r(NULL, ",", &sptr);
106 +#ifndef NO_CONFIG_WRITE
107 +static char * wpa_config_write_rates(const struct parse_data *data,
108 + struct wpa_ssid *ssid)
113 + if (ssid->rates[0] <= 0)
116 + value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
120 + for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
121 + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
128 + res = os_snprintf(pos, 6, "%.1f",
129 + (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
135 + value[6 * WLAN_SUPP_RATES_MAX] = '\0';
138 +#endif /* NO_CONFIG_WRITE */
140 /* Helper macros for network block parser */
143 @@ -2282,6 +2374,8 @@ static const struct parse_data ssid_fiel
144 { INT(ap_max_inactivity) },
145 { INT(dtim_period) },
148 + { FUNC(mcast_rate) },
150 { INT_RANGE(macsec_policy, 0, 1) },
151 { INT_RANGE(macsec_integ_only, 0, 1) },
152 --- a/wpa_supplicant/config_ssid.h
153 +++ b/wpa_supplicant/config_ssid.h
155 #define CONFIG_SSID_H
157 #include "common/defs.h"
158 +#include "ap/sta_info.h"
159 #include "utils/list.h"
160 #include "eap_peer/eap_config.h"
161 +#include "drivers/nl80211_copy.h"
164 #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
165 @@ -757,6 +759,9 @@ struct wpa_ssid {
169 + unsigned char rates[WLAN_SUPP_RATES_MAX];
174 * macsec_policy - Determines the policy for MACsec secure session
175 --- a/wpa_supplicant/wpa_supplicant.c
176 +++ b/wpa_supplicant/wpa_supplicant.c
177 @@ -3061,6 +3061,12 @@ static void wpas_start_assoc_cb(struct w
178 params.beacon_int = ssid->beacon_int;
180 params.beacon_int = wpa_s->conf->beacon_int;
182 + while (i < WLAN_SUPP_RATES_MAX) {
183 + params.rates[i] = ssid->rates[i];
186 + params.mcast_rate = ssid->mcast_rate;
189 params.pairwise_suite = cipher_pairwise;