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
17 @@ -979,6 +979,9 @@ struct wpa_driver_associate_params {
18 * responsible for selecting with which BSS to associate. */
21 + unsigned char rates[WLAN_SUPP_RATES_MAX];
25 * bssid_hint - BSSID of a proposed AP
27 --- a/wpa_supplicant/config.c
28 +++ b/wpa_supplicant/config.c
30 #include "eap_peer/eap.h"
33 +#include "ap/sta_info.h"
37 @@ -2421,6 +2422,97 @@ static char * wpa_config_write_mac_value
38 #endif /* NO_CONFIG_WRITE */
41 +static int wpa_config_parse_mcast_rate(const struct parse_data *data,
42 + struct wpa_ssid *ssid, int line,
45 + ssid->mcast_rate = (int)(strtod(value, NULL) * 10);
50 +#ifndef NO_CONFIG_WRITE
51 +static char * wpa_config_write_mcast_rate(const struct parse_data *data,
52 + struct wpa_ssid *ssid)
57 + if (!ssid->mcast_rate == 0)
60 + value = os_malloc(6); /* longest: 300.0 */
63 + res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10);
70 +#endif /* NO_CONFIG_WRITE */
72 +static int wpa_config_parse_rates(const struct parse_data *data,
73 + struct wpa_ssid *ssid, int line,
77 + char *pos, *r, *sptr, *end;
80 + pos = (char *)value;
81 + r = strtok_r(pos, ",", &sptr);
83 + while (pos && i < WLAN_SUPP_RATES_MAX) {
86 + rate = strtod(r, &end);
87 + ssid->rates[i] = rate * 2;
88 + if (*end != '\0' || rate * 2 != ssid->rates[i])
92 + r = strtok_r(NULL, ",", &sptr);
98 +#ifndef NO_CONFIG_WRITE
99 +static char * wpa_config_write_rates(const struct parse_data *data,
100 + struct wpa_ssid *ssid)
105 + if (ssid->rates[0] <= 0)
108 + value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
112 + for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
113 + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
120 + res = os_snprintf(pos, 6, "%.1f",
121 + (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
127 + value[6 * WLAN_SUPP_RATES_MAX] = '\0';
130 +#endif /* NO_CONFIG_WRITE */
132 /* Helper macros for network block parser */
135 @@ -2713,6 +2805,8 @@ static const struct parse_data ssid_fiel
136 { INT(ap_max_inactivity) },
137 { INT(dtim_period) },
140 + { FUNC(mcast_rate) },
142 { INT_RANGE(macsec_policy, 0, 1) },
143 { INT_RANGE(macsec_integ_only, 0, 1) },
144 --- a/wpa_supplicant/config_ssid.h
145 +++ b/wpa_supplicant/config_ssid.h
146 @@ -879,6 +879,9 @@ struct wpa_ssid {
150 + unsigned char rates[WLAN_SUPP_RATES_MAX];
155 * macsec_policy - Determines the policy for MACsec secure session
156 --- a/wpa_supplicant/wpa_supplicant.c
157 +++ b/wpa_supplicant/wpa_supplicant.c
158 @@ -4370,6 +4370,12 @@ static void wpas_start_assoc_cb(struct w
159 params.beacon_int = ssid->beacon_int;
161 params.beacon_int = wpa_s->conf->beacon_int;
163 + while (i < WLAN_SUPP_RATES_MAX) {
164 + params.rates[i] = ssid->rates[i];
167 + params.mcast_rate = ssid->mcast_rate;
170 if (bss && ssid->enable_edmg)