2012-07-24 23:07:10 +00:00
|
|
|
From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Antonio Quartulli <ordex@autistici.org>
|
|
|
|
Date: Sun, 3 Jun 2012 18:22:56 +0200
|
|
|
|
Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used
|
|
|
|
with the ibss join command
|
|
|
|
|
|
|
|
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
|
|
|
|
---
|
|
|
|
src/drivers/driver.h | 6 +++
|
|
|
|
wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++
|
|
|
|
wpa_supplicant/config_ssid.h | 6 +++
|
|
|
|
wpa_supplicant/wpa_supplicant.c | 23 +++++++---
|
|
|
|
4 files changed, 124 insertions(+), 7 deletions(-)
|
|
|
|
|
|
|
|
--- a/src/drivers/driver.h
|
|
|
|
+++ b/src/drivers/driver.h
|
|
|
|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
|
|
#define WPA_SUPPLICANT_DRIVER_VERSION 4
|
|
|
|
|
2016-06-15 17:28:48 +00:00
|
|
|
+#include "ap/sta_info.h"
|
2012-07-24 23:07:10 +00:00
|
|
|
#include "common/defs.h"
|
2016-01-28 17:19:13 +00:00
|
|
|
#include "common/ieee802_11_defs.h"
|
2013-11-25 15:43:15 +00:00
|
|
|
#include "utils/list.h"
|
2016-06-15 15:11:43 +00:00
|
|
|
@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
|
2014-04-06 12:13:55 +00:00
|
|
|
* responsible for selecting with which BSS to associate. */
|
|
|
|
const u8 *bssid;
|
2012-07-24 23:07:10 +00:00
|
|
|
|
2016-06-15 17:28:48 +00:00
|
|
|
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
2012-07-24 23:07:10 +00:00
|
|
|
+ int mcast_rate;
|
|
|
|
+
|
|
|
|
/**
|
2014-04-06 12:13:55 +00:00
|
|
|
* bssid_hint - BSSID of a proposed AP
|
|
|
|
*
|
2012-07-24 23:07:10 +00:00
|
|
|
--- a/wpa_supplicant/config.c
|
|
|
|
+++ b/wpa_supplicant/config.c
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -16,6 +16,7 @@
|
2012-07-24 23:07:10 +00:00
|
|
|
#include "eap_peer/eap.h"
|
|
|
|
#include "p2p/p2p.h"
|
2016-01-28 17:19:13 +00:00
|
|
|
#include "fst/fst.h"
|
2016-06-15 17:28:48 +00:00
|
|
|
+#include "ap/sta_info.h"
|
2012-07-24 23:07:10 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
2016-06-15 15:11:43 +00:00
|
|
|
@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
|
2015-03-26 23:33:47 +00:00
|
|
|
#endif /* CONFIG_MESH */
|
2012-07-24 23:07:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
+static int wpa_config_parse_mcast_rate(const struct parse_data *data,
|
|
|
|
+ struct wpa_ssid *ssid, int line,
|
|
|
|
+ const char *value)
|
|
|
|
+{
|
|
|
|
+ ssid->mcast_rate = (int)(strtod(value, NULL) * 10);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifndef NO_CONFIG_WRITE
|
|
|
|
+static char * wpa_config_write_mcast_rate(const struct parse_data *data,
|
|
|
|
+ struct wpa_ssid *ssid)
|
|
|
|
+{
|
|
|
|
+ char *value;
|
|
|
|
+ int res;
|
|
|
|
+
|
|
|
|
+ if (!ssid->mcast_rate == 0)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ value = os_malloc(6); /* longest: 300.0 */
|
|
|
|
+ if (value == NULL)
|
|
|
|
+ return NULL;
|
|
|
|
+ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10);
|
|
|
|
+ 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)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+ char *pos, *r, *sptr, *end;
|
|
|
|
+ double rate;
|
|
|
|
+
|
|
|
|
+ pos = (char *)value;
|
|
|
|
+ r = strtok_r(pos, ",", &sptr);
|
|
|
|
+ i = 0;
|
2016-06-15 17:28:48 +00:00
|
|
|
+ while (pos && i < WLAN_SUPP_RATES_MAX) {
|
2012-07-24 23:07:10 +00:00
|
|
|
+ rate = 0.0;
|
|
|
|
+ if (r)
|
|
|
|
+ rate = strtod(r, &end);
|
|
|
|
+ ssid->rates[i] = rate * 2;
|
|
|
|
+ if (*end != '\0' || rate * 2 != ssid->rates[i])
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
+ i++;
|
|
|
|
+ r = strtok_r(NULL, ",", &sptr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifndef NO_CONFIG_WRITE
|
|
|
|
+static char * wpa_config_write_rates(const struct parse_data *data,
|
|
|
|
+ struct wpa_ssid *ssid)
|
|
|
|
+{
|
|
|
|
+ char *value, *pos;
|
|
|
|
+ int res, i;
|
|
|
|
+
|
|
|
|
+ if (ssid->rates[0] <= 0)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
2016-06-15 17:28:48 +00:00
|
|
|
+ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
|
2012-07-24 23:07:10 +00:00
|
|
|
+ if (value == NULL)
|
|
|
|
+ return NULL;
|
|
|
|
+ pos = value;
|
2016-06-15 17:28:48 +00:00
|
|
|
+ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
|
2012-07-24 23:07:10 +00:00
|
|
|
+ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
|
|
|
|
+ if (res < 0) {
|
|
|
|
+ os_free(value);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+ pos += res;
|
|
|
|
+ }
|
|
|
|
+ res = os_snprintf(pos, 6, "%.1f",
|
2016-06-15 17:28:48 +00:00
|
|
|
+ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
|
2012-07-24 23:07:10 +00:00
|
|
|
+ if (res < 0) {
|
|
|
|
+ os_free(value);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
2016-06-15 17:28:48 +00:00
|
|
|
+ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
|
2012-07-24 23:07:10 +00:00
|
|
|
+ return value;
|
|
|
|
+}
|
|
|
|
+#endif /* NO_CONFIG_WRITE */
|
|
|
|
+
|
|
|
|
/* Helper macros for network block parser */
|
|
|
|
|
|
|
|
#ifdef OFFSET
|
2016-06-15 15:11:43 +00:00
|
|
|
@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
|
2012-07-24 23:07:10 +00:00
|
|
|
{ INT(ap_max_inactivity) },
|
2012-09-13 12:38:51 +00:00
|
|
|
{ INT(dtim_period) },
|
2013-03-04 17:16:38 +00:00
|
|
|
{ INT(beacon_int) },
|
2012-07-24 23:07:10 +00:00
|
|
|
+ { INT_RANGE(fixed_freq, 0, 1) },
|
|
|
|
+ { FUNC(rates) },
|
|
|
|
+ { FUNC(mcast_rate) },
|
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:10 +00:00
|
|
|
--- a/wpa_supplicant/config_ssid.h
|
|
|
|
+++ b/wpa_supplicant/config_ssid.h
|
2016-06-15 17:28:48 +00:00
|
|
|
@@ -10,8 +10,10 @@
|
|
|
|
#define CONFIG_SSID_H
|
|
|
|
|
2012-07-24 23:07:10 +00:00
|
|
|
#include "common/defs.h"
|
2016-06-15 17:28:48 +00:00
|
|
|
+#include "ap/sta_info.h"
|
2013-11-25 15:43:15 +00:00
|
|
|
#include "utils/list.h"
|
2012-07-24 23:07:10 +00:00
|
|
|
#include "eap_peer/eap_config.h"
|
|
|
|
+#include "drivers/nl80211_copy.h"
|
|
|
|
|
|
|
|
|
2016-01-28 17:19:13 +00:00
|
|
|
#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
|
2016-06-15 17:28:48 +00:00
|
|
|
@@ -711,6 +713,9 @@ struct wpa_ssid {
|
2012-07-24 23:07:10 +00:00
|
|
|
*/
|
2013-03-04 17:16:38 +00:00
|
|
|
void *parent_cred;
|
2014-06-05 15:58:01 +00:00
|
|
|
|
2016-06-15 17:28:48 +00:00
|
|
|
+ unsigned char rates[WLAN_SUPP_RATES_MAX];
|
2012-07-24 23:07:10 +00:00
|
|
|
+ double mcast_rate;
|
2014-06-05 15:58:01 +00:00
|
|
|
+
|
|
|
|
#ifdef CONFIG_MACSEC
|
|
|
|
/**
|
|
|
|
* macsec_policy - Determines the policy for MACsec secure session
|
2012-07-24 23:07:10 +00:00
|
|
|
--- a/wpa_supplicant/wpa_supplicant.c
|
|
|
|
+++ b/wpa_supplicant/wpa_supplicant.c
|
2016-07-26 11:47:00 +00:00
|
|
|
@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
|
2014-04-06 12:13:55 +00:00
|
|
|
params.beacon_int = ssid->beacon_int;
|
|
|
|
else
|
|
|
|
params.beacon_int = wpa_s->conf->beacon_int;
|
2012-07-24 23:07:10 +00:00
|
|
|
+ params.fixed_freq = ssid->fixed_freq;
|
|
|
|
+ i = 0;
|
2016-06-15 17:28:48 +00:00
|
|
|
+ while (i < WLAN_SUPP_RATES_MAX) {
|
2012-07-24 23:07:10 +00:00
|
|
|
+ params.rates[i] = ssid->rates[i];
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ params.mcast_rate = ssid->mcast_rate;
|
|
|
|
}
|
|
|
|
|
|
|
|
params.wpa_ie = wpa_ie;
|